Oracle10g PL/SQL Programming V1.0

Size: px
Start display at page:

Download "Oracle10g PL/SQL Programming V1.0"

Transcription

1 Oracle10g PL/SQL Programming V1.0

2 Oracle10g PL/SQL Programming SkillBuilders, Inc. 24 Salt Pond Road, Unit C-4 South Kingstown, RI Author: David G. Anderson Legal Notice Copyrights Copyright All rights reserved. Printed in the United States of America. No part of this publication may be reproduced, distributed or displayed in any form or by any means, or stored in a database, retrieval system or other media without the prior written permission of SkillBuilders, Inc. Trademarks The product/service names mentioned herein are manufacturer/publisher trademarks and are used only for purposes of identification. Microsoft, Microsoft Windows 95, Microsoft Windows 98, Microsoft Windows NT, and Microsoft Windows XP are registered trademarks of Microsoft Corporation. Netscape, Netscape Navigator, and the Netscape logo are registered trademarks of Netscape Communications Corporation in the United States and other countries. Oracle, Oracle8i, Oracle9i and Oracle10g are registered trademarks of Oracle Corporation. All other brand, product and service names are the trademarks of their respective companies or owners as mentioned herein. Disclaimer Information within this publication is subject to change without notice. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. The author and SkillBuilders, Inc. make no representation or warranty with respect to the contents herein and specifically disclaims any implied warranties of fitness for any particular purpose. SkillBuilders, Inc. disclaims all liability for any direct, indirect, incidental or consequential, special or exemplary damages resulting from the use of the information in this document or from the use of any products described in this document. Copyright Reproduction is strictly prohibited.

3 Oracle10g PL/SQL Programming Workshop 3 days Description This class will teach you how to write efficient and scalable PL/SQL programs to create database-intensive PL/SQL applications. You will learn the critical and fundamental aspects of PL/SQL language. Learning how to create efficient, scalable PL/SQL programs is an important objective of this course. To meet that objective, the course includes instruction on such things as the proper use of bind variables, bulk processing, pipelining, benchmarking different formulations of a routine and profiling PL/SQL programs to identify the code that should be tuned. Hands-on workshops constitute approximately 50% of the class. As with all of our courses, this class is highly customizable to your specific training requirements. Audience Prerequisites Next Courses Objectives Developers and Analysts. Database Administrators who know a programming language will also benefit. You must possess strong programming skills to benefit from this class. (We will not teach you the basics of programming such as logic flow and conditional logic. We will, however, teach you how to do it efficiently in PL/SQL.) Experience with a procedural language (e.g. Java, C or COBOL), SQL and SQL*Plus is required. Advanced PL/SQL Programming, Advanced Queries for Oracle10g Databases, Oracle10g SQL Tuning for Developers and DBA s, Oracle10g Database Administration After successfully completing this course, you will be able to: Code efficient, scalable PL/SQL programs that include common programming constructs such as data-typing, variable assignment, flow control, cursor handling, bulk processing, array processing and error handling Create PL/SQL stored procedures that accept and return values or sets of values Manage stored procedure dependencies and privileges Create PL/SQL functions, including powerful table functions and pipelined table functions Create database triggers for auditing, complex business rule support, simple replication and more Create and maintain simple Oracle packages Use the UTL_FILE package to read and write to operating system files. Use the UTL_MAIL package to send from an Oracle database Use the DBMS_PROFILER package to profile and tune PL/SQL programs Do simple benchmarking of PL/SQL code with the DBMS_UTITLITY package Copyright 2006 SkillBuilders V1.0

4 Oracle10g PL/SQL Programming Page i 1. Introduction to PL/SQL Lesson Objectives What is PL/SQL? Why Use PL/SQL? PL/SQL Program Structure Anonymous Blocks Compile Errors Output to SQL*Plus Procedures Procedure Compile Errors Functions Packages Data Dictionary Triggers Tools for Development Working in SQL*Plus Introduction to PL/SQL Workshops Language Fundamentals Lesson Objectives Statements PL/SQL Symbols Quoting Mechanism Common PL/SQL Datatypes Declaring Variables %TYPE PL/SQL Records Records: %ROWTYPE Programmer Defined Records Language Fundamentals Workshop A Variable Scope Nested Blocks Functions Regular Expressions IF Statement CASE Simple CASE Searched CASE Simple Loops Nested Loops Numeric FOR Loop PL/SQL Arrays

5 Oracle10g PL/SQL Programming Page ii Simple Array Example Array Methods Language Fundamentals Workshop B PL/SQL and SQL: Basics Lesson Objectives SELECT INTO Statement Implicit Cursor Loops Basics Workshop A (Cursor Loop) DML in PL/SQL Cursor Attributes Embedding DDL Basics Workshop B (NDS) PL/SQL and SQL: Cursors Lesson Objectives What is a Cursor? Cursor Processing Cursor Attributes Cursors Workshop A Dynamic Cursors Dynamic Cursor Example Variable Scope & Cursors Problem Example Cursor Parameters Cursor Record Cursor FOR LOOP Cursor FOR LOOP Example Cursors Optional Workshop B Referencing the Current Row FOR UPDATE Example Cursors Optional Workshop C PL/SQL and SQL: Bulk Processing Lesson Objectives Bulk Processing Bulk Collect Bulk Collect: Multiple Rows Bulk Collect: Multiple Arrays Bulk Collect: Array of Records Bulk Collect: FETCH with LIMIT Bulk Processing Workshop A...5.9

6 Oracle10g PL/SQL Programming Page iii Bulk DELETE Bulk INSERT g FORALL Improvements Returning into Arrays Summary Bulk Processing Workshop B Procedures Lesson Objectives What is a Procedure? Abbreviated Syntax Simple Example Review: Compile Errors Compiler Warnings Procedure Signatures Calling Procedures Procedure Synonyms Referencing Parameters by Name Returning Sets: REF CURSOR Dropping Procedures Dependencies ALTER COMPILE Privileges Execute Privilege The Data Dictionary Procedures Workshop Functions Lesson Objectives What is a Function? Abbreviated Syntax Simple Example Calling Functions The Data Dictionary Functions Workshop A Table Functions Building a Table Function Using a Table Function Pipelined Functions Pipelined Example Test Data Generator Functions Workshop B

7 Oracle10g PL/SQL Programming Page iv 8. Error Handling Lesson Objectives Types of Errors Runtime Errors Exception Concepts Predefined Named Exceptions Syntax Handling Exceptions Recovering from Errors Logging Exceptions Debugging with FORMAT_ERROR_BACKTRACE RAISE_APPLICATION_ERROR RAE Example Error Handling Workshop Raising Exceptions Raising User Exceptions EXCEPTION_INIT Summary Packages Lesson Objectives Concepts Package Benefits Package Benefits Diagram Package Contents Package Specification Syntax Package Specification Example Package Body Syntax Package Body Example Privileges Calling Packaged Objects Initialization Code Session Variables Package Body Variables Packages Workshop A Package Overloading Overloading Example Packages Workshop B Compiling Packages DROP Package Packages Workshop C Supplied Packages Summary

