Data Types in Sql/Plsql
PL/SQL Data Types
Data Type tells about the type of data and, how the data is stored, what values can be used and what are the operations to be used.
In PL/SQL, every value like constant, parameter and variable has a data type. In PL/SQL, there are four different data types namely, Scalar, Composite, LOB, and reference. learn on sql through sql online training
- Scalar Datatype: These stores only one value like Boolean, number, DateTime, and character. These are divided into four groups like character, numeric, Boolean and DateTime.
- Composite Datatype: These stores more than one value like collection and record.
- LOB(Long Object) Datatype: These store locations of large objects like graphic images, text blocks that are saved in other databases. BFILE, BLOB, CLOB, and NCLOB are the LOB types.
- Reference Datatype: These store pointer values that point to other items. They are REF, REFS, and CURSORS.
Sometimes, Scalar data type may also have Subtypes. A subtype is a part of another data type, that is its base type. The base type is defined by the subtype, by limiting the value or length of the base data type.
Get siva prasad’s stories in your inbox
Join Medium for free to get updates from this writer.
PL/SQL scalar datatypes have SQL data types and their data types like Boolean. For instance, Integer is the subtype of the data type number. Then, you can use the subtypes, to make suitable with other program data types, when we insert the PL/SQL commands in other programs like java program.
Now, let us take some of the datatypes. you can also refer the important pl sql interview questions which will be helpful for interview
Character Data Type:
In this, alphanumeric characters are stored in string format. Generally, when a value is assigned to a character data type, it is represented in quotes. Below are different character datatypes used in PL/SQL
- RAW — binary or byte string variable-Length with the highest size of 32,767 bytes.
- CHAR:- Fixed-length character with size from 1 to 32,767 bytes.
- ROWID :- Physical row identifier, location of a row in a table.
- UROWID:- universal row identifier
- VARCHAR2:- character data varied-length, the length is from 1 to 32,767 bytes.
- LONG :- string with variable length character, with a maximum length of 32,760 bytes.
- NCHAR:- It has a maximum size of 32,767 bytes, string with fixed length national character
- NVARCHAR2:- It has a maximum size of 32,767, string with variable length national character.
To-get depth knowledge on sql through sql course from experienced professionals









