Udjuni.com

udjuni.com search:




PL/SQL code blocks


Like any procedural language, the basic unit of PL/SQL program is a block. Within those blocks you find statements that are executed as a unit. In PL/SQL, blocks are further classified into different categories that include;

  • Labeled blocks - this are used to give a certain code block a name. This also makes it very easy for other people to read your code. In general, these kind of blocks allows you to refer to variables that would otherwise be invisible.


  • Triggers - these are blocks that are associated with events that occurs in the database. In other words, the execution of code within these blocks is triggered by an event such as insertion of data, deletion or update of data on a specific data entity or table.


  • Procedures and functions - also known as subprograms. These are usually stored on the database as stand-alone objects, but some prefer to store them as part of a package. To see how a procedure or function is declared in PL/SQL, please refer to our posting PL/SQL variable and block structure.


  • Comments - these are bocks of text that are not executed. They are purely meant to help developers understand the code. In PL/SQL, comment blocks or multi-line comments are enclosed within (/*) and (*/) symbols; where /* marks the beginning of a comment and */ marks the end of a comment. For a single line comment, you can simply use -- at the beginning of the line to let the database system know not to try to execute the statement.



For some basic blocks such as the looping constructs, IF-THEN-ELSE, you can declare one block within another. These are known as nested blocks. However you can not define a procedure within another procedure or trigger within another trigger. What you can do instead is call the procedure from another and passing along applicable values to the called procedure.




RELATED ARTICLES:


Oracle Procedures, Functions and looping constructs
Procedures and functions in PL/SQL are types of blocks that are stored in the database in a compiled form. This is among the major differences between ordinary queries and procedures and functions (otherwise known as subprograms). Creating a function or procedure requires the u

Functions Notation


Array related PHP Functions
The PHP language has a lot of functions that are used to populate, retrieve and manipulate array variables. Bellow are some of those functions, we will be using some of them as we continue to learn. Functi

Functions in PHP
Just like we have learned in mathematics, the basic way to think of and understand functions is to think of it as a machine, you feed it with raw materials and the machine goes through processing these materials into finished and possibly usable product. An easy way to look at functions is to consid

Looping in PHP
In the posting “PHP flow control functions”, we covered how one can implement decision making in a PHP program, in which we covered validating predefine conditions and executing a certain portion of the program or script. Here, we are going to look at automating repetitive work. Say f

MySQL String functions
MySQL relational Database system has a lot of built-in functions, some of which are used to retrieve and manipulate data, while others are simply used for server administrative purposes. In this posting we will explore how String functions are used in MySQL. String length function

PHP Flow control functions


PHP String functions
So far we have only displayed strings directly to the browser without changing the format. We have successfully done that using the PHP echo () command. In addition to the echo () command, PHP also has two other print functions that allow users to format the output. The formatting may come in the fo

SQL Triggers
Most relational database servers provide a mechanism called triggers, for enforcing integrity constraints. Triggers are compiled once and are stored on the database server. Triggers are invoked when a particular action occurs on a particular table. Usually the ac

Trigonometry functions
Trigonometry is a branch of mathematics that deals with triangles. It is more like geometry, but it deals particularly with right angle triangles. The concept of trigonometry deals with the relationship between angles and sides of the triangle. To accurately descri

Did not find it? Try udjuni.com search:







© 2009 UdjunI LLC. All rights reserved | Privacy policy | Tutorial Index | RSS Feed