Lexical unit in PL/SQL

Lexical unit can be classified as


  • Delimiters
  • Identifiers
  • Literals
  • Comments

Delimiters in PL/SQL


Symbol Meaning
+ addition operator
% attribute indicator
character string delimiter
. component selector
/ division operator
( expression or list delimiter
) expression or list delimiter
: host variable indicator
, item separator
* multiplication operator
quoted identifier delimiter
= relational operator
< relational operator
> relational operator
@ remote access indicator
; statement terminator
subtraction/negation operator
:= assignment operator
=> association operator
|| concatenation operator
** exponentiation operator
<< label delimiter (begin)
>> label delimiter (end)
/* multi-line comment delimiter (begin)
*/ multi-line comment delimiter (end)
.. range operator
<> relational operator
!= relational operator
~= relational operator
^= relational operator
<= relational operator
>= relational operator
single-line comment indicator

 

Identifier in PL/SQL


PL/SQL is not case sensitive with respect to identifies

v_first_name

v_perc

V_LAST_NAME

 

Literal in PL/SQL


Alex, 428, True,

 

Comments in PL/SQL


Single line comment

Prefix single-line comments with two hyphens (–).

Example:

-- This is Simple Procedure
Create or Replace procedure test
IS
BEGIN
dbms_output.put_line('Hi This is Bhavesh Lakhani');
END test;

Multi line comment

Place multiple-line comments between the symbols /* and */


DECLARE
v_annual_salary NUMBER (9,2);
BEGIN
/*

Compute the annual salary based on the
monthly salary input from the user

*/
v_annual_salary:= monthly_salary * 12;
--The following line displays the annual salary DBMS_OUTPUT.PUT_LINE(v_annual_sal);
END;

Leave a Reply

Your email address will not be published. Required fields are marked *