Print      Open PDF Version of Online Help

Previous Topic

Next Topic

Expressing Literals

A literal is a nonnull value corresponding to a given data type. Literals are typically constant values; that is, they are values that are taken literally as is, without changing them at all. A literal value has to comply with the data type it represents.

This section describes how to express each type of literal in Oracle CRM On Demand Answers.

Character Literals

A character literal contains characters such as letters, numbers and symbols. To express a character literal, surround the character string with single quotes ( ' ). The length of the literal is determined by the number of characters between the single quotes.

Datetime Literals

The SQL 92 standard defines three kinds of typed datetime literals, in the following formats:

DATE 'yyyy-MM-dd'

TIME 'hh:MM:ss'

TIMESTAMP 'yyyy-MM-dd hh:mm:ss'

These formats are fixed. To express a typed datetime literal, use the keywords DATE, TIME, or TIMESTAMP followed by a datetime string enclosed in single quote marks. Two digits are required for all non-year components even if the value is a single digit.



WHEN Opportunity."Close Date" >= TIMESTAMP '2006-01-01 00:00:00' THEN '2006'

ELSE 'Pre-2006'


Numeric Literals

A numeric literal represents a value of a numeric data type. To express a numeric literal, simply include the number.

Do not surround numeric literals with single quotes; doing so expresses the literal as a character literal.

A number can be preceded with either a plus sign (+) or minus sign (-) to indicate a positive or negative number, respectively. Numbers can contain a decimal point and decimal numbers.

To express floating point numbers as literal constants, enter a number followed by the letter E (either uppercase or lowercase) and followed by the plus sign (+) or the minus sign (-) to indicate a positive or negative exponent. No spaces are allowed between the integer, the letter E, and the sign of the exponent.






Published 5/4/2012 Copyright © 2005, 2012, Oracle. All rights reserved. Legal Notices.