www.bullraider.com

LITERALS

AddThis Social Bookmark Button

The terms literal and constant value are synonymous and refer to a fixed data value  .

Types of Literals

  1. Text Literals
  2. Integer Literals
  3. Number Literals
  4. Interval Literals
  5. Datetime Literals

Character in the literal

Example:

'Hello’

’Bob’’Home'

'Data.Warehousing'

Integer Literals

An integer can store a maximum of 38 digits of precision.
Examples of valid integers
-131
+255
98

Number Literals

Here are some valid NUMBER literals:

43
+6.34
0.5
235e-02
-14

Interval Literals
INTERVAL YEAR TO MONTH
EXAMPLE:INTERVAL ’123-2’ YEAR(3) TO MONTH
You can add or subtract one INTERVAL YEAR TO MONTH literal to or  INTERVAL YEAR TO MONTH literal.
For example:
INTERVAL ’7-3’ YEAR TO MONTH + INTERVAL’20’ MONTH =
INTERVAL ’5-10’ YEAR TO MONTH
INTERVAL DAY TO SECOND
EXAMPLES
INTERVAL ’9 6:12:10.112’ DAY TO SECOND(4)
INTERVAL ’9 6:12’ DAY TO MINUTE

Datetime Literals
Oracle Database supports four datetime datatypes: DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE.
DATE '1998-12-25'
TO_DATE('2012-DEC-25 17:30','YY-MON-DD HH24:MI')

 

 


Powered by Bullraider.com