8 Oracle10g PL/SQL Programming Page v 10. Triggers Lesson Objectives Trigger Concepts Trigger Execution Create Trigger Syntax Row Trigger :OLD Reference Variable :NEW Reference Variable Trigger Attributes Audit Trigger Derived Value Trigger Restrictions Security Privileges Triggers Workshop A Table Trigger Triggers Workshop B Autonomous Transactions Autonomous Trigger Triggers Workshop C INSTEAD OF Triggers Triggers Workshop D File I/O Using UTL_FILE Lesson Objectives UTL_FILE Concepts Setup Unix File Permissions Opening Files Closing Files Reading Files Reading Files Example Writing Files Writing Files - PUT Writing Files - PUT_LINE Writing Files - NEW_LINE Writing Files - PUTF Writing Files Example UTL_FILE Workshop Using DBMS_JOB Lesson Objectives What is DBMS_JOB?

9 Oracle10g PL/SQL Programming Page vi Setup DBMS_JOB.SUBMIT SUBMIT Example Running a Job Cleaning Up Broken Jobs Removing a Job Changing Job Parameters Viewing Job Information Using DBMS_JOB Workshop Profile and Tune Lesson Objectives Introduction to Tuning PL/SQL DBMS_PROFILER Profiler Setup Using Profiler Testing Reporting Benchmarking Profile & Tune PLSQL Workshop Miscellaneous 10g Enhancements Lesson Objectives Performance: Compiler Optimization Comparison Native Compilation Review Native Compilation: New Stuff Conditional Compilation Introducing UTL_MAIL UTL_MAIL SET UP UTL_MAIL EXAMPLE Nested Table Enhancements New and Revised Packages Lesson Summary

10 Introduction to PL/SQL 1.1 Lesson 1 Introduction to PL/SQL A programmer s introduction to the what, why, when and where of PL/SQL. SKILLBUILDERS

11 Introduction to PL/SQL Lesson Objectives What is PL/SQL? What is it good for? Basic structure of a PL/SQL program Simple examples of common PL/SQL objects Anonymous block Procedure Function Package Trigger Tips for working in SQL*Plus In-depth lessons dedicated to these subjects later in this course

12 Introduction to PL/SQL 1.3 What is PL/SQL? 1.3 PL/SQL = Procedural Language extensions for SQL Proprietary language for Oracle database 3 rd generation procedural language variable definition, assignment conditional processing IF and CASE looping constructs error handling Seamless integration of SQL, SQL functions PL/SQL is a procedural language for the ORACLE database. PL/SQL stands for Procedural Language extensions to SQL. It is a proprietary language; i.e. a PL/SQL program will not run on a SQL Server database. As a 3 rd generation language, it provides many of the standard capabilities you would expect including: Variable definition and assignment Conditional processing (IF and CASE statements) Loop constructs Error handing It provides seamless integration (embedding) of SQL and SQL functions. Note that Oracle client-side products such as Oracle Forms also support PL/SQL.

13 Introduction to PL/SQL 1.4 Why Use PL/SQL?... Efficient data manipulation Good for lots of SQL, limited procedural code Tight integration with SQL Embed in PL/SQL statements Lots of work done automatically Open / close queries and cursors Compatible datatypes No conversions Not great for lots of complex procedural code However, consider Native Compilation 1.4 Because of the tight integration of SQL and PL/SQL, PL/SQL is very good at data manipulation. So if you are coding a routine that contains lots of SELECT, UPDATE, DELETE and INSERT statements, with relatively little procedural code, PL/SQL is a good choice. In this course you will see how PL/SQL does many things automatically for you; e.g. open and close cursors. Conversely, if you writing complex procedural code that will be repeatedly executed, Java or C might be a better choice. However, with the PL/SQL Native Compilation feature, PL/SQL is becoming a consideration even for computationally intensive routines.

14 Introduction to PL/SQL Why Use PL/SQL? Simple language Learn quickly Only need SQL*Plus to develop & deploy Portable within Oracle database No code change to migrate to another Oracle server Even on different platform Callable from any client Java,.NET, COBOL Anyone who can connect to DB can call 1.5 PL/SQL is relatively simple to learn and you ll only need SQL*Plus to develop, test and deploy PL/SQL programs. PL/SQL programs are portable to any Oracle database running on any platform. Rarely, if ever, will code changes be required. An exception would be if specific OS paths or commands are hard-coded within a program. PL/SQL programs are callable from any type of client. If the client can connect to the database, it can call a PL/SQL procedure or function and that procedure can return a value or result set to the caller.

15 Introduction to PL/SQL 1.6 PL/SQL Program Structure 1.6 PL/SQL is a block-structured language 3 possible blocks Only BEGIN block required Declarative Executable Error Handling DECLARE variables; constants; cursors; BEGIN BEGIN PL/SQL and and SQL SQL statements; EXCEPTION exception handlers; END; END; Terminate each statement or declaration with semi-colon PL/SQL is a block-structured language. Each PL/SQL program consists of up to 3 sections, or blocks. The declarative block contains all declarations for variables, constants and cursors. The BEGIN block contains the main body of PL/SQL and SQL statements; it is the only required section. Finally, the exception block is where all errors (exceptions in PL/SQL) can be trapped and resolved, i.e. handled. Each declaration or statement must end in a semicolon.

16 Introduction to PL/SQL 1.7 Anonymous Blocks Execute block from SQL*Plus SQL> 3 SQL> SQL> declare 2 v_custno number := := &1 &1 ; 3 begin begin 4 INSERT INTO INTO cust_history 5 SELECT * 6 FROM FROM customer 7 WHERE WHERE cust_no = v_custno; 8 end; end; 9 / old old 2: 2: v_custno number := := &1 &1 ; new new 2: 2: v_custno number := := 3 ; PL/SQL procedure successfully completed. Don t forget the slash Seamless integration of SQL Copy customer to the history table 1.7 Anonymous Blocks are called anonymous because they are not stored on the database thus they do not have a name. They are also sometimes referred to as unnamed blocks. However, as this example illustrates, they can be stored in an operating system file ( COPYCUST.SQL ) Anonymous blocks are usually executed under SQL*PLUS to: update table data produce reports build database objects Typically, the code for an anonymous block is placed in a.sql script file. Note that we follow our anonymous block with a slash (/) on a line by itself. When we run the script from SQL*Plus (with the at sign), the anonymous block is read into the SQL*Plus buffer and scanned for SQL*Plus substitution variables. The slash tells SQL*Plus to send the contents of the SQL*Plus buffer to the server for execution. Note that the SQL*Plus buffer can hold one and only one SQL command or PL/SQL block. I have used a SQL*Plus substitution variable in place of the hard coded customer number. Thus, in this case, this PL/SQL block must be executed from SQL*Plus. Only SQL*Plus understands SQL*Plus substitution variables! SQL*Plus Tips Optionally, use SET ECHO OFF to suppress the display of the anonymous block when executed from the SQL*Plus command prompt. Optionally, use SET VERIFY OFF to suppress the display of the old and new substitution messages. Supplemental Notes Note that the example shown here is for educational purposes only specifically to illustrate the block structure of a PL/SQL program. The SQL statement within the BEGIN block could more easily be executed without being coded within the confines of a PL/SQL block.

17 Introduction to PL/SQL 1.8 Compile Errors 1.8 SQL> 6 * will be INSRET INTO INTO cust_history somewhere near * clause that caused ERROR ERROR at at line line 4: error 4: ORA-06550: line line 4, 4, column 10: 10: PLS-00103: Encountered the the symbol "INTO" when when expecting one one of of the the following: := :=. % ; ORA-06550: line line 8, 8, column 1: 1: PLS-00103: Encountered the the symbol "END" "END" While the error message has identified the correct line (line 4 contains INSERT spelled incorrectly), note the misleading error message. Later we will see that compile errors in triggers, stored procedures, and stored functions are not automatically displayed by SQL*Plus. You must specifically display them yourself with the SQL*Plus SHOW ERRORS command.

