Oracle SQL - Introduction Variables

Introduction

A variable is a value that may have a varying value over time.

A variable has a name, so you can refer to it.

SQL supports two types of variables:

  • Column name variables: The name of a column stays the same, but its value typically varies from row to row while scanning a table.
  • System variables: They are commonly referred to as pseudo columns.

Examples of Oracle System Variables (Pseudo Columns)

Variable Description
SYSDATE The current system date in the database
CURRENT_DATE The current date at the client application side
SYSTIMESTAMP The system date and exact time, with time zone information
LOCALTIMESTAMPThe system date and exact time, with time zone information, at the client application side
USER The name used to connect to the database