Maxii
Maxii

Reputation: 703

Pl/SQL: Difference between define and declare

DEFINE p_annual_sal = 60000
DECLARE
v_sal NUMBER(9,2) := &p_annual_sal;
BEGIN
v_sal := v_sal/12;
END;
/

What is the the use of the "Define" word?

Upvotes: 6

Views: 8043

Answers (1)

igr
igr

Reputation: 3499

DECLARE starts section of pl/sql block (DECLARE... BEGIN... END; ) where you declare variables to be used inside BEGIN... END; part. (executed on Oracle server)

DEFINE is a way to substitute values (in SQL*Plus, SQL dev,...) - substitution done by the client side tool (sqlplus) before sending to server.

Upvotes: 7

Related Questions