18 Introduction to PL/SQL 1.9 Output to SQL*Plus Use DBMS_OUTPUT.PUT_LINE to display text on screen SQL> SQL> set set serveroutput on on SQL> SQL> begin begin 2 dbms_output.put_line('hello World') ; 3 end end ; 4 / Hello Hello World World PL/SQL procedure successfully completed. 1.9 PL/SQL may display output to SQL*Plus by using the Oracle supplied package procedure called DBMS_OUTPUT.PUT_LINE. This procedure displays text on the output device (console) in SQL*Plus. In order for the output from DBMS_OUTPUT.PUT_LINE to be seen, the SET SERVEROUTPUT on SQL*Plus command must be executed. You may want to consider putting this command in your LOGIN.SQL file as this setting reverts to the default (off) when the session ends.

19 Introduction to PL/SQL 1.10 Procedures 1.10 SQL> SQL> SQL> create procedure p1 p1 as as 2 begin begin 3 dbms_output.put_line('hello World'); 4 end; end; 5 / Procedure created. SQL> SQL> exec exec p1 p1 Hello Hello World World Call the procedure PL/SQL procedure successfully completed. with the SQL*Plus EXECUTE command Procedure is now compiled and stored in database Procedures and functions are callable subprograms which are also compiled and stored permanently in the Oracle server. (The main difference between procedures and functions is that stored functions must return a value to the caller. Otherwise, they are basically the same. You will learn much more about this later in this course.) In the example shown above, I coded a simple stored procedure in file PROCEDURE1.SQL. The procedure is created with the CREATE PROCEDURE statement (refer to the Oracle9i SQL Reference for more information on this statement; you will learn a lot more about this statement later in this course). When I run the file, it compiles and stores the stored procedure in the database. Note that the name of the procedure is p1 ; the name of the OS file that contains the source code is PROCEDURE1.SQL. I use the SQL*Plus EXECUTE command ( exec p1 ) to call the stored procedure.

20 Introduction to PL/SQL 1.11 Procedure Compile Errors Drop procedure SQL> SQL> drop drop procedure p1; p1; before trying to Procedure dropped. recreate, or use or replace on create SQL> SQL> SQL> create procedure p1 p1 as as 2 begin begin 3 dbms_output.put_line('hello World') 4 end; end; 5 / Warning: Procedure created with with compilation errors. SQL> SQL> show show errors Use the SQL*Plus Errors for for PROCEDURE P1: P1: SHOW ERRORS command LINE/COL ERROR ERROR /1 4/1 PLS-00103: Encountered the the symbol "END" "END" when when expecting 1.11 Compile errors generated by the CREATE PROCEDURE (and CREATE FUNCTION, CREATE TRIGGER) statements are not automatically displayed on the SQL*Plus screen. These errors are stored in a data dictionary view called USER_ERRORS. They can be displayed by querying this view or, as shown in this slide, by using the SQL*Plus SHOW ERRORS command. The complete text of the error message is: LINE/COL ERROR /1 PLS-00103: Encountered the symbol "END" when expecting one of the following: :=. ( % ; The symbol ";" was substituted for "END" to continue. The problem is a missing semi-colon at the end of line 3. Notes continue on the next page

21 Introduction to PL/SQL 1.12 Supplemental Notes Note that instead of using DROP PROCEDURE you can add the OR REPLACE option to the CREATE PROCEDURE command: SQL> create or replace procedure p1 as 2 begin 3 dbms_output.put_line('hello World'); 4 end; 5 / Procedure created. The DROP statement can be used to drop most Oracle procedural objects, e.g. DROP FUNCTION, DROP TRIGGER, DROP PACKAGE, DROP PACKAGE BODY etc.

22 Introduction to PL/SQL 1.13 Functions 1.13 SQL> SQL> SQL> create or or replace function f1 f1 2 return char char 3 as as 4 begin begin 5 return ('test'); 6 end; end; 7 / Function created. Must identify datatype function will return Call function from an SQL or PL/SQL statement SQL> SQL> select f1() f1() from from dual; dual; F1() F1() test test A PL/SQL function is very similar to a procedure; it is just that the function always returns a value to the caller and is invoked semantically different from the procedure. Whereas the procedure invocation is a statement in itself, the function is called within the context of another PL/SQL or SQL statement.

23 Introduction to PL/SQL 1.14 Packages Package is a group of PL/SQL objects SQL> SQL> create or or replace package p1 p1 as as 2 function f1 f1 return char; char; 3 procedure proc1; 4 end; end; SQL> 5 / SQL> create or or replace package body body p1 p1 as as 2 function f1 f1 return char char 3 Package created. as as 4 begin begin 5 return ('test'); 6 end; end; 7 8 procedure proc1 proc1 as as 9 begin begin dbms_output.put_line('hello World'); end; end; end; end; / A package is a group of PL/SQL objects often including procedures and functions. There are many benefits of packaging, which we will discuss in a subsequent lesson dedicated to packages. For now, it is just important to understand that PL/SQL objects can be packaged as opposed to standalone objects. Refer to the supplied script PACKAGE1.SQL for a working copy of the code shown here.

24 Introduction to PL/SQL Packages Qualify packaged objects with package name 1.15 SQL> SQL> select p1.f1 p1.f1 from from dual; dual; F1 F test test A packaged object is referenced by its package name, as shown above.

25 Introduction to PL/SQL 1.16 Data Dictionary Dictionary records existence of PL/SQL objects SQL> SQL> select object_name, object_type from from user_objects 2 where where object_type in in ('PROCEDURE', 'FUNCTION'); OBJECT_NAME OBJECT_TYPE F1 F1 FUNCTION P1 P1 PROCEDURE 1.16 The existence of PL/SQL objects (procedures, functions, packages, etc) is recorded in the data dictionary. USER_OBJECTS contains one row for each object.

26 Introduction to PL/SQL 1.17 Triggers Code tied to a table Executes automatically when DML executes SQL> SQL> SQL> create trigger customer_name 2 before update or or insert on on customer 3 for for each each row row 4 begin begin 5 /* /* convert character values to to upper upper case case */ */ 6 :new.lastname := := upper( :new.lastname ); ); 7 :new.firstname := := upper( :new.firstname ); ); 8 dbms_output.put_line('trigger fired'); 9 end; end; / Trigger created. Trigger tied to CUSTOMER table Use the UPPER function to convert characters inserted into the database Triggers are, usually, code associated with a table and are executed automatically when an appropriate SQL statement is issued against the table. There are also triggers which are associated with system events such as Startup and Shutdown or DDL such as CREATE and DROP statements. Other triggers can be created which are associated with user events such as Logon or Logoff. Triggers are compiled and stored permanently in the Oracle server. Triggers are often used to: Enforce complex business and/or integrity rules Audit modifications to a table Derive column values Maintain mirror tables This trigger, called customer_name, will execute whenever an INSERT or UPDATE statement is executed on the DAVE.CUSTOMER table (the schema of the compiler is used for the table, unless qualified or a synonym exists).

