Here variable_name is the identifier of variable and datatype is a valid PL/SQL datatype. CONSTANT and DEFAULT are keywords used to define constants and set default values of variables

Initializing Variables in PL/SQL

When we declare any variable, PL/SQL assigns it a default value of null but if we want to assign any other value to variable initially then we can do this using any of following methods during declaration

Variable Scope in PL/SQL

Like many other programming languages, In PL/SQL We have two types (Scope Wise) of variable – Local Variable and Global Variable
PL/SQL supports nested blocks so a block can have another inner block, In this type of case the variables declared in the inner block are not accessible in its parent (outer) block

Local Variable- Variables declared in the inner block are not accessible in the outer block are called local variables

Global Variable- Variables declared in the outermost block are called global variables

PL/SQL Constants

Constant means – that does not change
and Constant Variables are those variables that are declared once and their value remain unchanged throughout the program
A constant variable is declared using CONSTANT keyword and requires an initial value

Hey Friend! Thanks for visiting our site We have detected that you are using AdBlock and we understand your concern but for keeping up this website we need to show some beautifully placed ads. I hope you understand that and support us by disabling AdBlock on this site. Please disable AdBlock in the browser and reload this page to visit my website.&nbsp&nbsp&nbsp&nbsp

We use cookies on our website to help us offer you best online experience Find out more.