| 0 comments ]

Character Set:

i) PL/SQL program are written as lines of text using a specific set of characters.
ii) The characters that can be used are
   -> A-Z or a-z
   -> 0-9
   -> () + - * / < > = ! ~ ^ : . ' @ % . " # $ & - ! { } ? [ ]
   -> Tabs, Spaces and Carriage Returns
iii) PL/SQL key words are not case sensitive, hence lower case letters are equivalent to corresponding upper case letters.

Lexical Units:

i) A group of characters that are contained within a line of PL/SQL statement are called as Lexical Units.
ii) The types of Lexical Units are
    -> DELIMITERS
    -> IDENTIFIERS
    -> LITERALS
    -> COMMENTS

Delimiters:

i) It is a simple or compound syntax that has special meaning to PL/SQL.
ii) The Delimiters are used to represent arithmetic operations etc.

Identifiers:

i) They are used to name PL/SQL program items and units.
ii) Identifiers can include

        * Constants  * Variable  * Exception  * Cursor Variables  * Subprograms  * Packages.

iii) An identifiers consists of a letter followed by a set of letters, numerals, dollars signs etc.,.

            *&  *-  */  *''

iv)      Valid Identifiers:                 Invalid Identifiers:
         =================                 ====================
           
                X                                This & That
                P2                               You-me
                V_phone#                         Show/off
                V-phone$Number                   Emp Name

v) Identifiers are not case sensitive, until they are not declared within single quotes.
vi) An identifier length cannot exceed 30 characters.


RESERVED WORDS:

i) Reserved Words have special syntactic meaning to PL/SQL.
ii) Reserved Words can be used in combination with other words for declaration.
iii) It is Better to represent reserved words in upper casing.

PREDEFINED IDENTIFIERS:

i) The identifiers globally declared in packages STANDARD can be redeclared.
ii) Declaring predefined identifiers again is error prone as the local declaration overrides the global declaration.

QUOTED IDENTIFIERS:


i) Identifiers declared in double quotes are called Quoted Identifiers.
ii) The Maximum size of a Quoted identifier cannot exceed 30 characters.
iii) Using PL/SQL reserved words as Quoted Identifiers is not advisable.
       Example:  "Employees(s)"
                 "Status On/Off"

LITERALS:

i) A Literals is an explicit Numeric, Character, String or Boolean value not represented by an Identifier.

NUMERIC LITERALS:

a) They are of two types: Integers & Real's.
b) An Integer literal is an optionally signed whole number without a decimal point.
       Example: 030, 8, -180, +56798.
c) A Real literal is optionally signed whole or Fractional number with a decimal point.
       Example : 6.6667, 0.0, -12.0, 3.14, .5, 25.
d) Numeric literals cannot contain dollar signs or columns, but can be written using scientific notation.
e) The double asterisk operator(**) is the Exponentiation operator.
f) If the value of a Numeric literals fails outside the range, it generates compilation error.
    Example:
          DECLARE
              MyNumber NUMBER;
          BEGIN
          MyNumber:=10E127;
          END; /* The Range is 1E-130 .. 10E125*/
g) Real literals can use the trailing letters f and d to specify the BINARY_FLOAT and BINARY_DOUBLE.
       Example:
          DECLARE
              MyFloat  BINARY_FLOAT:= SQRT(2.of);
              MyDouble BINARY_DOUBLE:=SQRT(2.od);
          BEGIN
              NULL;
          END;

CHARACTER LITERALS:

a) It is an individual character enclosed by single quotes.
b) In include all printable character in the PL/SQL character set.
         Example: 'A', 'C', 'a', '7'.
c) Character literals are case sensitive.
d) Character literals in the form of number is not equivalent to integer.
e) Even though pure character literals declared only with numbers are implicitly converted, it is better to use explicit conversion.


STRING LITERALS:

a) A String Literal is a sequence of zero or more characters enclosed by single quotes.
b) All string literals except the NULL string ' ' have datatype CHAR.
c) Top represent an apostrophe within a string declare two single quotes.
          Example:      'I am in, Oracle!'
                        '02-10-83'
                        'It is "So Sunny Outside."'
                        'Your's "Association President."'
d) To implement single quotation marks with easiness, select any character that is not a part of the string and declare the style.
          Example:    Q '!.........!'
                      Q '! We 're a group, in Your's group !"

BOOLEAN LITERALS:

a) They are predefined values TRUE,FALSE and NULL.
b) BOOLEAN LITERALS are values, but not strings.

DATATIME LITERALS:


a) A DATATIME Literals can have various formats depending on the datatype.
  Example:   DATE '1998-12-25';
             TIMESTAMP '1997-10-22 01:05:21';

COMMENTS IN PL/SQL:

a) PL/SQL compiler ignores comments.
b) Comments promote readability and aids understanding.
c) PL/SQL supports two styles.
       -> SINGLE LINE Comments(--)
       -> MULTI- LINE Comments(/*.....*/)
d) Comments should appear within a statement at the end of a line.
e) Comments cannot be nested.
f) It is must preferable to use multi-line comments rather than single line comments.

0 comments

AddThis

| More
Widget By Devils Workshop