27 Introduction to PL/SQL Triggers 1.18 SQL> SQL> insert into into customer 2 (cust_no, firstname, lastname) 3 values 4 (3423, 'dave', 'anderson'); trigger fired fired Verification that trigger executed 1 row row created. SQL> SQL> select firstname, lastname 2 from from customer 3 where where cust_no = 3423; 3423; FIRSTNAME LASTNAME DAVE DAVE ANDERSON Characters are converted to upper case We see that the PUT_LINE procedure displayed the text trigger fired when the INSERT statement executed. This is purely diagnostics. And we see that the trigger did indeed work; the characters have been converted to upper case characters. Refer to the supplied script TRIGGER1.SQL for a copy of the code shown in this example.

28 Introduction to PL/SQL Tools for Development SQL*Plus is a common tool Included with all Oracle database products Procedure Builder Sophisticated IDE GUI tool An extra cost product Sophisticated debugging features Breakpoints stepping through code variable examination, etc. TOAD Developer and DBA tool SQL*Plus is the traditional tool for PL/SQL development as it is included with all versions of the Oracle database. You may choose to use a more robust development tool, like Procedure Builder, which provides a graphical development environment. This product has to be purchased separately but may be worth the extra cost as it provides many sophisticated debugging features and a better overall working environment for your development efforts. There are many third party tools also available such as TOAD from Quest Software. Free limited feature versions of this product are available at

29 Introduction to PL/SQL Working in SQL*Plus SET ECHO ON Show compiled source on your screen SET SERVEROUTPUT ON PUT_LINE calls will be displayed after program returns control to SQL*Plus Put in LOGIN.SQL SHOW ERRORS Error messages will refer to a line and column number Oracle Error messages manual is available to help Debugging your PL/SQL programs can be tedious if you are uncertain of where the error messages are pointing to. The simplest way to see the errors is to SET ECHO ON prior to the compile of your source. You will have the program source echoed on your screen with line numbers. If there are any error messages, it will be simple to ascertain where the error occurred. (You can also get the source line number from your USER_SOURCE library. You cannot just count lines in your original source file because the PL/SQL compiler does not count blank lines and some comment lines.) I recommend that you put the SET ECHO ON and SERT SERVEROUTPUT commands in your LOGIN.SQL file. This file, when placed in your working directory, will be automatically executed when you start SQL*Plus. Refer to the sample LOGIN.SQL file supplied with this course for and example. For anonymous blocks, the error will be displayed when you try to execute the code. For procedures, functions, packages and triggers, remember to use the SHOW ERRORS command to display the error messages.

30 Introduction to PL/SQL 1.21 Introduction to PL/SQL Workshops 1.21 Hello World Setup Workshop Hello World 1. No course is complete without the infamous Hello World! application. So let s create an anonymous PL/SQL block to print the string Hello World! to the screen. Code the PL/SQL block in a script, and test it by running the script. 2. Convert the anonymous block into a stored procedure. Compile and test the procedure. 3. Convert the stored procedure into a function. Compile and test the function. 4. Drop your standalone versions of your procedure and function. Package and test the packaged versions. Workshop Setup Run the supplied scripts DDL.SQL and INSERT.SQL to create a series of test tables that will be needed as you progress through the rest of the course.

31 Language Fundamentals 2.1 Lesson 2 Language Fundamentals A programmer s introduction to the fundamental language elements in PL/SQL. SKILLBUILDERS

32 Language Fundamentals Lesson Objectives Statements Symbols Datatypes Variable declaration and assignment Declaring PL/SQL Records Variable scope Nested Blocks IF CASE Looping constructs Introduction to Arrays To some extent, this is a reference chapter. You ll see relatively large lists of statements, datatypes and symbols. I recommend that you do not attempt to remember each one as you progress through this chapter. We ll incorporate them into examples in the remainder of the course. However, do use this lesson to acquire a solid grasp of the basic format of the IF, CASE, loop statements, and a good understanding of arrays. But here again, you ll see these statements used throughout the rest of the course.

33 Language Fundamentals PL/SQL CASE := IF LOOPs EXIT TYPE FORALL OPEN FETCH CLOSE CURSOR procedure_call; EXECUTE IMMEDIATE RETURN RAISE NULL GOTO Statements SQL SELECT INTO INSERT DELETE UPDATE LOCK TABLE MERGE CASE ROLLBACK SAVEPOINT SET TRANSACTION Pragmas AUTONOMOUS_ TRANSACTION EXCEPTION_INIT RESTRICT_ REFERENCES Mini-Workshop Shown here is a list of commonly used statements that can be used within a PL/SQL program. Refer to the Oracle9i PL/SQL User's Guide and Reference for a complete list and description of each statement. Throughout the remainder of this course you will learn the purpose of and see examples of many of these statements. You may be wondering, where are the rest of the SQL statements? DDL statements such as CREATE, GRANT, DROP etc. Well, these are DDL statements and cannot be coded directly within PL/SQL. Use the EXECUTE IMMEDIATE statement to embed DDL statements. Mini-Workshop Access chapter 13 of the Oracle9i PL/SQL User's Guide and Reference (R2) and review the examples of the following LOOP statements: basic_loop_statement for_loop_statement cursor_for_loop_statement Access to the complete set of Oracle manuals is free at

34 Language Fundamentals 2.4 Symbol PL/SQL Symbols Purpose + - * / Addition, Subtraction, Multiplication, Division := Assignment operator = Equal to relation >, < Greater than/less than relation <= >= Less than/greater than or equal to <>!= ~= ^= Not equal operators ; Statement terminator, Item separator Quoted identifier ' Character string identifier -- Single line comment. /* */ Beginning / ending of multi-line comment List List continues 2.4 PL/SQL symbols continued: Symbol Purpose. Component selector ( ) Used to control precedence. 5* (2+2) % Prefix for PL/SQL attributes. emp.name%type.. Range operator for loops. FOR x in 1..5 Used to reference remote databases. select * from emp@hq; : Used to prefix a host variable. => The arrow. Use in procedure calls to assign value to a parameter. Concatenation operator. << >> Label. Refer to chapter 2 of the Oracle9i PL/SQL User s Guide and Reference for complete details on the PL/SQL symbols (see delimiters ).

35 Language Fundamentals Quoting Mechanism 10g Like SQL, PL/SQL supports a new technique for denoting quotes LINUX> declare 2 v1 v1 varchar2(100); 3 begin begin 4 v1 v1 := := q'[peg's birthday present]'; 5 insert into into t values(v1); 6 end; end; 7 / PL/SQL procedure successfully LINUX> completed. select * from from t; t; C1 C Peg's Peg's birthday present Oracle10g introduces a new technique for identifying enclosing quotes (delimiters) in text literals. It is supported in SQL statements and PL/SQL statements. This makes coding strings that contain single quotation marks cleaner and less error-prone. Use the letter q (not case-sensitive) followed by the open quote and the quote delimiter character. The Oracle10g SQL Reference states that the quote delimiter character can be any character; however, I find it easiest to use a character that is not used in the literal itself. If the quote delimiter character is [, {, <, or (, then the closing delimiter must be ], }, > or ), respectively. Otherwise use the same exact character as the opening and closing quote delimiter character. Refer to the section on Literals in the Oracle10g SQL Reference manual for more information on what Oracle calls the alternative quoting mechanism.

