- A literal is a constant which represent fixed value.
Types
:
Ø Text
literal
Ø Number
literal
Ø Integer
literal
Ø Interval
literal
- Literal is printed for each row that is retrieved by select statement.
- Date and character literals must be enclosed in single quote (‘).
- Literals increase the readability of the output.
Examples
:=
Select ename ‘ is designated as ‘
from emp;
Select ‘ I am a ‘ boy from dual;
(Here I am a is Literal and boy is an alias.
Select ename, ‘ is designated as ‘
, job from emp;
Select ename || ‘ is designated as
‘ || job from emp; ( Columns on either side of || operator are combine to make
a single column )
Note
: Where we use a literal, there we will use a
concatenation operator (||).
Select ename ‘ ‘’s designation is
‘|| job || ‘ working for department ‘ || dept from emp;
Select ename || ‘ ‘’s salary is ‘
|| sal || ‘ with commission : ‘ || comm from emp;
No comments:
Post a Comment