Signos Mayor y Menor
Signos Mayor y Menor
Declarations
1
This section starts with the keyword DECLARE. It is an optional section and defines
all variables, cursors, subprograms, and other elements to be used in the program.
Executable Commands
This section is enclosed between the keywords BEGIN and END and it is a
2 mandatory section. It consists of the executable PL/SQL statements of the program.
It should have at least one executable line of code, which may be just a NULL
command to indicate that nothing should be executed.
Exception Handling
3 This section starts with the keyword EXCEPTION. This section is again optional and
contains exception(s) that handle errors in the program.
Every PL/SQL statement ends with a semicolon (;). PL/SQL blocks can be nested within other
PL/SQL blocks using BEGIN and END. Here is the basic structure of a PL/SQL block:
DECLARE
<declarations section>
BEGIN
<executable command(s)>
EXCEPTION
<exception handling>
END;
BEGIN
dbms_output.put_line(message);
END;
The end; line signals the end of the PL/SQL block. To run the code from SQL command line, you
may need to type / at the beginning of the first blank line after the last line of the code. When the
above code is executed at SQL prompt, it produces the following result:
Hello World
By default, identifiers are not case-sensitive. So you can use integer or INTEGER to represent a
numeric value. You cannot use a reserved keyword as an identifier.
Delimiter Description
% Attribute indicator
. Component selector
, Item separator
" Quoted identifier delimiter
= Relational operator
; Statement terminator
:= Assignment operator
|| Concatenation operator
** Exponentiation operator
.. Range operator
The PL/SQL supports single-line and multi-line comments. All characters available inside any
comment are ignored by PL/SQL compiler. The PL/SQL single-line comments start with the
delimiter -- (double hyphen) and multi-line comments are enclosed by /* and */.
DECLARE
-- variable declaration
BEGIN
/*
*/
dbms_output.put_line(message);
END;
When the above code is executed at SQL prompt, it produces the following result:
Hello World
http://www.tutorialspoint.com/plsql/plsql_basic_syntax.htm