36 Language Fundamentals Common PL/SQL Datatypes number[(precision,scale)] char[(length)] varchar2(length) date timestamp timestamp with time [local] zone boolean ref cursor exception record table raw(length) long raw long blob clob nclob bfile rowid PL/SQL datatypes define the format of a variable, constant or parameter (parameters are used to pass values to and from a procedure or function). The slide contains a list of commonly used PL/SQL datatypes. In addition to the examples throughout the remainder of this course, refer to Chapter 3 of the PL/SQL User s Guide and Reference for a complete list and description of the datatypes. Here is a brief description of the datatypes listed here: NUMBER. Specify number of digits (precision) and number of decimal places (scale) if you want to store fixed point numbers. Omit precision and scale for floating point numbers. NUMBER has many subtypes such as DECIMAL and INTEGER; refer to the Oracle documentation for more information. CHAR is fixed length character data. The default length of a CHAR variable is 1, the maximum length is The database character set determines the internal representation. VARCHAR2 is variable length character data. Maximum length is For better performance, Oracle pre-allocates 2000 bytes of storage for all VARCHAR2 definitions less than 2000 bytes (it eliminates reallocations as different sized strings are allocated to it, Tom Kyte, May 2004, DATE holds a date/time value. TIMESTAMP contains a date/time value with fractional microseconds. Notes continue on the next page

37 Language Fundamentals 2.7 TIMESTAMP WITH TIME ZONE adds a time zone component to a TIMESTAMP type. BOOLEAN variables contains TRUE, FALSE, or NULL and are use in conditional logic, e.g. CASE and IF statements. e.g. IF VALID_ORDER THEN. EXCEPTION is used to define a user-defined exception name, for example customer_not_found. Refer to the Error Handling lesson for more information. REF CURSOR is a pointer to a memory cursor. Useful for returning sets of rows to callers / clients. RECORD defines a composite type; a collection of other scalar or composite types. TABLE defines a PL/SQL unbounded array, officially called an index-by table or associative array. Refer the examples later in this lesson for more information. RAW and LONG RAW are binary data. LONG RAW has been deprecated in favor of BLOB. BLOB is best to use for large binary objects. LONG and CLOB are large character data objects, better to use newer CLOB. NCLOB is national character set long character object. BFILE is an external binary file. ROWID is a pointer to a table row.

38 Language Fundamentals 2.8 Declaring Variables Specify the following: name datatype nullability (optional) Variable name name is is not notcase sensitive initial value (optional) SQL> declare 2 v_lastname varchar2(20) not not null := := 'SMITH'; 3 begin 4 If If V_Lastname = 'SMITH' then null; end end if; if; 5 end; 6 / NULL NULL is is the the no-op no-op statement PL/SQL procedure successfully completed. Comparison is is case case sensitive Initial Initial value value 2.8 Variables are declared in the DECLARE section of the program. Required are name and datatype. The name, like all Oracle names, must follow these rules: 1 30 alpha-numeric characters 1 st character must be alphabetic Valid special characters are _, $ and # Avoid reserved words such as SELECT In this example, V_LASTNAME is defined with the NOT NULL clause, so it can not contain a null value. An exception is raised if an initial value is not assigned (see the next page for an example). Therefore we must assign the variable an initial value ('SMITH in this example). This is done with the assignment operator (:=) or the DEFAULT keyword. NULL is the PL/SQL no-operation statement. I use it here (see line 4) simply because the BEGIN block is required, yet I do not want it to do anything I simply wanted to demonstrate the declaration and use of a variable. Notes continue on the next page

39 Language Fundamentals 2.9 An exception is raised if a variable defined as NOT NULL is not given a default value: SQL> declare 2 x number not null; 3 begin 4 null; 5 end; 6 / x number not null; * ERROR at line 2: ORA-06550: line 2, column 3: PLS-00218: a variable declared NOT NULL must have an initialization assignment

40 Language Fundamentals 2.10 Declaring Variables 2.10 SQL> SQL> declare 2 v_hiredate1 date; date; 3 v_hiredate2 date date := := sysdate; 4 v_total_sales number(8,2); 5 v_total_value1 number(8,2) := := 0; 0; 6 v_total_value2 number(8,2) default 0; 0; 7 v_order_valid boolean := := false; 8 v_lastname varchar2(20) not not null null := := 'Smith'; 9 c_co_name constant varchar2(20) := := 'SkillBuilders'; begin begin null; null; end; end; / PL/SQL procedure successfully completed. The examples define the following variables: 1. V_HIREDATE1 as a DATE object. The default value is NULL. 2. V_HIREDATE2 as a DATE initialized to the current date in SYSDATE. 3. V_TOTAL_SALES as a NUMBER that can hold 8 total digits with 2 digits after the decimal. Will accept range of values from to The default value in this variable is NULL. 4. V_TOTAL_VALUE1 as a NUMBER that can hold 8 total digits with 2 digits after the decimal. The default value is V_TOTAL_VALUE2 as a NUMBER that can hold 8 total digits with 2 digits after the decimal. The default value is also V_ORDER_VALID is a BOOLEAN initialized to FALSE. It can be used in CASE or IF statements, e.g. IF v_order_valid THEN 7. V_LASTNAME is a variable length character field up to 20 characters that cannot be NULL and is initialized to 'SMITH'. 8. C_CO_NAME is a CONSTANT. Constants have their values defined when the variable is defined, and the value not be changed (an exception occurs if an attempt is made to change the value). See the supplied script DECLARING_VARIABLES.SQL for a working copy of this example.

41 Language Fundamentals %TYPE SQL> declare 2 v1 v1 customer.lastname%type; 3 begin 4 select lastname into v1 v1 5 from customer 6 where cust_no = 1; 1; 7 dbms_output.put_line(v1); 8 end; 9 / Jones Datatype variable using using table table column column Use Use SELECT INTO INTO to to retrieve retrieve 1 row row PL/SQL procedure successfully completed. %TYPE is a great way to datatype a variable. Oracle will use the datatype of the table column, variable or cursor coded in the %TYPE specification. (You ll learn more about cursors later.) It is flexible; if the datatype changes, the new datatype will be picked up when the code is recompiled without a source code change. In this example variable V1 gets the same exact datatype as the LASTNAME column of the CUSTOMER table. This example includes the SELECT INTO statement (a form of implicit cursor). Some form of SELECT is required to access values in a database table (i.e. you cannot just compare to a table value in an IF or CASE statement without first selecting the data). You ll learn more about SELECT INTO and other means of retrieving data later in this course. See the supplied script TYPE.SQL for a copy of the code shown here.

42 Language Fundamentals 2.12 PL/SQL Records A record is a collection of related fields Similar structure to table row 4 ways to define records Table-based table-name%rowtype Programmer-defined Cursor-based cursor-name%rowtype Implicit with cursor FOR LOOP 2.12 These These are are discussed later later A PL/SQL record provides a way to deal with separate, but related, fields (variables) as a single unit. A record often has a similar structure to a row in a database table. There are four ways to define PL/SQL records. We will see examples of table-based and programmerdefined records in the following pages. See the supplied script DEFINING_PLSQL_RECORDS.SQL for examples of the four techniques for declaring variables.

43 Language Fundamentals 2.13 Records: %ROWTYPE 2.13 Define with %ROWTYPE Record matches row 9i supports record-based DML SQL> SQL> DECLARE 2 cust_rec customer%rowtype; 3 BEGIN BEGIN 4 cust_rec.cust_no := := 234; 234; 5 cust_rec.lastname := := 'Anderson'; 6 cust_rec.firstname := := 'Dave'; 7 INSERT INTO INTO customer 8 VALUES cust_rec; 9 END; END; / PL/SQL procedure successfully completed. A table-based record is defined with the %ROWTYPE attribute and creates a records that matches the structure of the table row. i.e., the record has the same number of fields as columns in the table and the fields have the same name and datatype. A PL/SQL record defined with %ROWTYPE: contains the same number of variables as columns in the table all datatypes match field names are the same as column names As we see in this example, the fields in the record are referenced with dot notation, for example cust_rec.lastname. Then we can use the entire record in the INSERT (and UPDATE) statements. As of Oracle9i, a table-based record is a convenient structure for DML operations. Note that the VALUES clause in the INSERT statement references the record eliminating the need to code each variable. The lack of parenthesis is correct syntax when a record is used. See the supplied script RECORDS.SQL for a working example of this code.

44 Language Fundamentals Programmer Defined Records... Define with the TYPE IS RECORD statement Each field explicitly defined Two steps Define record type with TYPE IS RECORD Define instance of record using type TYPE type_name IS IS RECORD (field1 datatype1 {NOT NULL} [:= [:= expr1], field2 datatype2 {NOT NULL} [:= [:= expr2]...); record_name type_name; A programmer defined PL/SQL record is a record where each field is explicitly defined by the programmer. You must first define a record type. Then, you must declare a variable of that type. The datatype of each field can be: Scalar types (NUMBER, VARCHAR2, DATE, etc.) %TYPE, %ROWTYPE or another programmer defined record (yes, Oracle supports nested records). Oracle objects (e.g. defined with CREATE TYPE object-name AS OBJECT) PL/SQL array (more on arrays later in this lesson). REF CURSOR, i.e. a pointer to a cursor. (more on REF CURSORS later in this lesson). Parameter descriptions: type_name Name of record type field Name of field (variable) in record datatype Datatype of field in record There is no limit on the number of fields within the record.

45 Language Fundamentals Programmer Defined Records CREATE OR OR REPLACE PACKAGE custpack AS AS TYPE TYPE cust_info_t IS IS RECORD (cust_no NUMBER, Package Package contains contains a first_purchase DATE DATE := := SYSDATE); record record type type END; END; / CREATE OR OR REPLACE FUNCTION create_cust RETURN custpack.cust_info_t Function Function returns returns IS IS a record record cust_rec custpack.cust_info_t; BEGIN BEGIN SELECT s1.nextval INTO INTO cust_rec.cust_no FROM FROM dual; dual; RETURN(cust_rec); END; END; / Example continues... This example shows that a programmer-defined record type can be packaged. Packaging the record makes the record global, i.e. accessible to any user with execute privilege on the package. Next, we see that a function can return a record see the RETURN(cust_rec) statement. (Later you will learn how to return sets of records!) Here, I have packaged a record type called CUST_INFO_T. Then, I use that type in a function called CREATE_CUST. The function returns a record. Note the reference to the TYPE within the function requires the prefix of the package name, as in CUSTPACK.CUST_INFO_T. This example requires that a sequence called S1 has been created, for example: CREATE SEQUENCE s1; See the supplied script RECORD_IN_PACKAGE.SQL for a working example of this code.

46 Language Fundamentals Programmer Defined Records Define record based on packaged TYPE Function call returns record SQL> SQL> declare 2 cust_rec custpack.cust_info_t; 3 begin begin 4 cust_rec := := create_cust(); 5 dbms_output.put_line(cust_rec.cust_no); 6 end; end; 7 / 1 PL/SQL procedure successfully completed. Define Define record record Call Call function function Here again we see the definition of a record based on a packaged TYPE. We also see the call to the function CREATE_CUST, where CREATE_CUST returns a record.

47 Language Fundamentals 2.17 Language Fundamentals Workshop A PL/SQL Records 2.17 Workshop PL/SQL Records 1. Code a function that accepts a customer number and returns a customer record populated with information about the customer. Use the SQL statement SELECT * INTO record FROM CUSTOMER WHERE cust_no = parameter to retrieve the customer row. 2. Code an anonymous block that calls the function and uses the PUT_LINE procedure to display one or more customer attributes.

48 Language Fundamentals Variable Scope Variables persist in block they are declared And any embedded sub-blocks Cannot be referenced in outer block Can use packages to create global or session variables if needed Easy to pass values Procedures can have IN and OUT parameters The scope of a variable is where it can be referenced (i.e. used or seen). When a variable is declared, it is accessible throughout the PL/SQL block and any embedded sub-blocks. A variable cannot be reference in: An outer (enclosing) block A called procedure or function (To accomplish this, use either use packaged variables or pass the procedure or function a value in the call. You will learn both techniques later in the course.) A calling procedure or function (To return a value from a procedure, use OUT type variables. Functions, by design, always return a value) (Using packages, we can create session (global) variables. This will be discussed in the lesson on packages later in this course.)

49 Language Fundamentals 2.19 Nested Blocks 2.19 SQL> SQL> declare 2 v_custno NUMBER := := 100; 100; 3 begin begin 4 dbms_output.put_line(v_custno) ; 5 declare 6 v_state CHAR(2):= 'NY' 'NY' ; 7 begin begin 8 dbms_output.put_line 9 (v_custno v_state) ; end end ; end end ; / NY 100NY Both Both variables variables can PL/SQL procedure successfully completed. can be be referenced referenced in in the the inner inner block block A PL/SQL variable can be referenced in blocks nested within the block in which the variable is defined unless the nested block contains a variable of the same name; then the local version of the variable is referenced. In the example, there are two blocks. In the first, we declare a variable, V_CUSTNO. In the second, we declare another variable, V_STATE. In the inner block, we can reference the V_CUSTNO variable. Take note that the V_STATE variable cannot be referenced outside the inner block. For instance, the following code will generate a compile error: declare v_custno NUMBER := 100; begin dbms_output.put_line(v_custno) ; declare v_state CHAR(2):= NY ; begin this reference dbms_output.put_line (v_custno v_state) ; end ; dbms_output.put_line(v_state) ; generates error end ; ERROR at line 10: ORA-06550: line 10, column 25: PLS-00201: identifier 'V_STATE' must be declared ORA-06550: line 10, column 4: PL/SQL: Statement ignored

50 Language Fundamentals 2.20 Functions 2.20 Most SQL functions can be used in PL/SQL statements 7 if if upper(v1) = 'ANDERSON' then then 8 null; null; 9 end end if; if; Specific PL/SQL error-reporting functions More More examples examples in in the the Error Error Handling Handling lesson lesson 7 v_msg v_msg varchar2(1020) default sqlerrm; 8 v_code number default sqlcode; Aggregate and analytic functions only in SQL AVG, MIN, MAX, LEAD, LAG Scalar SQL functions such as UPPER, LOWER, INITCAP and SUBSTR can be used in PL/SQL statements. However, the aggregate functions (AVG, MIN, MAX) and analytic functions (LEAD, LAG) are not permitted in PL/SQL statements. Of course, the aggregate and analytic functions can be used in SQL statements embedded in PL/SQL. Oracle also supplies error-related functions SQLERRM and SQLCODE for use in PL/SQL statements only. This slide shows an excerpt from a DECLARE block where we use these functions to initialize local variables. SQLERRM contains the text of the last error message; SQLCODE contains the Oracle error code. You will learn more about the use of these functions in the lesson on error handling later in this course.

51 Language Fundamentals Regular Expressions Like SQL, PL/SQL supports regular expressions 10g LINUX> declare 2 v1 v1 varchar2(20) := := 'abcdefg'; 3 begin begin 4 if if regexp_like(v1, '.*c*') then then null; null; end end if; if; 5 v1 v1 := := regexp_replace(v1, '.*c*', 'a'); 'a'); 6 dbms_output.put_line(v1); 7 end; end; 8 / aa aa PL/SQL procedure successfully completed. Like the Oracle 10g SQL compiler, the 10g PL/SQL compiler supports regular expressions. Oracle s implementation is IEEE POSIX and Unicode Consortium compliant. Oracle10g provides many new operators such as: * - Matches zero or more occurrences + - Matches one or more occurrences? - Matches zero or one occurrence ^ - Anchors to the beginning of the line $ - Anchors to the end of line Oracle 10g Release 2 adds support for Perl expressions, including, but not limited to: \d Match a digit character \D Match a non-digit character \w Match a word character \W Match a non-word character Notes for this slide continue on the next page

Database Programming with PL/SQL: Learning Objectives

Database 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 information

Oracle Database 10g: Program with PL/SQL

Oracle 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 information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review 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 information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. est: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 6 1. How can you retrieve the error code and error message of any

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle 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 information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle 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 information

Oracle Database: Develop PL/SQL Program Units

Oracle 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 information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle 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 information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

ORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT

ORACLE 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 information

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn View a newer version of this course /a/b/p/p/b/pulli/lili/lili/lili/lili/lili/lili/lili/lili/lili/lili/lili/li/ul/b/p/p/b/p/a/a/p/

More information

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Oracle University Contact Us: +33 15 7602 081 Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn This course is available in Training On Demand format This Oracle Database: Program

More information

Introduction to PL/SQL Programming

Introduction 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 information

Oracle Database: Program with PL/SQL

Oracle 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 information

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Oracle University Contact Us: +52 1 55 8525 3225 Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Program with PL/SQL

More information

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Oracle University Contact Us: 0845 777 7711 Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn This course starts with an introduction to PL/SQL and proceeds to list the benefits

More information

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Duration 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 information

Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts

Duration 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 information

Handling 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 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 information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle 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 information

Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia

Topics 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 information

Handling 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 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 information

PL/SQL Overview. Basic Structure and Syntax of PL/SQL

PL/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 information

Oracle Internal & Oracle Academy

Oracle Internal & Oracle Academy Declaring PL/SQL Variables Objectives After completing this lesson, you should be able to do the following: Identify valid and invalid identifiers List the uses of variables Declare and initialize variables

More information

Oracle 11g PL/SQL training

Oracle 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 information

Creating PL/SQL Blocks. Copyright 2007, Oracle. All rights reserved.

Creating 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 information

Handling Exceptions. Copyright 2008, Oracle. All rights reserved.

Handling 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 information

Oracle Database 11g: Program with PL/SQL

Oracle Database 11g: Program with PL/SQL Oracle University Entre em contato: 0800 891 6502 Oracle Database 11g: Program with PL/SQL Duração: 5 Dias Objetivos do Curso This course introduces students to PL/SQL and helps them understand the benefits

More information

Handling 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 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 information

Oracle(PL/SQL) Training

Oracle(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 information

PL/SQL MOCK TEST PL/SQL MOCK TEST I

PL/SQL MOCK TEST PL/SQL MOCK TEST I http://www.tutorialspoint.com PL/SQL MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to PL/SQL. You can download these sample mock tests at your local

More information

Oracle PL/SQL Programming

Oracle PL/SQL Programming FOURTH EDITION Oracle PL/SQL Programming Steven Feuerstein with Bill Pribvl O'REILLY' Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo Table of Contents Preface xiii Part 1. Programming in

More information

Introduction to Oracle PL/SQL Programming V2.1 - Lessons 11-End

Introduction to Oracle PL/SQL Programming V2.1 - Lessons 11-End Introduction to Oracle PL/SQL Programming V2.1 - Lessons 11-End Introduction to Oracle PL/SQLProgramming Page i Table of Contents 0. How to Use This Course...0.1 Lesson Objectives...0.2 Target Audience...0.3

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Oracle Database 10g: Introduction to SQL

Oracle 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 information

Oracle Database 11g Express Edition PL/SQL and Database Administration Concepts -II

Oracle Database 11g Express Edition PL/SQL and Database Administration Concepts -II Oracle Database 11g Express Edition PL/SQL and Database Administration Concepts -II Slide 1: Hello and welcome back to the second part of this online, self-paced course titled Oracle Database 11g Express

More information

Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement

Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

More information

Page 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 information

14 Triggers / Embedded SQL

14 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 information

Handling PL/SQL Errors

Handling 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 information

An Oracle White Paper June 2013. Migrating Applications and Databases with Oracle Database 12c

An Oracle White Paper June 2013. Migrating Applications and Databases with Oracle Database 12c An Oracle White Paper June 2013 Migrating Applications and Databases with Oracle Database 12c Disclaimer The following is intended to outline our general product direction. It is intended for information

More information

Oracle SQL. Course Summary. Duration. Objectives

Oracle 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 information

Handling PL/SQL Errors

Handling PL/SQL Errors 7 Handling PL/SQL Errors There is nothing more exhilarating than to be shot at without result. Winston Churchill Run-time errors arise from design faults, coding mistakes, hardware failures, and many other

More information

OPP 2007. ODTUG Kaleidoscope. An ODTUG SP* Oracle PL/SQL Programming Conference. WOW-Wide Open World, Wide Open Web!

OPP 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 information

Making the Most of Oracle PL/SQL Error Management Features

Making 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 information

Firebird. Embedded SQL Guide for RM/Cobol

Firebird. Embedded SQL Guide for RM/Cobol Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...6 1.1. General...6 1.2. Reading this Guide...6 1.3. Definition of Terms...6 1.4. Declaring

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Introduction to SQL training

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

SQL Server An Overview

SQL Server An Overview SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system

More information

Training Guide. PL/SQL for Beginners. Workbook

Training Guide. PL/SQL for Beginners. Workbook An Training Guide PL/SQL for Beginners Workbook Workbook This workbook should be worked through with the associated Training Guide, PL/SQL for Beginners. Each section of the workbook corresponds to a section

More information

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally

More information

1 Stored Procedures in PL/SQL 2 PL/SQL. 2.1 Variables. 2.2 PL/SQL Program Blocks

1 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 information

Answers to the Try It Yourself Sections

Answers 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 information

Embedded SQL programming

Embedded 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 information

PL/SQL TUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com

PL/SQL TUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com PLSQL Tutorial PLSQL TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i C O P Y R I G H T & D I S C L A I M E R N O T I C E All the content and graphics on this tutorial are the property

More information

Oracle PL/SQL Best Practices

Oracle 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 information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.

More information

GENERAL PROGRAMMING LANGUAGE FUNDAMENTALS

GENERAL PROGRAMMING LANGUAGE FUNDAMENTALS C H A P T E R 3 GENERAL PROGRAMMING LANGUAGE FUNDAMENTALS CHAPTER OBJECTIVES In this Chapter, you will learn about: PL/SQL Programming Fundamentals Page 46 In the first two chapters you learned about the

More information

Programming with SQL

Programming with SQL Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using

More information

Migrating Non-Oracle Databases and their Applications to Oracle Database 12c O R A C L E W H I T E P A P E R D E C E M B E R 2 0 1 4

Migrating Non-Oracle Databases and their Applications to Oracle Database 12c O R A C L E W H I T E P A P E R D E C E M B E R 2 0 1 4 Migrating Non-Oracle Databases and their Applications to Oracle Database 12c O R A C L E W H I T E P A P E R D E C E M B E R 2 0 1 4 1. Introduction Oracle provides products that reduce the time, risk,

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training teaches you how to write subqueries,

More information

Oracle SQL Developer for Database Developers. An Oracle White Paper June 2007

Oracle SQL Developer for Database Developers. An Oracle White Paper June 2007 Oracle SQL Developer for Database Developers An Oracle White Paper June 2007 Oracle SQL Developer for Database Developers Introduction...3 Audience...3 Key Benefits...3 Architecture...4 Key Features...4

More information

Writing Control Structures

Writing 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 information

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY 2.1 Introduction In this chapter, I am going to introduce Database Management Systems (DBMS) and the Structured Query Language (SQL), its syntax and usage.

More information

SQL Server Database Coding Standards and Guidelines

SQL Server Database Coding Standards and Guidelines SQL Server Database Coding Standards and Guidelines http://www.sqlauthority.com Naming Tables: Stored Procs: Triggers: Indexes: Primary Keys: Foreign Keys: Defaults: Columns: General Rules: Rules: Pascal

More information

Oracle9i: Develop PL/SQL Program Units

Oracle9i: Develop PL/SQL Program Units Oracle9i: Develop PL/SQL Program Units Student Guide Volume 2 40056GC10 Production 1.0 July 2001 D33491 Author Nagavalli Pataballa Technical Contributors and Reviewers Anna Atkinson Bryan Roberts Caroline

More information

PL/SQL Programming Workbook

PL/SQL Programming Workbook ORACLG Oracle Press Oracle Database 11 g PL/SQL Programming Workbook TIB/UB Hannover 89 ACKNOWLEDGMENTS INTRODUCTION xvii xix PARTI PL/SQL Fundamentals 1 Oracle Development Overview 3 History and Background

More information

Oracle Database 10g Express

Oracle Database 10g Express Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives

More information

A basic create statement for a simple student table would look like the following.

A 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 information

Oracle For Beginners Page : 1

Oracle For Beginners Page : 1 Oracle For Beginners Page : 1 Chapter 22 OBJECT TYPES Introduction to object types Creating object type and object Using object type Creating methods Accessing objects using SQL Object Type Dependencies

More information

Oracle For Beginners Page : 1

Oracle 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 information

ERserver. DB2 Universal Database for iseries SQL Programming with Host Languages. iseries. Version 5

ERserver. DB2 Universal Database for iseries SQL Programming with Host Languages. iseries. Version 5 ERserver iseries DB2 Universal Database for iseries SQL Programming with Host Languages Version 5 ERserver iseries DB2 Universal Database for iseries SQL Programming with Host Languages Version 5 Copyright

More information

Intro to Embedded SQL Programming for ILE RPG Developers

Intro to Embedded SQL Programming for ILE RPG Developers Intro to Embedded SQL Programming for ILE RPG Developers Dan Cruikshank DB2 for i Center of Excellence 1 Agenda Reasons for using Embedded SQL Getting started with Embedded SQL Using Host Variables Using

More information

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 A feature of Oracle Rdb By Ian Smith Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal SQL:1999 and Oracle Rdb V7.1 The

More information

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

SQL - QUICK GUIDE. Allows users to access data in relational database management systems. http://www.tutorialspoint.com/sql/sql-quick-guide.htm SQL - QUICK GUIDE Copyright tutorialspoint.com What is SQL? SQL is Structured Query Language, which is a computer language for storing, manipulating

More information

Instant SQL Programming

Instant SQL Programming Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Lesson 5 Administrative Users

Lesson 5 Administrative Users Administrative Users 5.1 Lesson 5 Administrative Users A practical and hands-on lesson on creating and using Oracle administrative users. SKILLBUILDERS Administrative Users 5.2 Lesson Objectives Understand

More information

Oracle Database 11g: Advanced PL/SQL

Oracle Database 11g: Advanced PL/SQL Oracle Database 11g: Advanced PL/SQL Volume I Student Guide D52601GC10 Edition 1.0 March 2008 D54299 Authors Nancy Greenberg Rick Green Marcie Young Technical Contributors and Reviewers Claire Bennett

More information

InterBase 6. Embedded SQL Guide. Borland/INPRISE. 100 Enterprise Way, Scotts Valley, CA 95066 http://www.interbase.com

InterBase 6. Embedded SQL Guide. Borland/INPRISE. 100 Enterprise Way, Scotts Valley, CA 95066 http://www.interbase.com InterBase 6 Embedded SQL Guide Borland/INPRISE 100 Enterprise Way, Scotts Valley, CA 95066 http://www.interbase.com Inprise/Borland may have patents and/or pending patent applications covering subject

More information

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to: D61830GC30 for Developers Summary Duration Vendor Audience 5 Days Oracle Database Administrators, Developers, Web Administrators Level Technology Professional Oracle 5.6 Delivery Method Instructor-led

More information

Recognizing PL/SQL Lexical Units. Copyright 2007, Oracle. All rights reserved.

Recognizing PL/SQL Lexical Units. Copyright 2007, Oracle. All rights reserved. What Will I Learn? In this lesson, you will learn to: List and define the different types of lexical units available in PL/SQL Describe identifiers and identify valid and invalid identifiers in PL/SQL

More information

1 Changes in this release

1 Changes in this release Oracle SQL Developer Oracle TimesTen In-Memory Database Support Release Notes Release 4.0 E39883-01 June 2013 This document provides late-breaking information as well as information that is not yet part

More information

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

MyOra 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 information

How To Create A Table In Sql 2.5.2.2 (Ahem)

How To Create A Table In Sql 2.5.2.2 (Ahem) Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or

More information

Introduction to the Oracle DBMS

Introduction to the Oracle DBMS Introduction to the Oracle DBMS Kristian Torp Department of Computer Science Aalborg University www.cs.aau.dk/ torp torp@cs.aau.dk December 2, 2011 daisy.aau.dk Kristian Torp (Aalborg University) Introduction

More information

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

More information

Choosing a Data Model for Your Database

Choosing a Data Model for Your Database In This Chapter This chapter describes several issues that a database administrator (DBA) must understand to effectively plan for a database. It discusses the following topics: Choosing a data model for

More information

Continuous Integration Part 2

Continuous 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 information

T-SQL STANDARD ELEMENTS

T-SQL STANDARD ELEMENTS T-SQL STANDARD ELEMENTS SLIDE Overview Types of commands and statement elements Basic SELECT statements Categories of T-SQL statements Data Manipulation Language (DML*) Statements for querying and modifying

More information

IT2305 Database Systems I (Compulsory)

IT2305 Database Systems I (Compulsory) Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this

More information

Oracle 10g PL/SQL Training

Oracle 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 information

Database Administration with MySQL

Database Administration with MySQL Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SQL 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 information

IT2304: Database Systems 1 (DBS 1)

IT2304: Database Systems 1 (DBS 1) : Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation

More information

Oracle Database 11g SQL

Oracle Database 11g SQL AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries

More information

Information Systems SQL. Nikolaj Popov

Information Systems SQL. Nikolaj Popov Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline SQL Table Creation Populating and Modifying

More information