Saturday , April 20 2024

Oracle PL/SQL Data Types and Variables and Literals

This article contains information about PL/SQL Data Types and Variables and Literals.

Oracle PL/SQL Data Types

Data types indicate how data is stored in memory.

PL / SQL has several data types to store data.

PL / SQL data types are divided into four sections: Scalar, Large Object, Composite and Refence.

1)Scalar Data Types in Oracle PL/SQL

Scalar data types is a data type that store a single data such as NUMBER, DATE, BOOLEAN.

Numeric Data Types in Oracle

PLS_INTEGER, BINARY_INTEGER, BINARY_FLOAT, BINARY_DOUBLE, NUMBER(prec, scale), DEC(prec, scale), DECIMAL(prec, scale), NUMERIC(pre, secale), DOUBLE PRECISION, FLOAT, INT, INTEGER, SMALLINT, REAL

Character Data Types in Oracle

CHAR, VARCHAR2, RAW, NCHAR, NVARCHAR2, LONG, LONG RAW, ROWID, UROWID

Boolean Data Types in Oracle

The BOOLEAN data type takes TRUE, FALSE and NULL.

Datetime Data Types in Oracle

DATE, TIMESTAMP, INTERVAL

2)Large Object Data Types in Oracle PL/SQL

Large Object data types are data types that store files such as text, images, and videos.

BFILE, BLOB, CLOB, NCLOB

3)Composite Data Types in Oracle PL/SQL

Composite data types are data types such as Collections and Records.

4)Reference Data Types in Oracle PL/SQL

The reference data type is the data type that refers to the previously defined data types.

NOTE: Some data types have the same feature.

User Defined Data Types in Oracle PL/SQL

We can define data types as follows.

Unnecessary length of data is prevented by using user-defined data types.

Also, developed PL/SQL programs are provided to be more meaningful.

Variables in Oracle PL/SQL

PL/SQL allows the use of variables to temporarily store data.

We can define a variable as follows.

Variables can be up to 30 characters long.

name_surname, v_name_surname

Variables must start with the ASCII character.

For example, a variable name cannot be 1_name_surname.

The keyword := and DEFAULT can be used to give initial values ​​to variables.

The NOT NULL keyword can be used so that variables do not take NULL.

The data type of the variable can be the data type of the column in the table.

The CONSTANT keyword can be used to make the variable constant.

Literals in Oracle PL/SQL

Literal values in PL/SQL are called literal.

‘Hello Oracle’

TRUE, FALSE, NULL

‘A’

You can find more detailed information about below topics in the below link.

PL/SQL Tutorial

You will find below topics in this article.

  1. What is PL/SQL
  2. Oracle PL/SQL Operators
  3. Oracle PL/SQL Conditional Statements
  4. Oracle PL/SQL Loops
  5. Oracle PL/SQL Procedures and Procedure Parameters
  6. Oracle PL/SQL Functions
  7. Oracle PL/SQL Cursor
  8. Oracle PL/SQL Records
  9. Oracle PL/SQL Exception
  10. Oracle PL/SQL Trigger
  11. Oracle PL/SQL Packages
  12. Oracle PL/SQL Collections

Also you can find more about data types at docs.oracle.com

Loading

About Yusuf SEZER

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories