What Are the Types PL/SQL Code Blocks?
SQL tutorial | Interview questions | Oracle :: Interview questions :: Introduction to PL/SQL | Interview questions
Page 1 of 1
What Are the Types PL/SQL Code Blocks?
There are 3 types of PL/SQL code blocks:
Anonymous Block - A block of codes with no name. It may contain a declaration part, an
execution part, and exception handlers.
Stored Program Unit - A block of codes with a name. It is similar to an anonymous block. But it
can take parameters and return values.
Trigger - A block of code that can be defined to fire based an specific event.
How To Define an Anonymous Block?
An anonymous block must have an execution part, which is a group of other PL/SQL statements
enclosed in the BEGIN ... END statement. Here is a script on how to define a simple anonymous
block with SQL*Plus:
SQL> set serveroutput on;
SQL> begin
2 dbms_output.put_line('Hello world!');
3 end;
4 /
Hello world!
PL/SQL procedure successfully completed.
"set serveroutput on;" allows dbms_output.put_line() to work.
"/" runs the anonymous block, which print the "Hello world!" message.
Anonymous Block - A block of codes with no name. It may contain a declaration part, an
execution part, and exception handlers.
Stored Program Unit - A block of codes with a name. It is similar to an anonymous block. But it
can take parameters and return values.
Trigger - A block of code that can be defined to fire based an specific event.
How To Define an Anonymous Block?
An anonymous block must have an execution part, which is a group of other PL/SQL statements
enclosed in the BEGIN ... END statement. Here is a script on how to define a simple anonymous
block with SQL*Plus:
SQL> set serveroutput on;
SQL> begin
2 dbms_output.put_line('Hello world!');
3 end;
4 /
Hello world!
PL/SQL procedure successfully completed.
"set serveroutput on;" allows dbms_output.put_line() to work.
"/" runs the anonymous block, which print the "Hello world!" message.
Similar topics
» How Many Anonymous Blocks Can Be Defined?
» How Many Data Types Are Supported?
» SQL Oracle data types
» How Many Categories of Data Types?
» What is a join and explain different types of joins.
» How Many Data Types Are Supported?
» SQL Oracle data types
» How Many Categories of Data Types?
» What is a join and explain different types of joins.
SQL tutorial | Interview questions | Oracle :: Interview questions :: Introduction to PL/SQL | Interview questions
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Sun Jan 31, 2010 12:35 am by Micheal
» Accessing tables of other users in SQL
Sun Jan 31, 2010 12:34 am by Micheal
» Grouping commands in SQL
Sun Jan 31, 2010 12:32 am by Micheal
» Operations on Result Sets in SQL
Sun Jan 31, 2010 12:31 am by Micheal
» Subqueries in SQL
Sun Jan 31, 2010 12:30 am by Micheal
» Joining Relations in SQL
Sun Jan 31, 2010 12:28 am by Micheal
» Delete comand in SQL
Sun Jan 31, 2010 12:27 am by Micheal
» Update command in SQL
Sun Jan 31, 2010 12:26 am by Micheal
» Insert command in SQL
Sun Jan 31, 2010 12:23 am by Micheal