Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle DECLARE Statement      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: DECLARE

Definition:
DECLARE is an optional sectional of a PL/SQL block. It is used for the declaration of local memory variables, localized subprograms (procedures or functions) to be used within the PL/SQL block. The scope and visibility of the variables within the DECLARE section is limited only to that anonymous block.

The DECLARE keyword is not required in PL/SQL subprograms (procedures and functions). The section contained within IS and BEGIN is known as the Declarative section. Note that TRIGGER requires the DECLARE section to be declared explicitly.

Example Syntax

Anonymous PL/SQL block

DECLARE
L_SUM NUMBER;
BEGIN
L_SUM := 10 + 20;
END;


Subprograms

CREATE OR REPLACE PROCEDURE P_SUM 
IS
L_SUM NUMBER;
BEGIN
L_SUM := 10 + 20;
END;
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 75 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?