04ch - EnhancedGuidetoOracle8i Chapter4:...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Enhanced Guide to Oracle8i Enhanced Guide to Oracle8i Chapter 4: Introduction to PL/SQL
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Procedural programming language Uses detailed instructions Processes statements sequentially Combines SQL commands with  procedural instructions Used to perform sequential  processing using an Oracle  database What is PL/SQL?
Background image of page 2
3 PL/SQL Variables Variable names must follow the Oracle  naming standard Can use reserved words (BEGIN, NUMBER) and  table names for variable names, but is not a good  practice Make variable names descriptive Use lower-case letters, and separate words  with underscores Example:   current_s_id
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Declaring PL/SQL Variables PL/SQL is a strongly-typed language All variables must be declared prior to use Syntax for declaring a variable: variable_name data_type_declaration ; Example: current_s_id NUMBER(6);
Background image of page 4
5 PL/SQL Data Types Scalar References a single value Composite References a data structure Reference References a specific database item LOB References a large binary object
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Scalar Data Types Database scalar data types: VARCHAR2 CHAR DATE LONG NUMBER Non-database scalar data types: Integers:  BINARY_INTEGER, INTEGER, INT,  SMALLINT Decimal numbers:  DEC, DECIMAL, DOUBLE,  PRECISION, NUMERIC, REAL BOOLEAN
Background image of page 6
7 Composite Data Types Reference multiple data elements, such  as a record Types: RECORD TABLE VARRAY Tabular structure that can expand or contract  as needed
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Reference Data Types Reference a database item  Assume data type of item %TYPE:  assumes data type of field %ROWTYPE:  assumes data type of entire  row
Background image of page 8
9 DECLARE Variable declarations BEGIN Program statements EXCEPTION Error-handling statements END; Body Variable Declarations Exception Section PL/SQL Program Structure
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 May span multiple text editor lines Each line ends with a semicolon Text is not case sensitive PL/SQL Program Lines
Background image of page 10
11 Block of comments are delimited with /*   */ /* <comment that spans more than one line of code> */ Single comment line starts with 2  hyphens -- comment on a single line Comment Statements
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 * *   Exponentiation  2 * *  3  8  *   Multiplication  2 *  3  6  /  Division  9/2  4.5  +  Addition  3 + 2  5  -  Subtraction  3 – 2  1  -  Negation  -5  Negative 5  Example Result Arithmetic Operators
Background image of page 12
13 Assignment operator:   := Variable being assigned to a new value  is on left side of assignment operator New value is on right side of operator student_name := ‘John Miller’; student_name := current_student; Assignment Statements
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 Normally PL/SQL is used with other Oracle  utilities such as forms or reports
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.

Page1 / 61

04ch - EnhancedGuidetoOracle8i Chapter4:...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online