Oracle PL/SQL:Constants

A constant is a variable that is assigned a value during the declaration using the CONSTANT keyword. A constant variable maintains the same value throughout the life of the procedure. You cannot change the value of a constant outside the declaration. If you try to change the value of a constant outside the declaration section, you will get an error.

To declare a constant,

Syntax is:

VARIABLE_NAMEĀ  CONSTANTĀ  DATATYPE := VARIABLE_VALUE;

Some examples follow:

DECLARE
v_message CONSTANT VARCHAR2(10) := ‘Hello World’;
v_emp_number CONSTANT NUMBER := 123;
BEGIN
–some executable statments that use these variables
END;


No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




CAPTCHA Image CAPTCHA Audio
Refresh Image

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .