Data Virtualization Tutorial: Introduction to SQL Script

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
A Guide to SQL, Seventh Edition. Objectives Embed SQL commands in PL/SQL programs Retrieve single rows using embedded SQL Update a table using embedded.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Introduction to PL/SQL Chapter 9. Objectives Explain the need for PL/SQL Explain the benefits of PL/SQL Identify the different types of PL/SQL blocks.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Linux Operations and Administration
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Programming in C#. I. Introduction C# (or C-Sharp) is a programming language. C# is used to write software that runs on the.NET Framework. Although C#
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Visual Basic for Application - Microsoft Access 2003 Finishing the application.
NSF DUE ; Wen M. Andrews J. Sargeant Reynolds Community College Richmond, Virginia.
Batch Jobs Using the batch job functions. Use [Bulk Changes][Batch Job Utility] to start. Read the information panel. Check with TAMS Technical Support.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Perfecto Mobile Automation
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
0 Copyright 2012 FUJITSU Interstage BOP SQL Query Tutorial Todd Palmer October 2012.
Mail Merge Introduction to Word Processing ITSW 1401 Instructor: Glenda H. Easter Introduction to Word Processing ITSW 1401 Instructor: Glenda H. Easter.
Data Virtualization Demoette… ODBC Clients
Data Virtualization Tutorial… SSL with CIS Web Data Sources
Data Virtualization Tutorial: Custom Functions
The eclipse IDE IDE = “Integrated Development Environment”
Data Virtualization Demoette… Logging in CIS
Development Environment
Data Virtualization Demoette… Packaged Query Single Select Option
Project Management: Messages
Data Virtualization Demoette… Business Directory Custom Properties
Data Virtualization Demoette… Caching – Database – Multi Table
Business Directory REST API
A Guide to SQL, Seventh Edition
Data Virtualization Demoette… Custom Java Procedures
Data Virtualization Demoette… Flat-File Data Sources
TOPSpro Special Topics
Forms and Reports 09.
Data Virtualization Demoette… JMeter Load Testing CIS JDBC
Data Virtualization Demoette… ADO.NET Client
Data Virtualization Community Edition
Data Virtualization Demoette… JMeter Load Testing CIS SOAP
Data Virtualization Tutorial… LDAP Domains in CIS
Cisco Data Virtualization
Data Virtualization Community Edition
Data Virtualization Demoette… CIS Rights
Data Virtualization Tutorial… CORS and CIS
Data Virtualization Demoette… Data Lineage Reporting
Data Virtualization Tutorial… OAuth Example using Google Sheets
Data Virtualization Tutorial: XSLT and Streaming Transformations
Data Virtualization Demoette… JDBC Clients
Data Virtualization Tutorial… Semijoin Optimization
Data Virtualization Demoette… Column-Based Security
Data Virtualization Demoette… Parameterized Queries
UNIT - V STORED PROCEDURE.
Data Virtualization Demoette… Salesforce.com Data Source
Introduction to PL/SQL
Data Virtualization Demoette… DDL Feature
Data Virtualization Tutorial: JSON_TABLE Queries
Access Maintaining and Querying a Database
Data Virtualization Community Edition
PL/SQL Scripting in Oracle:
20761B 12: Using Set Operators Module 12   Using Set Operators.
Advanced PL/SQL Programing
Using JDeveloper.
Course: Module: Lesson # & Name Instructional Material 1 of 32 Lesson Delivery Mode: Lesson Duration: Document Name: 1. Professional Diploma in ERP Systems.
Introduction to Database Programs
Tutorial 7 – Integrating Access With the Web and With Other Programs
Planning a Group Policy Management and Implementation Strategy
Introduction to Database Programs
Presentation transcript:

Data Virtualization Tutorial: Introduction to SQL Script Hello, and welcome to the Tutorial Series for Cisco Information Server, or CIS. In this tutorial, we introduce SQL Script.

