Wednesday, December 31, 2008

PL/SQL compiler directives



As of the current release of PL/SQL, we have 4 directives

1)AUTONOMOUS_TRANSACTION.
2)RESTRICT_REFERENCES
3)EXCEPTION_INIT.
4)SERIALLY_REUSABLE.



AUTONOMOUS_TRANSACTION:
A subprogram marked with this pragma can do SQL operations and commit or roll back those operations, without committing or rolling back the data in the main transaction.

RESTRICT_REFERENCES:
To be callable From SQL statements, a stored function must obey certain purity rules, which control side-effects. If any SQL statement inside the function body violates a rule, you get an error at run time. You can declare the pragma RESTRICT_REFERENCES only in a package spec or object type spec.

EXCEPTION_INIT:
The pragma EXCEPTION_INIT associates an exception name with an Oracle error number.A pragma is an instruction to the Oracle compiler that tells it to do something. In this case you are telling Oracle to associate an error that you choose to a variable that you choose

SERIALLY_REUSABLE:
The pragma SERIALLY_REUSABLE indicates that the package state is needed only for the duration of one call to the server. An example could be an OCI call to the database or a stored procedure call through a database link. PRAGMA
Signifies that the statement is a pragma (compiler directive). Pragmas are processed at compile time, not at run time

1 comment:

Anonymous said...

Rich and Good Article