Oracle PL/SQL Data Types: Boolean, Number, Date (Example) PL/SQL Tutorials
Oracle PL/SQL Data Types: Boolean, Number, Date (Example) PL/SQL Tutorials
2) SQL Vs PL/SQL Vs T-
A data type is associated with the
SQL
specific storage format and range
constraints. In Oracle, each value or 3) Blocks in PL/SQL
9) Decision Making
Statements
The literal values should always be enclosed in single quotes while assigning them to
CHARACTER data type.
A NUMBER(8,2);
B NUMBER(8);
C NUMBER;
Syntax Explanation:
In the above, the first declaration declares the variable 'A' is of number data type
with total precision 8 and decimal digits 2.
The second declaration declares the variable 'B' is of number data type with total
precision 8 and no decimal digits.
The third declaration is the most generic, declares variable 'C' is of number data
type with no restriction in precision or decimal places. It can take up to a maximum
of 38 digits.
Var1 BOOLEAN;
Syntax Explanation:
In the above, variable 'Var1' is declared as BOOLEAN data type. The output of the
code will be either true or false based on the condition set.
The standard Oracle time format for input and output is 'DD-MON-YY' and it is again
set at NLS_PARAMETERS (NLS_DATE_FORMAT) at the session level.
newyear DATE:='01-JAN-2015';
current_date DATE:=SYSDATE;
Syntax Explanation:
In the above, variable 'newyear' is declared as DATE data type and assigned the
value of Jan 1st, 2015 date.
The second declaration declares the variable current_date as DATE data type and
assigned the value with current system date.
Both these variable holds the time information.
The number of column in a table with LONG data type is limited to 1, whereas a
table has no restriction on a number of columns with LOB data type.
The data interface tool accepts LOB data type of the table during data replication,
but it omits LONG column of the table. These LONG columns need to be replicated
manually.
The size of the LONG column is 2GB, whereas LOB can store up to 128 TB.
Oracle is constantly improving the LOB data type in each of their releases according
to the modern requirement, whereas LONG data type is constant and not getting
many updates.
So, it is always good to use LOB data type instead of the LONG data type. Following are
the different LOB data types. They can store up to the size of 128 terabytes.
1. BLOB
2. CLOB and NCLOB
3. BFILE
BFILE
BFILE are the data types that stored
the unstructured binary format data
outside the database as an operating-
system file.
The size of BFILE is to a limited
operating system, and they are read-
only files and can't be modified.
Summary
We have covered the different simple data types that are available in PL/SQL along
with their syntax. We will learn about complex data types in further topics.
Oracle SQL Vs
PL/SQL PL/SQL
Records Vs T-SQL:
Type with Key
Examples
What is Record Type? A Di erences Autonomous Transaction
Record type is a complex SQL is the standard in Oracle PL/SQL:
Commit, Rollback
data type which allows language to query a
What are TCL Statements
the programmer to create database. PL SQL
in PL/SQL? TCL stands for
a... basically stands for
Transaction Control
Read more » "Procedural Language...
Statements. It will either
Read more »
save...
Read more »
Top Tutorials
About
About Us
Advertise with Us
Write For Us
Selenium Testing Hacking
Contact Us
Career Suggestion
SAP Career Suggestion Tool
Software Testing as a Career
Interesting
eBook SAP Java Python
Blog
Quiz
SAP eBook
Execute online
Execute Java Online
Execute Javascript
Execute HTML
Execute Python
Jmeter Informatica JIRA