For more details… Resources: Additional information: Archives Documentation Training Resources: Archives Data files Tutorial Document Note that Tutorials are NOT meant to be comprehensive training modules. Instead, they demonstrate a very basic use case that can be built quickly and easily. However, the Data Virtualization Knowledge Base contains additional information that will help you learn more and go deeper. Additional resources in the Knowledge Base include: <CLICK> Resources used to build the tutorial, such as Data Virtualization Archive files, data source files, and a document version of this tutorial… <CLICK> … and additional information, including documentation and training materials.

Agenda What is it and why does it matter? How-to Summary Here is our agenda. We begin by defining SQL Script and outlining its importance in Data Virtualization projects. Next we demonstrate the basics of SQL Script. Finally, we summarize the contents of this tutorial.

Agenda What is it and why does it matter? How-to Summary Let’s begin by discussing what SQL Script is, and why it is important for Data Virtualization.

What is it? SQL Script ANSI-SQL-compliant Scripting Language Enables procedural logic, including Conditional execution Looping Pipelining Exception handling Etc. SQL Script is CIS’s ANSI-SQL-compliant scripting language. It enables procedural logic for data integration, including conditional execution, looping, pipelining, exception handling, and many other features.

Why does it matter? SQL Script Procedural logic Parameter-driven processing Calls to system procedures and custom procedures Exception handling and logging SQL Script is important in an enormous range of Data Virtualization use cases. It enables users to write procedural logic for scenarios that are difficult to handle in declarative SQL. It enables parameter-driven processing. SQL Script procedures can make calls to other procedures, including system utility procedures and custom procedures written in Java. SQL Script enables exception handling and logging, which can be important in many Data Virtualization projects.

Agenda What is it and why does it matter? How-to Summary Next, let’s walk through a very basic demo of SQL Script.

Here is the business problem… SQL Script is an extremely full-featured and flexible feature that can be used in countless use cases. We can only scratch the surface of SQL Script in this brief introductory tutorial. We’ll walk through a very simple use case that shows a few basic features of SQL Script. After using this tutorial, you will be ready to learn more about SQL Script’s many capabilities. In this use case, we want to make data available from the CIS System database, which is published as a virtual database in Composite Data Services. This database contains the CIS metadata repository, as well as a number of tables that hold operational data. <CLICK> Specifically, we want to write a script that returns data from the table SYS_REQUESTS, which records information about individual data requests made by users. However, we have some special security requirements. <CLICK> The user named Admin can retrieve data for any user… <CLICK> … but other users can only retrieve their own data. We’ll use SQL Script to solve this problem.

Before you begin… You can easily build this SQL Script from scratch. However, the Knowledge Base also contains a Data Virtualization Archive File with this script. <CLICK> If you want to follow this demo exactly, create users named Admin, and Another-Admin.

Compose the Script Now we’re ready to begin. Create a folder for your work. <CLICK> Right-click the folder and select New SQL Script. <CLICK> Name the script… <CLICK> … and a script skeleton appears in the editor.

Compose the Script First, define the script’s parameters. Parameters are placed between the parentheses that immediately follow the name of the script. <CLICK> We’ll use an Input parameter that holds the name of the user for whom we want to retrieve Request data. <CLICK> We’ll return an Output parameter that is a Cursor containing the returned data.

Compose the Script The script’s statements are placed between the BEGIN and END statements. <CLICK> We declare a work area we’ll be using… <CLICK> An Exception object… <CLICK> … and another work area for building the message we want to associate with the Exception. Notice that statements must end with a semi-colon.

Compose the Script One reason that SQL Script is so powerful is that scripts can call other procedures that are written in SQL Script or Java. CIS delivers a large library of procedures we can call. <CLICK> We need to verify the caller’s identity, so we’ll make use of a CIS procedure called GetProperty, which is found in the util folder of the procedure library. <CLICK> Open the procedure, and the Info tab will tell you how to use it. <CLICK> Pass in the constant CURRENT_USER_NAME and the procedure will return the current user.

