1. P L / S Q L T u t o r i a l - B y E r G u r p r e e t S i n g h
Visit: http://gsbprogramming.blogspot.in
2. P L / S Q L T u t o r i a l - B y E r G u r p r e e t S i n g h
Visit: http://gsbprogramming.blogspot.in
DATA TYPES
PL/SQL has following data types:
Numeric data types- For numeric values.
3. P L / S Q L T u t o r i a l - B y E r G u r p r e e t S i n g h
Visit: http://gsbprogramming.blogspot.in
For example:
DECLARE
vSalary number(10):=1000; - - Can store numeric values upto 10 digits only
BEGIN
dbms_output.put_line(‘Salary: ‘||vSalary);
END;
/
Will result:
Salary: 1000
PL/SQL procedure successfully completed.
Character datatype
For example:
DECLARE
vName varchar2(50):=’Er Gurpreet Singh’; - - Can store upto 50 characters only
BEGIN
dbms_output.put_line(‘Name: ‘||vName);
END;
/
4. P L / S Q L T u t o r i a l - B y E r G u r p r e e t S i n g h
Visit: http://gsbprogramming.blogspot.in
Will result:
Name: Er Gurpreet Singh
PL/SQL procedure successfully completed.
Boolean Data Type:
The BOOLEAN data type stores logical values that are used in logical operations. The logical values
are the Boolean values TRUE and FALSE and the value NULL. However, SQL has no data type
equivalent to BOOLEAN. Therefore, Boolean values cannot be used in:
o SQL statements
o Built-in SQL functions (such as TO_CHAR)
o PL/SQL functions invoked from SQL statements PL/SQL
Date datatype:
5. P L / S Q L T u t o r i a l - B y E r G u r p r e e t S i n g h
Visit: http://gsbprogramming.blogspot.in
Large Object (LOB) datatype- Large object (LOB) data types refer large to data items such as text,
graphic images, video clips, and sound waveforms.
Subtype: You can define and use your own subtype. For example:
DECLARE
SUBTYPE nameDataType IS varchar2(50); - - Define subtype
vName nameDataType:=’Er Gurpreet Singh’; - - Can store upto 50 characters only
BEGIN
dbms_output.put_line(‘Name: ‘||vName);
END;
/
Will result:
Name: Er Gurpreet Singh
PL/SQL procedure successfully completed.
Null data type: Null represent missing or unkown data. For example:
BEGIN
Null;
END;
/