0% found this document useful (0 votes)
38 views

Exception - Init: The Pragma Associates An Exception Name With An Oracle Error Number

The document discusses three Oracle pragmas: EXCEPTION_INIT associates an exception name with an Oracle error number. RESTRICT_REFERENCES checks if a stored function obeys purity rules to be callable from SQL. SERIALLY_REUSABLE indicates a package state is only needed for a single call, allowing memory reuse. It also mentions using SQL Loader to load data from a file into a table.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Exception - Init: The Pragma Associates An Exception Name With An Oracle Error Number

The document discusses three Oracle pragmas: EXCEPTION_INIT associates an exception name with an Oracle error number. RESTRICT_REFERENCES checks if a stored function obeys purity rules to be callable from SQL. SERIALLY_REUSABLE indicates a package state is only needed for a single call, allowing memory reuse. It also mentions using SQL Loader to load data from a file into a table.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

The pragma EXCEPTION_INIT associates an exception name with an Oracle error number.

cursor c_lock is select ename from emp for update of ename nowait ; r_lock c_lock%rowtype; e_resource_busy exception; pragma exception_init(e_resource_busy,-54); begin open c_lock; .. do something... exception when <b>e_resource_busy</b> then ... ORA-00054 has occurred; table is locked.

end;
RESTRICT_REFERENCES Pragma To be callable from SQL statements, a stored function must obey certain "purity" rules, which are meant to control side effects. (See "Controlling Side Effects of PL/SQL Subprograms".) If any SQL statement inside the function body violates a rule, you get an error at run time (when the statement is parsed). To check for violations of the rules, you can use the pragma (compiler directive) RESTRICT_REFERENCES. The pragma asserts that a function does not read and/or write database tables and/or package variables. SERIALLY_REUSABLE Pragma The pragma SERIALLY_REUSABLE indicates that the package state is needed only for the duration of one call to the server (for example, a PL/SQL anonymous block, an OCI call to the database or a stored procedure call through a database link). After this call, the storage for the package variables can be reused, reducing the memory overhead for long-running sessions.

SQL LOADER:
load data infile '/home/ramesh/employee.txt' into table employee fields terminated by ","

( id, name, dept, salary )

You might also like