Oracle PL/SQL

Oracle Procedural SQL extensions:

PL/SQL Structure
  DECLARE - also declaring Table Variables
  BEGIN-EXCEPTION-END

Operators
Conditional Statements - IF

Cursor commands

1) Cursor DECLARE - Define structure & create a named SQL area
2) Cursor OPEN    - Interpret any bind variables and Query the database  
3) Cursor FETCH   - Load the current row into variables
4) Cursor CLOSE   - When there are no more rows to process

Looping Statements - LOOP, WHILE, FOR
Cursor FOR loops

Cursor Variables (REF cursors)

1) REF Cursor DECLARE - Define structure & create a named SQL area
2) REF Cursor OPEN    - Interpret any bind variables and Query the database  
3) REF Cursor FETCH   - Load the current row into variables
4) REF Cursor CLOSE   - When there are no more rows to process

SELECT... INTO v_myvar... ;
INSERT INTO... VALUES... ;
UPDATE... SET... =... WHERE CURRENT OF cursor_name;
DELETE FROM... WHERE CURRENT OF cursor_name;

An overview of Stored Procedures PL/SQL

"Software code, like laws and sausages, should never be examined in production" ~ Edward Tenner

Related Commands:


COMMIT

SAVEPOINT

ROLLBACK


 
Copyright © 1999-2024 SS64.com
Some rights reserved