Ticker

6/recent/ticker-posts

PL/SQL Data Types

 

The default data types that can be declared in PL/SQL are number (for storing numeric data), char for storing character data), date (for storing date and time data), Boolean (for storing TRUE, FALSE or NULL), number, char and date data types can have NULL values.

% TYPE declares a variable or constant to have the same datatype as that of a previously defined variable or of a column in a table or in a view. When referencing a table, one may name the table and column, or owner of the table and column.

NOT NULL causes creation of a variable or a constant that cannot have a value. If you attempt to assign the value NULL to a variable or a constant that has been assigned a NOT NULL constraint, it is an exception that Oracle senses automatically and an internal error condition is returned. pusQL. variables and constants have data types. The data type specifies a storage format, constraint and a valid range of values. The following are the PL/SQL data types:

1) Scalar Data Types (Numeric Data Types): BINARY_INTEGFZ, DEC, DECIMAL, DOUBLE PRECISION. FLOAT, INT, INTEGER. NATURAL, NATURALN1, NUMBER, NUMERIC, PLSINTEGER, POSITIVE, POSITIVEN, REAL, SIGNTYPE and SMALLINT.

2) Scalar Data Types (Character Data Types): CHAR, CHARACTER, LONG, NCHAR, NVARCHAR2, STRING, VARCHAR and VARCHAR2

3) Scalar Data Types (Boolean Data Types): BOOLEAN

4) Scalar Data Types (Pate Data Types): DATE

5) Scalar Data Types (Raw Data Types): RAW, LONG RAW

6) Scalar Data Types (Rowid Data Types): ROWID

7) Composite Data Types: RECORD, TABLE, VARRAY

8) Reference Data types: REF CURSOR, REF object type

9) LOB Data Types: BFILE, LOB, CLOB, NLOB