PL/SQL (Cont d) Let s start with the mail_order database, shown here:
|
|
- Bertram Hoover
- 8 years ago
- Views:
Transcription
1 PL/SQL (Cont d) Let s start with the mail_order database, shown here: 1
2 Table schemas for the Mail Order database: 2
3 The values inserted into zipcodes table: The values inserted into employees table: 3
4 The values inserted into customers table: The values inserted into parts table: 4
5 The values inserted into orders table: The values inserted into Odetails table: 5
6 First PL/SQL program which actually uses SQL statement within the body of the program: a. The following is an example of an anonymous block b. The block gets all the rows from the MO_customers table c. It prints the names of the customers on the screen d. It does use PL/SQL tables and cursors (covered later) e. To execute this anonymous block within the SQLPLUS environment, save it in a *.sql file f. Use start *.sql at the sql prompt to execute it g. All rows of MO-customer is redefined as a table type and is called customers_table h. The alias c_table is used for customers_table i. The sql statement is declared as cursor c j. The explicit (vs. implicit) cursor c is defined as select from MO_customers k. 6
7 PL/SQL/Cursors Oracle creates a memory area, known as context area, for processing an SQL statement, which contains all information needed for processing the statement, for example, number of rows processed, etc. A cursor is a pointer to this context area. PL/SQL controls the context area through a cursor. A cursor holds the rows (one or more) returned by a SQL statement. The set of rows the cursor holds is referred to as the active set. You can name a cursor so that it could be referred to in a program to fetch and process the rows returned by the SQL statement, one at a time. There are two types of cursors: Implicit cursors Explicit cursors Implicit Cursors Implicit cursors are automatically created by Oracle whenever an SQL statement is executed, when there is no explicit cursor for the statement. Programmers cannot control the implicit cursors and the information in it. Whenever a DML statement (INSERT, UPDATE and DELETE) is issued, an implicit cursor is associated with this statement. For INSERT operations, the cursor holds the data that needs to be inserted. For UPDATE and DELETE operations, the cursor identifies the rows that would be affected. In PL/SQL, you can refer to the most recent implicit cursor as the SQL cursor, which always has the attributes like %FOUND, %ISOPEN, %NOTFOUND, and %ROWCOUNT. The SQL cursor has additional attributes, %BULK_ROWCOUNT and %BULK_EXCEPTIONS, designed for use with the FORALL statement. The following table provides the description of the most used attributes: Attribute Description %FOUND Returns TRUE if an INSERT, UPDATE, or DELETE statement affected one or more rows or a SELECT INTO statement returned one or more rows. Otherwise, it returns FALSE. %NOTFOUND The logical opposite of %FOUND. It returns TRUE if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows. Otherwise, it returns FALSE. %ISOPEN Always returns FALSE for implicit cursors, because Oracle closes the SQL cursor automatically after executing its associated SQL statement. %ROWCOUNT Returns the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement. Any SQL cursor attribute will be accessed as sql%attribute_name as shown below in the example. Before talking about implicit and explicit cursors, think about the following two examples: x = x + 1; or x = x + y (long version/explicit) or the short version/implicit of them: x ++; or x += y; 7
8 Implicit Cursors Example There are 5 records in the employee table, with empid, dept, salary, hiredate, supervisorid as attributes. Sample table employee before introducing the implicit cursors (sql%found and %notfound): The following procedure counts the number of records in the employee table and increases the salaries of all employees by 500, and displays the updated contents of the table. The display of the total_rows = 5 is not shown in the above screen capture. 8
9 More Examples: The cursor loads one tuple(row) into the context area, whereas the sql statement following PL/SQL program retrieves all tuples of the table. How would you retrieve all rows using the PL/SQL program? How about placing the fetch statement inside a loop, iterating till all tuples are counted for? Let s do it (see next page). 9
10 The following loop is much more efficient and does the same. 10
11 Question 1: What does the following program do? Table x has 3 rows (1, 1, 1; 2, 4, 8; 3, 9, 27). Your Answer: 11
12 Question 2: What does the following program do? Table x has 3 rows (1, 1, 1; 2, 4, 8; 3, 9, 27). Your answer: 12
13 More on Explicit Cursors Explicit cursors are programmer defined cursors for gaining more control over the context area. An explicit cursor should be defined in the declaration section of the PL/SQL Block. It is created on a SELECT Statement which returns more than one row. The syntax for creating an explicit cursor is : CURSOR cursor_name IS select_statement; Working with an explicit cursor involves four steps: Declaring the cursor for initializing in the memory Opening the cursor for allocating memory Fetching the cursor for retrieving data Closing the cursor to release allocated memory Declaring the Cursor Declaring the cursor defines the cursor with a name and the associated SELECT statement. For example: CURSOR c_customers IS SELECT id, name, address FROM customers; Opening the Cursor Opening the cursor allocates memory for the cursor and makes it ready for fetching the rows returned by the SQL statement into it. For example, we will open above-defined cursor as follows: OPEN c_customers; Fetching the Cursor Fetching the cursor involves accessing one row at a time. For example we will fetch rows from the above-opened cursor as follows: FETCH c_customers INTO c_id, c_name, c_addr; Closing the Cursor Closing the cursor means releasing the allocated memory. For example, we will close above-opened cursor as follows: CLOSE c_customers; Think of the cursor as a pointer to the beginning of the table/ later moves down with fetch statement Name type initialization (amount number := 0;) Type name initialization (cursor a_cur is select * from x;) Open allocates memory for the cursor & makes it ready for fetching the rows returned by sql statement Fetch the cursor involves one row at a time loaded in the variables and return to the beginning of the next Close is like unloading the table and releasing the allocated memory 13
14 Additional Explicit Cursors Examples Using the employee table with 5 records, with empid, dept, salary, hiredate, supervisorid as attributes: a. Sample table employee before introducing the implicit cursors (sql%found and %notfound): b. The original table attributes (empid, dept, and salary) are renamed as e_id, e_dept, e_sal c. The cursor is declared as e_employee (still in DECLARE block) d. In the BEGIN block, the cursor is opened e. The rows are fetched one by one until the implicit cursor %notfound is true (no employees left) f. The loop ends after fetching 5 records and the cursor is closed g. Fetch goes forward, one row at a time, it cannot jump for row 1 to row 6, or go backward 14
15 Another Example The following is another example of using cursor statements (cursor, open, fetch, ) and attributes: PL/SQL provides a variation of for loop to be used with cursors, useful in situations where all rows of the cursor are to be processed, with the following syntax: for <record_index> in <cname> loop loop body; end loop; Here is the previous program with this for statement (no open, fetch, or close the cursor needed, as the loop terminates automatically when all rows of the cursor are fetched): 15
16 Parametrized Cursors PL/SQL allows cursors to take input parameters, which makes them more flexible. The syntax foe declaring explicit cursor with parameters, specified immediately after the cursor name, is: Cursor <Cname> (<parameter-list>) [return <return-spec>] Is <select-statement>; Question: How would you modify the program to display all employees, cities, and total sales? 16
17 PL/SQL Records A PL/SQL record is a data structure that can hold data items of different kinds. Records consist of different fields, similar to a row of a database table. For example, you want to keep track of your books in a library. You might want to track the following attributes about each book like, Title, Author, Subject, Book ID. A record containing a field for each of these items allows treating a BOOK as a logical unit and allows you to organize and represent its information in a better way. PL/SQL can handle the following types of records: Table-based Cursor-based records User-defined records Table-Based Records The %ROWTYPE attribute enables a programmer to create table-based and cursor-based records. The following example would illustrate the concept of table-based records. We will be using the employee table we had created and used in the previous examples: Review Exercise: Modify the above program so that it will display the same information about all the employees in the table employee, not just the one with empid =
18 Cursor-Based Records The following example would illustrate the concept of cursor-based records. We will be using the CUSTOMERS table we had created and used in the previous examples: User-Defined Records PL/SQL provides a user-defined record type that allows you to define different record structures. Records consist of different fields. Suppose you want to keep track of your books in a library. You might want to track the following attributes about each book: Title Author Subject Book ID Defining a Record The record type is defined as: TYPE type_name IS RECORD ( field_name1 datatype1 [NOT NULL] [:= DEFAULT EXPRESSION], field_name2 datatype2 [NOT NULL] [:= DEFAULT EXPRESSION],... field_namen datatypen [NOT NULL] [:= DEFAULT EXPRESSION); record-name type_name; 18
19 Here is the way you would declare the Book record: DECLARE TYPE books IS RECORD (title varchar(50), author varchar(50), subject varchar(100), book_id number); book1 books; book2 books; Here is an example of implementation of the user-defined records: 19
20 Homework: Given the following investment portfolio database, complete the PL/SQL programs on the following page. A sample of investment portfolio database: 20
21 21
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationOracle 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 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 informationOracle 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 informationOracle 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 informationReview 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 informationOracle 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 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 informationTraining 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 informationCS 632 Advanced Database Systems Object-Relational Database (ORDB) Dr. H. Assadipour
Introduction: CS 632 Advanced Database Systems Object-Relational Database (ORDB) Dr. H. Assadipour Oracle8 introduced Object-Relational Database (ORDB) Management System as extension of purely relational
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 informationOracle 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 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 informationOverview of PL/SQL. About PL/SQL
Overview of PL/SQL About PL/SQL PL/SQL is an extension to SQL with design features of programming languages. Data manipulation and query statements of SQL are included within procedural units of code.
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 informationHow To Name A Program In Apl/Sql
PL/SQL This section will provide a basic understanding of PL/SQL. This document will briefly cover the main concepts behind PL/SQL and provide brief examples illustrating the important facets of the language.
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 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 informationPL/SQL - QUICK GUIDE PL/SQL - ENVIRONMENT SETUP
PLSQL - QUICK GUIDE http:www.tutorialspoint.complsqlplsql_quick_guide.htm Copyright tutorialspoint.com The PLSQL programming language was developed by Oracle Corporation in the late 1980s as procedural
More informationOracle 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 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 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 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 informationOracle Database 10g: PL/SQL Fundamentals
Oracle Database 10g: PL/SQL Fundamentals Electronic Presentation D17112GC11 Edition 1.1 August 2004 D39718 Authors Sunitha Patel Priya Nathan Technical Contributors and Reviewers Andrew Brannigan Christoph
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 informationChapter 9, More SQL: Assertions, Views, and Programming Techniques
Chapter 9, More SQL: Assertions, Views, and Programming Techniques 9.2 Embedded SQL SQL statements can be embedded in a general purpose programming language, such as C, C++, COBOL,... 9.2.1 Retrieving
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 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 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 informationChapter 9: Object-Based Databases
Chapter 9: Object-Based Databases Database System Concepts See www.db-book.com for conditions on re-use Database System Concepts Chapter 9: Object-Based Databases Complex Data Types and Object Orientation
More informationOracle 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 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 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 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 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 information5.1 Database Schema. 5.1.1 Schema Generation in SQL
5.1 Database Schema The database schema is the complete model of the structure of the application domain (here: relational schema): relations names of attributes domains of attributes keys additional constraints
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 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 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 informationPL/SQL: Introduction. Overview. Anonymous Blocks and Basic Language Features
.. Fall 2007 CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar.. Overview PL/SQL: Introduction PL/SQL is a programming language-like extension of SQL. Its implementation is available on
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 informationIntro 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 informationChapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification
Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries
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 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 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 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 informationChapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications
Chapter 13 SQL Programming Introduction to SQL Programming Techniques Database applications Host language Java, C/C++/C#, COBOL, or some other programming language Data sublanguage SQL SQL standards Continually
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 information3.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 informationCourse -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 informationPL/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 informationBest Practices for Dynamic SQL
The PL/SQL Channel Writing Dynamic SQL in Oracle PL/SQL Best Practices for Dynamic SQL Steven Feuerstein steven@stevenfeuerstein.com www.stevenfeuerstein.com www.plsqlchallenge.com Quick Reminders Download
More informationCIS 631 Database Management Systems Sample Final Exam
CIS 631 Database Management Systems Sample Final Exam 1. (25 points) Match the items from the left column with those in the right and place the letters in the empty slots. k 1. Single-level index files
More informationIntroduction to SQL and database objects
Introduction to SQL and database objects IBM Information Management Cloud Computing Center of Competence IBM Canada Labs 1 2011 IBM Corporation Agenda Overview Database objects SQL introduction The SELECT
More informationIntroduction 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 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 informationMore SQL: Assertions, Views, and Programming Techniques
9 More SQL: Assertions, Views, and Programming Techniques In the previous chapter, we described several aspects of the SQL language, the standard for relational databases. We described the SQL statements
More informationObjectives. Oracle SQL and SQL*PLus. Database Objects. What is a Sequence?
Oracle SQL and SQL*PLus Lesson 12: Other Database Objects Objectives After completing this lesson, you should be able to do the following: Describe some database objects and their uses Create, maintain,
More informationMaintaining Stored Procedures in Database Application
Maintaining Stored Procedures in Database Application Santosh Kakade 1, Rohan Thakare 2, Bhushan Sapare 3, Dr. B.B. Meshram 4 Computer Department VJTI, Mumbai 1,2,3. Head of Computer Department VJTI, Mumbai
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 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 informationRetrieving 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 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 informationDatabase Management Systems. Chapter 1
Database Management Systems Chapter 1 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2 What Is a Database/DBMS? A very large, integrated collection of data. Models real-world scenarios
More informationWhat is the value of SQL%ISOPEN immediately after the SELECT statement is executed? Error. That attribute does not apply for implicit cursors.
1. A PL/SQL block includes the following statement: SELECT last_name INTO v_last_name FROM employees WHERE employee_id=100; What is the value of SQL%ISOPEN immediately after the SELECT statement is executed?
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 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 informationProgramming 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 Query 1: SQL Basics
Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic
More informationHandling 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 informationSQL NULL s, Constraints, Triggers
CS145 Lecture Notes #9 SQL NULL s, Constraints, Triggers Example schema: CREATE TABLE Student (SID INTEGER PRIMARY KEY, name CHAR(30), age INTEGER, GPA FLOAT); CREATE TABLE Take (SID INTEGER, CID CHAR(10),
More informationUsing SQL Developer. Copyright 2008, Oracle. All rights reserved.
Using SQL Developer Objectives After completing this appendix, you should be able to do the following: List the key features of Oracle SQL Developer Install Oracle SQL Developer Identify menu items of
More informationWeek 1 Part 1: An Introduction to Database Systems. Databases and DBMSs. Why Use a DBMS? Why Study Databases??
Week 1 Part 1: An Introduction to Database Systems Databases and DBMSs Data Models and Data Independence Concurrency Control and Database Transactions Structure of a DBMS DBMS Languages Databases and DBMSs
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 informationSQL DATABASE PROGRAMMING (PL/SQL AND T-SQL)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Programming SQL DATABASE PROGRAMMING (PL/SQL AND T-SQL) WHO AM I? Michael Kremer Currently: Federal Reserve Bank San Francisco
More informationChapter 8: Introduction to PL/SQL 1
Chapter 8: Introduction to PL/SQL 1 What is PL/SQL? PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural features of programming languages. It
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 informationCS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model
CS2Bh: Current Technologies Introduction to XML and Relational Databases Spring 2005 The Relational Model CS2 Spring 2005 (LN6) 1 The relational model Proposed by Codd in 1970. It is the dominant data
More informationDeveloping SQL and PL/SQL with JDeveloper
Seite 1 von 23 Developing SQL and PL/SQL with JDeveloper Oracle JDeveloper 10g Preview Technologies used: SQL, PL/SQL An Oracle JDeveloper Tutorial September 2003 Content This tutorial walks through the
More informationOracle 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 informationDatabase Security. Soon M. Chung Department of Computer Science and Engineering Wright State University schung@cs.wright.
Database Security Soon M. Chung Department of Computer Science and Engineering Wright State University schung@cs.wright.edu 937-775-5119 Goals of DB Security Integrity: Only authorized users should be
More information