Compose the Script Here we make the call in our script. Notice that the fully-qualified name of the called procedure is lib/util/GetProperty. Simply drag the procedure into your script from the Studio Explorer, and the fully-qualified name will appear. When we execute this line, the user’s actual name will be placed in the work area field userActualIdentity, which we defined earlier.

Compose the Script Now we can use an IF statement to build the main logic we need. If this user is named Admin… <CLICK> We’ll query the SYS_REQUESTS table for any user. <CLICK> Again, note that you can drag in the SYS_REQUESTS table and the fully-qualified name will appear.

Compose the Script Our IF statement continues with this ELSEIF clause. The user’s name is NOT Admin, so we make sure that the requested information is for the actual caller… <CLICK> … and filter the SYS_REQUESTS rows appropriately.

Compose the Script Our IF statement concludes with an ELSE clause. If a user other than Admin requests someone else’s data, we format a message and raise an exception. <CLICK> Finally, here is the exception-handler block. This block calls two other useful procedures that are delivered with CIS. <CLICK> The Print procedure writes to the console. <CLICK> The Log procedure writes an informational message to the CIS Server Log file.

Test the Script Now we’re ready to test the script. Log in to Studio as the Admin user. This is the user who can access the data for any user. <CLICK> Open the script and click Execute on the editor toolbar. <CLICK> Enter Admin as the input parameter and click OK. <CLICK> The script returns Admin’s own requests.

Test the Script Now run the script again, and change the parameter to a different user. <CLICK> Because the actual user is admin, the script will return data for any specified user.

Test the Script Now log in as a different user. <CLICK> Run the procedure and ask for data matching your current user name. <CLICK> Since the names match, the data is returned.

Test the Script Now run the script again, and ask for data that does NOT match your user name. Since you are not Admin, this is not permitted. <CLICK> No data is returned. <CLICK> The Console tab shows the expected error message. <CLICK> Check the end of the cs_server.log file in the logs directory of the CIS Installation Folder. Our Exception block has logged the issue correctly. We have used procedural logic to return a SQL cursor based on an input parameter, and used several library functions to perform security checking and logging. Our demo is complete.

Agenda What is it and why does it matter? How-to Summary Let’s summarize what we have seen in this tutorial.

Summary: Definition SQL Script ANSI-SQL-compliant Scripting Language Enables procedural logic, including Conditional execution Looping Pipelining Exception handling Etc. SQL Script is CIS’s ANSI-SQL-compliant scripting language. It enables procedural logic for data integration, including conditional execution, looping, pipelining, exception handling, and many other features.

Summary: Benefits SQL Script Procedural logic Parameter-driven processing Calls to system procedures and custom procedures Exception handling and logging SQL Script is important in an enormous range of Data Virtualization use cases. It enables users to write procedural logic for scenarios that are difficult to handle in declarative SQL. It enables parameter-driven processing. SQL Script procedures can make calls to other procedures, including system utility procedures and custom procedures written in Java. SQL Script enables exception handling and logging, which can be important in many Data Virtualization projects.

Summary: Key Take-aways SQL Script Scripts can call other resources, including: Other Scripts Java Procedures Packaged Queries CIS Procedure Library As you work with SQL Script in CIS, keep these key take-aways in mind. You can use scripts to build very sophisticated applications, since scripts can be used to call many other CIS resources, including other scripts, Java procedures, Packaged Queries, and the wide range of functionality available in the library of procedures delivered with CIS.

Summary: What’s next? Use your knowledge to implement procedural logic Leverage your knowledge to take advantage of the CIS Procedure Library Learn advanced SQL Script capabilities Documented in CIS Reference Manual After completing this tutorial, you are ready to begin using SQL Script in your Data Virtualization projects. Use your learning from this tutorial to implement all types of procedural logic. Leverage your knowledge to explore the capabilities available in the CIS Procedure Library. Learn advanced SQL Script features. The CIS Reference Guide is your best source for advanced SQL Script. Thank you.