09. TCL COMMANDS And LITERALS

     TCL COMMANDS:
TCL: Transaction control language.
  •     Commit
  •     Roll Back
  •     Save Point

          Commit:
ü It makes temporary transaction permanent
ü It empties the buffer memory area
ü A SCN number get generated for each of the transaction (or) for every commit
ü It makes temporary piece of work as permanent

 Roll Back
ü It cancels the transaction or piece of work
ü It also empties the buffer memory area permanently
ü Partial roll backing is also possible with the help of save point.

Save Point:
ü It is a mark which specifies teset of statements or piece of work.

Note:
ü It is not possible to nest the transactions directly but by using some other means (program autonomous transaction) it is possible.

ü A DDL command also makes the above temporary work permanent while becoming permanent.

LITERALS
Literals are predefined values or constants identified by oracle server

Types of literals:

          1) Number literals:
                             USAGE: 1, 10,

              EG:  SELECT 1 FROM DUAL;

           2) String literals: anything enclosed in quotes is considered string:
                             USAGE: ‘A’,’10’,’13-SEP-13’

              EG:  SELECT ‘A’,’10’,’13-SEP-13’ FROM DUAL;

3) Date literals:
                             USAGE:  DATE ‘YYYY-MM-DD’

             EG:  SELECT DATE ’2013-09-13’ FROM DUAL;

             EG:  SELECT DATE ’2013-09-13’+1 FROM DUAL

4) Timestamp literal:

              USAGE:  TIMESTAMP ‘YYYY-MM-DD HH: MI: SS.FF’

               EG: SELECT TIMESTAMP ‘2013-06-10 10:10:10.10  FROM  DUAL;

 5) Timestamp with time zone literal:

              USAGE:  TIMESTAMP ‘YYYY-MM-DD HH: MI: SS.FF +TZH: TZM’;

EG: SELECT TIMESTAMP '2012-09-10 10:10:10.000 +05:30'  FROM DUAL;

           6) Interval Literals:

a) Interval year to month literals:

              USAGE: INTERVAL ‘YY-MM’ YEAR TO MONTH;
             
               EG: SELECT INTERVAL '10-10' YEAR TO MONTH FROM DUAL;

b) Interval day to second:

                   USAGE: INTERVAL ‘DD   HH: MI: SS.FF DAY TO SECOND;

                 EG: SELECT INTERVAL '10 10:10:10.1000' DAY TO SECOND FROM
                                                                                                         DUAL;




2 comments: