Bull s Database Migration Business Unit Oracle PL/SQL to PostgreSQL PL/pgSQL Translation Technical Notes
|
|
- Sybil Parks
- 8 years ago
- Views:
Transcription
1 Oracle PL/SQL Package Translation to Postgres PL/pgSQL Oracle Package Global Associative Array (index-by binary_integer) Translation If you ve explored the Postgres PL/pgSQLdocumentation, then no doubt you ve come up with concerns regarding how to translate PL/SQL packages that contain global associative arrays into PL/pgSQL; because, there is no obvious solution. We ran into this in our first major PL/SQL translation challenge which included thousands of lines of procedure code encapsulated in a package sharing global associative arrays (Index-by tables). The following discusses our solution. It s a solution that we automated, which makes translations of these global PL/SQL arrays a breeze. First, we solved the package issue by grouping all functions and procedures of the same PL/SQL package into a schema that was named after the package per a recommendation found in the Postgres documentation ( Next, we incorporated temp tables as our mechanism for emulating global associative arrays. We found that the real challenge to this emulation was factoring in the accesses to these tables in the translation of the PL/SQL code. If one is doing a 10 line translation, no problem, as this can be easily done by hand. But when hundreds or even thousands of lines are involved, it s a daunting task that begged to be automated. To incorporate a temp table as a substitute for a global associative array, one must consider the basic operations used in conjunction with the array and define a strategy for emulation using SQL. The following table gives some insight to our approach: description PL/SQL operation emulation array instantiation instancename AssociativeArrayName; instancename RECORD; array initialization instancename.delete truncate or create temptable array population instancename(i) := arecord INSERT into temptable values ( ); array access for 1 element arecord := instancename(i); SELECT * into arecord from temptable where id = i; array iteration thru complete set for arecord IN inst.first..inst.last LOOP DECLARE CURSOR crsx as SELECT from temptable where id >= 0 for arec in crsx LOOP array update instancename(i).item := v_item; UPDATE temptable set item = v_item where id = i; array last index v_x := instancename.last; SELECT max(id) into v_x from temptable; An Example of an Oracle Package Translation involving Global Associated Arrays To best understand the translation of PL/SQL involving a global associate array to PL/pgSQL, please consider the following elementary Oracle package example. This package, named country, consists of an associative array and three procedures. The first procedure (sp_topsong09) takes as input a country music artist s first and last name. It initializes the package global array (v_s09) with a DELETE operation. It then calls function sp_getallsongs which populates the global array from a table that contains the top 25 country songs for the year This result is then globally available to function sp_findtopsong which is called to find the top song for a given artist. This is done by iterating through the global array searching for the first match for the given artist. When a match occurs, it returns, then the sp_topsong09 procedure returns to the caller the title of the artist s top song. The Oracle PL/SQL package country that we will translate which includes three procedures follows: Bull, 2012 Page 1
2 CREATE OR REPLACE PACKAGE BODY country IS TYPE r_s09 IS RECORD ( rank top2009songs.rank%type, ß 3 artist top2009songs.artist%type, title top2009songs.title%type); TYPE t_s09 IS TABLE OF r_s09 INDEX BY PLS_INTEGER; ß 6 v_s09 t_s09; ß 7 PROCEDURE sp_topsong09(p_artistfirstname IN artists.firstname%type, p_artistlastname IN artists.lastname%type, v_title OUT varchar2) IS dbms_output.put_line('topsong09.. begin'); v_s09.delete; ß 15 sp_getallsongs(); ß 16 sp_findtopsong(p_artistfirstname, ß 17 p_artistlastname, v_title); dbms_output.put_line('... top song ' v_title); dbms_output.put_line('topsong09.. end'); dbms_output.put_line('error gettopsong sqlerrm: ' sqlerrm); END sp_topsong09; PROCEDURE sp_getallsongs IS load array v_s09 from table top2009songs CURSOR c_songs is SELECT rank, artist, title FROM top2009songs ORDER BY rank; v_index PLS_INTEGER; r_song r_s09; dbms_output.put_line('getallsongs begin'); v_index := 0; FOR r_song IN c_songs LOOP dbms_output.put_line('... rank ' r_song.rank ' title ' r_song.title); v_s09(v_index) := r_song; ß 44 v_index := v_index + 1; END LOOP; dbms_output.put_line('getallsongs end'); Bull, 2012 Page 2
3 dbms_output.put_line('error getallsongs sqlerrm: ' sqlerrm); RAISE; END sp_getallsongs; PROCEDURE sp_findtopsong(p_artistfirstname IN artists.firstname%type, p_artistlastname IN artists.lastname%type, v_title OUT varchar2) IS v_artist top2009songs.artist%type; v_len PLS_INTEGER; i PLS_INTEGER; dbms_output.put_line('findtopsong begin'); v_artist := p_artistfirstname ' ' p_artistlastname; dbms_output.put_line('... searching for ' v_artist); FOR i IN v_s09.first..v_s09.last LOOP ß 65 dbms_output.put_line('... evaluate artist ' v_s09 (i).artist); IF v_s09(i).artist = v_artist THEN ß 67 v_title := v_s09(i).title; ß 68 EXIT; END IF; END LOOP; dbms_output.put_line('findtopsong end'); dbms_output.put_line('error findtopsong sqlerrm: ' sqlerrm); RAISE; END sp_findtopsong; END; The DDL and a subset of the data for the top2009songs table is: create table top2009songs( rank NUMBER(4), artist char(30), title varchar2(40) ); INSERT INTO top2009songs VALUES (1, 'Lady Antebellum', 'I Run to You'); INSERT INTO top2009songs VALUES (13, 'Taylor Swift', 'You Belong with Me'); INSERT INTO top2009songs VALUES (25, 'Keith Urban', 'Kiss a Girl'); After loading this package into Oracle we executed it as follows and searched for the top song performed by Taylor Swift: SQL> var v_title varchar2(40); SQL> exec country.sp_topsong09('taylor', 'Swift', :v_title); PL/SQL procedure successfully completed. SQL> print v_title; Bull, 2012 Page 3
4 V_TITLE - - You Belong with Me Now our goal is to translate this package into PL/pgSQL, make the same call and obtain the same result! Prerequisites to Translation Because our translation involves generating a temp table for each associative array, the translation tool must have all the information necessary to translate a record definition into a table. Also, because the package contains calls from one procedure to another, the translation tool must have access to the procedure interface definitions so it can define the call type and cast if needed (see chapter on translating PL/SQL function calls). Hence, the following is needed before doing the package translation: the Oracle procedure definitions and other global information from the package spec file. the Oracle table DDL. The user is asked to supply each file during the translation. The DDL file maybe converted to Postgres previously. If not, it will be translated to Postgres when the table definitions are inventoried. Translation Preprocessing - Global Associative Array Identification The translation tool scans first the package spec file then the package body definition prior to converting each procedure. When it finds the following: A RECORD definition (line 3). A TYPE definition referencing the RECORD as being a TABLE indexed by an integer (line 6). The declaration of a global instance of the indexed TABLE of RECORDs (in this case v_s09 in line 7). it recognizes that it is processing a global associative array and generates a temp table definition from the record definition. The array s record definition is translated into a CREATE TEMP TABLE statement and encapsulated inside a function. This function is saved into the directory specified by the config option in a file named fcreate_tablename.sql (where tablename matches the TYPE name associated with the TABLE of the RECORD specified in line 6 of the package code). The function for creating this particular temp table, as generated by the translation tool follows: CREATE or REPLACE FUNCTION global_util.gen_t_s09() RETURNS void AS $$ Create temp table for global storage of the result set (v_s09). This emulates an Oracle associative array. TRUNCATE TABLE t_s09; when UNDEFINED_TABLE then CREATE TEMP TABLE t_s09( id int NOT NULL UNIQUE, Bull, 2012 Page 4
5 ß 15 rank integer, artist char(30), title varchar(40)); when others then RAISE 'gen_t_s09 create table t_s09 issue NUM:%, DE- TAILS:%', SQLSTATE, SQLERRM; END; when OTHERS then RAISE 'gen_t_s09 truncate table t_s09 issue NUM:%, DE- TAILS:%', SQLSTATE, SQLERRM; END; END; gen_t_s09 $$ LANGUAGE plpgsql; Please observe that the table is truncated before its created. This combination exists because the table will persist once created for the life of the connection. Therefore, if the connection is maintained for an extended period of time then it can be expected that if the table is frequently used the truncate will be the more common operation of the two. The code is written such that should the table not exist, then the exception that will result from the truncation will drop into the create table statement. This combination of truncate / exception / create exhibited good performance when compared against alternatives investigated such as determining the table s existence using SQL. One should also notice that in line 15 of the gen_t_s09 function that the id field is defined as NOT NULL UNIQUE. This will result in the generation of a unique index that will be of value when specific entries, indexed by the id field, are accessed by the translated function code. Analysis of sp_topsong09 The code generated by our translator for the first of the three procedures, sp_topsong09 follows: CREATE or REPLACE FUNCTION country.sp_topsong09 ( p_artistfirstname IN ARTISTS.FIRSTNAME%TYPE, p_artistlastname IN ARTISTS.LASTNAME%TYPE, v_title OUT varchar) RETURNS varchar AS $body$ DECLARE RAISE NOTICE 'topsong09.. begin'; perform global_util.gen_t_s09(); truncate or create temp table ß 8 PERFORM country.sp_getallsongs(); ß 9 SELECT * FROM country.sp_findtopsong ( ß 10 p_artistfirstname, p_artistlastname) INTO v_title; RAISE NOTICE '... top song %', v_title; RAISE NOTICE 'topsong09.. end'; RAISE NOTICE 'ERROR gettopsong sqlerrm: %', sqlerrm; Bull, 2012 Page 5
6 END; sp_topsong09 $body$ LANGUAGE plpgsql; Line 15 of the country package listing equates to line 8 in sp_topsong09. Here one can note that the v_s09.delete statement in the package source has been translated to the call (perform) of gen_t_s09 (line 8 of this function). This call is to the auto generated function gen_t_s09 which results in the truncation or creation the temp table used to emulate the global associative array.. Lines 9 and 10 of sp_topsong09 function illustrate further our strategy for procedure call translation that will be discussed in detail in another chapter. The brief explanation of the generated code for the calls is as follows. The procedure sp_getallsongs does not return any parameters, hence it was translated to a PERFORM call. The procedure sp_findtopsong does return a parameter, so it was translated into a SELECT INTO invocation. Analysis of sp_getallsongs The PL/pgSQLcode generated for the procedure, sp_getallsongs follows: CREATE or REPLACE FUNCTION country.sp_getallsongs() RETURNS VOID AS $body$ load array v_s09 from table top2009songs DECLARE c_songs CURSOR is SELECT rank, artist, title FROM top2009songs ORDER BY rank; v_index integer; r_song RECORD; ß 11 v_s09 RECORD; global record emulation ß 12 RAISE NOTICE 'getallsongs begin'; v_index := 0; FOR r_song IN c_songs LOOP RAISE NOTICE '... rank % title %', r_song.rank, r_song.title; v_s09(v_index) := r_song; ß 19 v_s09 := r_song; set local instance ß 20 INSERT INTO t_s09 ( ß 21 id, rank, artist, title) VALUES ( v_index, r_song.rank, r_song.artist, r_song.title); ß 30 v_index := v_index + 1; END LOOP; Bull, 2012 Page 6
7 RAISE NOTICE 'getallsongs end'; RAISE NOTICE 'ERROR getallsongs sqlerrm: %', sqlerrm; RAISE; END sp_getallsongs; END; $body$ LANGUAGE plpgsql; Line 44 of the PL/SQL country package represents the instruction which inserts rows into the global associative array v_s09. Our emulation is seen in lines 20 through 30. Here we have translated the operation v_s09 (v_index) := r_song into an insert of the current record from the cursor c_songs. The local instance, v_s09 is set because frequently this record is processed code within the LOOP. In this case its unused so it could be deleted by the developer inspecting the translation result. Line 12 of the sp_getallsongs function listing was inserted by the translator to be the local instance of the record v_s09. It, like line 11 are defined as RECORDs because, unlike with Oracle, there is no formal definition of a record. With Postgres, its just a placeholder until its populated, at which time it takes on the definition of the object its populated from. The output of this function is a fully populated global temp table. The displays generated when run from Postgres are identical to the Oracle counterpart: NOTICE: getallsongs begin NOTICE:... rank 1 title I Run to You NOTICE:... rank 2 title Whatever it Is NOTICE:... rank 3 title Boots On NOTICE:... rank 4 title It Wont Be Like This for Long NOTICE:... rank 5 title River of Love NOTICE:... rank 6 title Sideways NOTICE:... rank 7 title People are Crazy NOTICE:... rank 8 title Alright NOTICE:... rank 9 title Sweet Thing NOTICE:... rank 10 title Big Green Tractor NOTICE:... rank 11 title Small Town USA NOTICE:... rank 12 title Gettin You Home NOTICE:... rank 13 title You Belong with Me NOTICE:... rank 14 title She s Country NOTICE:... rank 15 title Then NOTICE:... rank 16 title Cowgirls Dont Cry NOTICE:... rank 17 title Its America NOTICE:... rank 18 title God Love Her NOTICE:... rank 19 title Only You Can Love Me This Way NOTICE:... rank 20 title Summer Nights NOTICE:... rank 21 title Living for the Night NOTICE:... rank 22 title American Ride NOTICE:... rank 23 title I ll Just Hold on NOTICE:... rank 24 title Welcome to the Future NOTICE:... rank 25 title Kiss a Girl NOTICE: getallsongs end Analysis of sp_findtopsong The PL/SQL procedure, sp_findtopsong iterates through the global associative array until the first song for the Bull, 2012 Page 7
8 given artist is found. The translated PL/pgSQLcode that iterates through the temp table instead follows: CREATE or REPLACE FUNCTION country.sp_findtopsong ( p_artistfirstname IN ARTISTS.FIRSTNAME%TYPE, p_artistlastname IN ARTISTS.LASTNAME%TYPE, v_title OUT varchar ) RETURNS varchar AS $body$ DECLARE v_artist TOP2009SONGS.ARTIST%TYPE; v_len integer; i integer; c_gt_v_s09 CURSOR FOR SELECT * FROM t_s09 where id >= 0 order by id; ß 10 v_s09 RECORD; in memory table emulation intermediate result ß 11 RAISE NOTICE 'findtopsong begin'; v_artist := p_artistfirstname ' ' p_artistlastname; RAISE NOTICE '... searching for %', v_artist; FOR v_s09 IN c_gt_v_s09 LOOP ß 16 i := v_s09.id; ß 17 RAISE NOTICE '... evaluate artist %', v_s09.artist; IF v_s09.artist = v_artist THEN ß 19 v_title := v_s09.title; ß 20 EXIT; END IF; END LOOP; RAISE NOTICE 'findtopsong end'; RAISE NOTICE 'ERROR findtopsong sqlerrm: %', sqlerrm; RAISE; END; sp_findtopsong $body$ LANGUAGE plpgsql; Line 65 in the PL/SQL package code controls the iteration through the indexed associative array. This was translated by convoracleplsql into lines 10, 11, 16 and 17 in the sp_findtopsong listing. These lines replace the Oracle FOR that iterated from the first to the last entry in the indexed array with the cursor c_gt_v_s09 (line 10) that scans the temp table s id field to obtain all values from the lowest (first) to the last. The current row of the cursor is kept in a local record, v_s09. From this local position, it can be evaluated. In this example program, the current row is just tested, not modified. If it had been updated in any manner, then the translator would have generated an update SQL statement of the temp table t_s09 which would be indexed by i, or the current record s id field. Test Results After loading the 3 translated functions plus the supplemental temp table generation function into a postgres database one can find the top song for Taylor Swift in the year 2009 simply by doing the following: psql=> select * from country.sp_topsong09('taylor', 'Swift'); NOTICE: topsong09.. begin Bull, 2012 Page 8
9 NOTICE: sequence "t_s09_seq" does not exist, skipping NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_s09_id_key" for "t_s09" NOTICE: getallsongs begin NOTICE:... rank 1 title I Run to You NOTICE:... rank 2 title Whatever it Is NOTICE:... rank 3 title Boots On NOTICE:... rank 4 title It Wont Be Like This for Long NOTICE:... rank 5 title River of Love NOTICE:... rank 6 title Sideways NOTICE:... rank 7 title People are Crazy NOTICE:... rank 8 title Alright NOTICE:... rank 9 title Sweet Thing NOTICE:... rank 10 title Big Green Tractor NOTICE:... rank 11 title Small Town USA NOTICE:... rank 12 title Gettin You Home NOTICE:... rank 13 title You Belong with Me NOTICE:... rank 14 title Shes Country NOTICE:... rank 15 title Then NOTICE:... rank 16 title Cowgirls Dont Cry NOTICE:... rank 17 title Its America NOTICE:... rank 18 title God Love Her NOTICE:... rank 19 title Only You Can Love Me This Way NOTICE:... rank 20 title Summer Nights NOTICE:... rank 21 title Living for the Night NOTICE:... rank 22 title American Ride NOTICE:... rank 23 title Ill Just Hold on NOTICE:... rank 24 title Welcome to the Future NOTICE:... rank 25 title Kiss a Girl NOTICE: getallsongs end NOTICE: findtopsong begin NOTICE:... searching for Taylor Swift NOTICE:... evaluate artist Lady Antebellum NOTICE:... evaluate artist Zac Brown NOTICE:... evaluate artist Randy Houser NOTICE:... evaluate artist Darius Rucker NOTICE:... evaluate artist George Strait NOTICE:... evaluate artist Dierks Bentley NOTICE:... evaluate artist Billy Currington NOTICE:... evaluate artist Darius Rucker NOTICE:... evaluate artist Keith Urban NOTICE:... evaluate artist Jason Aldean NOTICE:... evaluate artist Justin Moore NOTICE:... evaluate artist Chris Young NOTICE:... evaluate artist Taylor Swift NOTICE: findtopsong end NOTICE:... top song You Belong with Me NOTICE: topsong09.. end v_title You Belong with Me Summary This chapter gives just a simple, hopefully clear, example of our translation capability. Given that we found temp Bull, 2012 Page 9
10 table access to provide good performance, we believe that we have an excellent approach and toolset developed for solving one of the most daunting challenges surrounding Oracle package migration to Postgres. Bull, 2012 Page 10
Programming Database lectures for mathema
Programming Database lectures for mathematics students April 25, 2015 Functions Functions are defined in Postgres with CREATE FUNCTION name(parameter type,...) RETURNS result-type AS $$ function-body $$
More informationDatabase Programming with PL/SQL: Learning Objectives
Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs
More informationOracle For Beginners Page : 1
Oracle For Beginners Page : 1 Chapter 17 EXCEPTION HANDLING What is an? How to handle s? Predefined s When NO_DATA_FOUND is not raised? User-defined Reraising an Associating an With An Oracle Error Exception
More informationOracle For Beginners Page : 1
Oracle For Beginners Page : 1 Chapter 24 NATIVE DYNAMIC SQL What is dynamic SQL? Why do we need dynamic SQL? An Example of Dynamic SQL Execute Immediate Statement Using Placeholders Execute a Query Dynamically
More informationDuration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts
D80186GC10 Oracle Database: Program with Summary Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts Level Professional Technology Oracle
More informationSubgrid Load Balancing for Utility Computing
By Todd Morley Editor s Note: Grid computing, what s all the buzz? We asked Todd Morley to give us his view on demystifying the process for load balancing across subgrids. The result is an informative
More informationCSC 443 Database Management Systems. The SQL Programming Language
CSC 443 Database Management Systems Lecture 11 SQL Procedures and Triggers The SQL Programming Language By embedding SQL in programs written in other high-level programming languages, we produce impedance
More informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
More informationOracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
More informationWhen an exception occur a message which explains its cause is received. PL/SQL Exception message consists of three parts.
ERROR HANDLING IN PLSQL When an SQL statement fails, the Oracle engine recognizes this as an Exception Condition. What is Exception Handling? PLSQL provides a feature to handle the Exceptions which occur
More informationPL/SQL Overview. Basic Structure and Syntax of PL/SQL
PL/SQL Overview PL/SQL is Procedural Language extension to SQL. It is loosely based on Ada (a variant of Pascal developed for the US Dept of Defense). PL/SQL was first released in ١٩٩٢ as an optional extension
More informationHandling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1
Handling Exceptions Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Objectives After completing this lesson, you should be able to do the following: Define PL/SQL
More informationHandling Exceptions. Copyright 2008, Oracle. All rights reserved.
Handling Exceptions Handling Exceptions What Will I Learn? In this lesson, you will learn to: Describe several advantages of including exception handling code in PL/SQL Describe the purpose of an EXCEPTION
More informationSQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema:
CS145 Lecture Notes #10 SQL Programming Example schema: CREATE TABLE Student (SID INTEGER PRIMARY KEY, name CHAR(30), age INTEGER, GPA FLOAT); CREATE TABLE Take (SID INTEGER, CID CHAR(10), PRIMARY KEY(SID,
More informationOracle 10g PL/SQL Training
Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural
More informationTopics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia
Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia 1. SQL Review Single Row Functions Character Functions Date Functions Numeric Function Conversion Functions General Functions
More informationCS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University
CS 377 Database Systems SQL Programming Li Xiong Department of Mathematics and Computer Science Emory University 1 A SQL Query Joke A SQL query walks into a bar and sees two tables. He walks up to them
More informationAn Introduction to PL/SQL. Mehdi Azarmi
1 An Introduction to PL/SQL Mehdi Azarmi 2 Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database language. Combines power and flexibility of SQL (4GL)
More informationHandling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total
Handling Exceptions Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you should be able to do the following: Define PL/SQL exceptions
More informationDarshan Institute of Engineering & Technology PL_SQL
Explain the advantages of PL/SQL. Advantages of PL/SQL Block structure: PL/SQL consist of block of code, which can be nested within each other. Each block forms a unit of a task or a logical module. PL/SQL
More informationOracle 11g PL/SQL training
Oracle 11g PL/SQL training Course Highlights This course introduces students to PL/SQL and helps them understand the benefits of this powerful programming language. Students learn to create PL/SQL blocks
More informationHandling Exceptions. Schedule: Timing Topic. 45 minutes Lecture 20 minutes Practice 65 minutes Total
23 Handling Exceptions Copyright Oracle Corporation, 1999. All rights reserved. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you
More informationOracle Database: Develop PL/SQL Program Units
Oracle University Contact Us: 1.800.529.0165 Oracle Database: Develop PL/SQL Program Units Duration: 3 Days What you will learn This Oracle Database: Develop PL/SQL Program Units course is designed for
More informationOracle Database 12c Enables Quad Graphics to Quickly Migrate from Sybase to Oracle Exadata
Oracle Database 12c Enables Quad Graphics to Quickly Migrate from Sybase to Oracle Exadata Presented with Prakash Nauduri Technical Director Platform Migrations Group, Database Product Management Sep 30,
More informationSQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.
SQL Databases Course by Applied Technology Research Center. 23 September 2015 This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases. Oracle Topics This Oracle Database: SQL
More informationProgramming in postgresql with PL/pgSQL. Procedural Language extension to postgresql
Programming in postgresql with PL/pgSQL Procedural Language extension to postgresql 1 Why a Programming Language? Some calculations cannot be made within a query (examples?) Two options: Write a program
More informationTriggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation.
Triggers & Packages An SQL trigger is a mechanism that automatically executes a specified PL/SQL block (referred to as the triggered action) when a triggering event occurs on the table. The triggering
More informationOracle Database 10g: Program with PL/SQL
Oracle University Contact Us: Local: 1800 425 8877 Intl: +91 80 4108 4700 Oracle Database 10g: Program with PL/SQL Duration: 5 Days What you will learn This course introduces students to PL/SQL and helps
More informationOracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
More informationOracle PL/SQL Injection
Oracle PL/SQL Injection David Litchfield What is PL/SQL? Procedural Language / Structured Query Language Oracle s extension to standard SQL Programmable like T-SQL in the Microsoft world. Used to create
More informationOracle to MySQL Migration
to Migration Stored Procedures, Packages, Triggers, Scripts and Applications White Paper March 2009, Ispirer Systems Ltd. Copyright 1999-2012. Ispirer Systems Ltd. All Rights Reserved. 1 Introduction The
More informationIntroduction to PL/SQL Programming
Introduction to PL/SQL Programming Introduction to PL/SQL Programming i-ii Introduction to PL/SQL Programming 1997-2001 Technology Framers, LLC Introduction to PL/SQL Programming This publication is protected
More informationContinuous Integration Part 2
1 Continuous Integration Part 2 This blog post is a follow up to my blog post Continuous Integration (CI), in which I described how to execute test cases in Code Tester (CT) in a CI environment. What I
More information1 Stored Procedures in PL/SQL 2 PL/SQL. 2.1 Variables. 2.2 PL/SQL Program Blocks
1 Stored Procedures in PL/SQL Many modern databases support a more procedural approach to databases they allow you to write procedural code to work with data. Usually, it takes the form of SQL interweaved
More informationPage 1 of 7 Welcome brendan ( Account Help Sign Out ) United States Communities I am a... I want to... Secure Search Products and Services Solutions Downloads Store Support Training Partners About Oracle
More informationDECLARATION SECTION. BODY STATEMENTS... Required
1 EXCEPTION DECLARATION SECTION Optional BODY STATEMENTS... Required STATEMENTS Optional The above Construction is called PL/SQL BLOCK DATATYPES 2 Binary Integer (-2 **31-1,2**31+1) signed integer fastest
More informationPL/SQL. Database Procedural Programming PL/SQL and Embedded SQL. Procedures and Functions
PL/SQL Procedural Programming PL/SQL and Embedded SQL CS2312 PL/SQL is Oracle's procedural language extension to SQL PL/SQL combines SQL with the procedural functionality of a structured programming language,
More informationCourse Objectives. Database Applications. External applications. Course Objectives Interfacing. Mixing two worlds. Two approaches
Course Objectives Database Applications Design Construction SQL/PSM Embedded SQL JDBC Applications Usage Course Objectives Interfacing When the course is through, you should Know how to connect to and
More informationAnswers to the Try It Yourself Sections
APPENDIX D Answers to the Try It Yourself Sections Chapter 1, PL/SQL Concepts 1) To calculate the area of a circle, you must square the circle s radius and then multiply it by π. Write a program that calculates
More informationIn This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina
This Lecture Database Systems Lecture 5 Natasha Alechina The language, the relational model, and E/R diagrams CREATE TABLE Columns Primary Keys Foreign Keys For more information Connolly and Begg chapter
More informationPL/SQL (Cont d) Let s start with the mail_order database, shown here:
PL/SQL (Cont d) Let s start with the mail_order database, shown here: 1 Table schemas for the Mail Order database: 2 The values inserted into zipcodes table: The values inserted into employees table: 3
More informationOracle(PL/SQL) Training
Oracle(PL/SQL) Training 30 Days Course Description: This course is designed for people who have worked with other relational databases and have knowledge of SQL, another course, called Introduction to
More informationWriting Control Structures
Writing Control Structures Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 5-1 Objectives After completing this lesson, you should be able to do the following: Identify
More informationOracle PL/SQL Language. CIS 331: Introduction to Database Systems
Oracle PL/SQL Language CIS 331: Introduction to Database Systems Topics: Structure of a PL/SQL program Exceptions 3-valued logic Loops (unconditional, while, for) Cursors Procedures Functions Triggers
More informationCOMS20700 DATABASES 13 PL/SQL. COMS20700 Databases Dr. Essam Ghadafi
13 PL/SQL COMS20700 Databases Dr. Essam Ghadafi PL/SQL - OVERVIEW PL/SQL: Procedure Language/Structured Query Language. Provides programming languages features: IF, Loops, subroutines,... Code can be compiled
More informationSTUDY OF PL/SQL BLOCK AIM: To Study about PL/SQL block.
Ex.No.6 STUDY OF PL/SQL BLOCK AIM: To Study about PL/SQL block. DESCRIPTION: PL/SQL PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural features
More informationANDROID APPS DEVELOPMENT FOR MOBILE GAME
ANDROID APPS DEVELOPMENT FOR MOBILE GAME Lecture 7: Data Storage and Web Services Overview Android provides several options for you to save persistent application data. Storage Option Shared Preferences
More informationMaking the Most of Oracle PL/SQL Error Management Features
Making the Most of Oracle PL/SQL Error Management Features Copyright 2000-2008 Steven Feuerstein - Page 1 Steven Feuerstein PL/SQL Evangelist Quest Software steven.feuerstein@quest.com So...why listen
More informationORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT
ORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT INTRODUCTION: Course Objectives I-2 About PL/SQL I-3 PL/SQL Environment I-4 Benefits of PL/SQL I-5 Benefits of Subprograms I-10 Invoking Stored Procedures
More informationOracle PL/SQL Best Practices
Achieving PL/SQL Excellence Oracle PL/SQL Best Practices Steven Feuerstein Me - www.stevenfeuerstein.com PL/Solutions - www.plsolutions.com RevealNet - www.revealnet.com 7/5/99 Copyright 1999 Steven Feuerstein
More informationLab 2: PostgreSQL Tutorial II: Command Line
Lab 2: PostgreSQL Tutorial II: Command Line In the lab 1, we learned how to use PostgreSQL through the graphic interface, pgadmin. However, PostgreSQL may not be used through a graphical interface. This
More informationDatabase Programming. Week 10-2. *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford
Database Programming Week 10-2 *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford SQL in Real Programs We have seen only how SQL is used at the generic query
More informationDatabase programming 20/08/2015. DBprog news. Outline. Motivation for DB programming. Using SQL queries in a program. Using SQL queries in a program
DBprog news Database programming http://eric.univ-lyon2.fr/~jdarmont/?page_id=451 M1 Informatique Year 2015-2016 Jérôme Darmont http://eric.univ-lyon2.fr/~jdarmont/ http://eric.univ-lyon2.fr/~jdarmont/?feed=rss2
More informationSQL/PSM. Outline. Database Application Development Oracle PL/SQL. Why Stored Procedures? Stored Procedures PL/SQL. Embedded SQL Dynamic SQL
Outline Embedded SQL Dynamic SQL Many host languages: C, Cobol, Pascal, etc. JDBC (API) SQLJ (Embedded) Java Database Application Development Oracle PL/SQL Stored procedures CS430/630 Lecture 15 Slides
More informationRaima Database Manager Version 14.0 In-memory Database Engine
+ Raima Database Manager Version 14.0 In-memory Database Engine By Jeffrey R. Parsons, Senior Engineer January 2016 Abstract Raima Database Manager (RDM) v14.0 contains an all new data storage engine optimized
More informationOPP 2007. ODTUG Kaleidoscope. An ODTUG SP* Oracle PL/SQL Programming Conference. WOW-Wide Open World, Wide Open Web!
OPP 2007 February 28 March 1, 2007 San Mateo Marriott San Mateo, California An ODTUG SP* Oracle PL/SQL Programming Conference *SP Seriously Practical Conference ODTUG Kaleidoscope June 18 21, 2007 Pre-conference
More informationEmbedded SQL programming
Embedded SQL programming http://www-136.ibm.com/developerworks/db2 Table of contents If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Before
More informationReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 6 1. The following code does not violate any constraints and will
More informationHandling PL/SQL Errors
Handling PL/SQL Errors In PL/SQL, a warning or error condition is called an exception. Exceptions can be internally defined (by the run-time system) or user defined. Examples of internally defined exceptions
More informationOracle Database 10g: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.
More informationDuration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
More informationDatabase Extensions Visual Walkthrough. PowerSchool Student Information System
PowerSchool Student Information System Released October 7, 2013 Document Owner: Documentation Services This edition applies to Release 7.9.x of the PowerSchool software and to all subsequent releases and
More informationCreating PL/SQL Blocks. Copyright 2007, Oracle. All rights reserved.
What Will I Learn? In this lesson, you will learn to: Describe the structure of a PL/SQL block Identify the different types of PL/SQL blocks Identify PL/SQL programming environments Create and execute
More informationWhat is Big Data? Mark Whitehorn, Co-Founder, Penguinsoft Consulting Ltd. Global Sponsor:
What is Big Data? Mark Whitehorn, Co-Founder, Penguinsoft Consulting Ltd. Global Sponsor: It s all about me Prof Mark Whitehorn Chair of Analytics School of Computing University of Dundee Scotland Consultant
More information2. Which of the following declarations is invalid? Mark for Review (1) Points
Mid Term Exam Semester 1 - Part 1 1. 1. Null 2. False 3. True 4. 0 Which of the above can be assigned to a Boolean variable? 2 and 3 2, 3 and 4 1, 2 and 3 (*) 1, 2, 3 and 4 2. Which of the following declarations
More information1 Triggers. 2 PL/SQL Triggers
1 Triggers Triggers are simply stored procedures that are ran automatically by the database whenever some event (usually a table update) happens. We won t spend a great deal of time talking about how to
More informationA basic create statement for a simple student table would look like the following.
Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));
More informationPostgres Plus xdb Replication Server with Multi-Master User s Guide
Postgres Plus xdb Replication Server with Multi-Master User s Guide Postgres Plus xdb Replication Server with Multi-Master build 57 August 22, 2012 , Version 5.0 by EnterpriseDB Corporation Copyright 2012
More informationPersistent Stored Modules (Stored Procedures) : PSM
Persistent Stored Modules (Stored Procedures) : PSM Stored Procedures What is stored procedure? SQL allows you to define procedures and functions and store them in the database server Executed by the database
More informationReal SQL Programming. Persistent Stored Modules (PSM) PL/SQL Embedded SQL
Real SQL Programming Persistent Stored Modules (PSM) PL/SQL Embedded SQL 1 SQL in Real Programs We have seen only how SQL is used at the generic query interface --- an environment where we sit at a terminal
More informationLinas Virbalas Continuent, Inc.
Linas Virbalas Continuent, Inc. Heterogeneous Replication Replication between different types of DBMS / Introductions / What is Tungsten (the whole stack)? / A Word About MySQL Replication / Tungsten Replicator:
More informationMoving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
More informationOracle SQL, introduced in the previous chapter, is not a language that can be
CHAPTER 3 Embedded SQL Oracle SQL, introduced in the previous chapter, is not a language that can be used to build sophisticated database applications, but it is a very good language for defining the structure
More informationOracle Database: Program with PL/SQL
Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn This Oracle Database: Program with PL/SQL training starts with an introduction to PL/SQL and then explores the benefits of this
More informationC H A P T E R Condition Handling
ch05.fm Page 75 Wednesday, November 13, 2002 7:16 AM 5 C H A P T E R Condition Handling In this chapter, you will learn: what SQLCODE and SQLSTATE are, and the difference between them. what a condition
More informationMyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC
MyOra 3.0 SQL Tool for Oracle User Guide Jayam Systems, LLC Contents Features... 4 Connecting to the Database... 5 Login... 5 Login History... 6 Connection Indicator... 6 Closing the Connection... 7 SQL
More informationReal SQL Programming 1
Real 1 We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional programs
More information14 Triggers / Embedded SQL
14 Triggers / Embedded SQL COMS20700 Databases Dr. Essam Ghadafi TRIGGERS A trigger is a procedure that is executed automatically whenever a specific event occurs. You can use triggers to enforce constraints
More informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals
More informationExtracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA)
13 November 2007 22:30 Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA) By: http://www.alberton.info/firebird_sql_meta_info.html The SQL 2003 Standard introduced a new schema
More informationIBM Redistribute Big SQL v4.x Storage Paths IBM. Redistribute Big SQL v4.x Storage Paths
Redistribute Big SQL v4.x Storage Paths THE GOAL The Big SQL temporary tablespace is used during high volume queries to spill sorts or intermediate data to disk. To improve I/O performance for these queries,
More informationOracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
More informationSQL. Short introduction
SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.
More informationMultimedia im Netz Online Multimedia Winter semester 2015/16
Multimedia im Netz Online Multimedia Winter semester 2015/16 Tutorial 04 Minor Subject Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 04 (NF) - 1 Today s Agenda Repetition:
More information1 File Processing Systems
COMP 378 Database Systems Notes for Chapter 1 of Database System Concepts Introduction A database management system (DBMS) is a collection of data and an integrated set of programs that access that data.
More informationWhy programming extensions? to program complex update transactions. where referential integrity is not addressed by data definition
PL/SQL Why programming extensions? to program complex update transactions where referential integrity is not addressed by data definition enforcing particular integrity constraints, imposed by the nature
More informationSQL Data Definition. Database Systems Lecture 5 Natasha Alechina
Database Systems Lecture 5 Natasha Alechina In This Lecture SQL The SQL language SQL, the relational model, and E/R diagrams CREATE TABLE Columns Primary Keys Foreign Keys For more information Connolly
More informationPL/SQL Practicum #2: Assertions, Exceptions and Module Stability
PL/SQL Practicum #2: Assertions, Exceptions and Module Stability John Beresniewicz Technology Manager Precise Software Solutions Agenda Design by Contract Assertions Exceptions Modular Code DESIGN BY CONTRACT
More informationRECURSIVE COMMON TABLE EXPRESSIONS DATABASE IN ORACLE. Iggy Fernandez, Database Specialists INTRODUCTION
RECURSIVE COMMON TABLE EXPRESSIONS IN ORACLE DATABASE 11G RELEASE 2 Iggy Fernandez, Database Specialists INTRODUCTION Oracle was late to the table with recursive common table expressions which have been
More informationError Management in Oracle PL/SQL
Fast Track PL/SQL Error Management in Oracle PL/SQL Steven Feuerstein PL/SQL Evangelist, Quest Software steven.feuerstein@quest.com PL/SQL Obsession - www.toadworld.com/sf Copyright 2000-2008 Steven Feuerstein
More informationOptimizing with Open Source Technology Postgres
Optimizing with Open Source Technology Postgres Mark Jones Mark.Jones@enterprisedb.com Sales Engineering, EMEA 2013 EDB All rights reserved 8.1. 1 Providing enterprises with the cost-performance benefits
More informationProcedural Extension to SQL using Triggers. SS Chung
Procedural Extension to SQL using Triggers SS Chung 1 Content 1 Limitations of Relational Data Model for performing Information Processing 2 Database Triggers in SQL 3 Using Database Triggers for Information
More informationSharding with postgres_fdw
Sharding with postgres_fdw Postgres Open 2013 Chicago Stephen Frost sfrost@snowman.net Resonate, Inc. Digital Media PostgreSQL Hadoop techjobs@resonateinsights.com http://www.resonateinsights.com Stephen
More informationSQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach
TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded
More informationAP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
More informationSiemens Teamcenter Oracle -to-sql Server 2008 Migration Guide
Siemens Teamcenter Oracle -to-sql Server 2008 Migration Guide Microsoft Corporation Published: June 2010 Author: Randy Dyess Solid Quality Mentors Technical Reviewers: Christopher Gill Teamcenter Centers
More informationtypes, but key declarations and constraints Similar CREATE X commands for other schema ëdrop X name" deletes the created element of beer VARCHARè20è,
Dening a Database Schema CREATE TABLE name èlist of elementsè. Principal elements are attributes and their types, but key declarations and constraints also appear. Similar CREATE X commands for other schema
More informationPL/SQL Programming Concepts: Review. Copyright 2004, Oracle. All rights reserved.
PL/SQL Programming Concepts: Review Copyright 2004, Oracle. All rights reserved. PL/SQL-2 SQL PL/SQL PL/SQL Run-Time Architecture PL/SQL block procedural Procedural statement executor PL/SQL Engine Oracle
More informationPorting from Oracle to PostgreSQL
by Paulo Merson February/2002 Porting from Oracle to If you are starting to use or you will migrate from Oracle database server, I hope this document helps. If you have Java applications and use JDBC,
More information