This article is written about how to use literals (text, integer, and number) in Oracle with examples.
In Oracle, a literal is the same as a constant. We’ll cowl four types of literals – textual content literals, integer literals, number, and date/time literals.
Text literals are always surrounded by way of single prices (‘).
'Hewlett Packard' '28-MAY-03'
Integer literals can be up to 38 digits. Integer literals can be both positive numbers or negative numbers. If you do no longer specify a sign, then a positive number is assumed. Here are some examples of valid integer literals:
23 +23 -23
Number literals can be up to 38 digits. Number literals can be either effective or poor numbers. If you do not specify a sign, then a high quality number is assumed. Here are some examples of legitimate number literals:
25 +25 -25 25e-04 25.607
Date and time are enclosed in single quotes (‘).
'2015-04-30' '2015-04-30 08:13:24'
When dealing with date/time values, you will favor to use the TO_DATE feature to convert a literal to a date.
SELECT TO_DATE('2015/04/30', 'yyyy/mm/dd') FROM dual;
This instance will take a literal value of ‘2015/04/30’ and convert it to a date.