What is pragma AUTONOMOUS_TRANSACTION in Oracle with example
The AUTONOMOUS_TRANSACTION pragma alters the behavior of a subprogram within a transaction, allowing it to perform SQL operations and commit or roll back those operations without affecting the data in the main transaction.
What is pragma in Oracle with example
A pragma, also known as a pseudo-instruction, is simply a directive to the compiler that passes information rather than transforming into a specific execution. The PRAGMA keyword is used to indicate that the remaining PL/SQL statement is a pragma.
What is pragma Serially_reusable and why is it used
The pragma SERIALLY_REUSABLE denotes that the package state is only required during a single call to the server, such as a PL/SQL anonymous block, an OCI call to the database, or a call to a stored procedure via a database link.
What is the difference between raise application error and pragma exception init
RAISE_APPLICATION_ERROR is used to return a valid error message to the calling application, such as Java, and EXCEPTION_INIT is used to assign a number to the exception that can be raised using RAISE and handled in the EXCEPTION block.
What is the first parameter of the pragma EXCEPTION_INIT function
The local variable deadlock_error serves as the first parameter for the pragma exception_init, and the error code -60 for the dead lock serves as the second parameter.
What is RAISE_APPLICATION_ERROR in PL SQL
You can report errors to your application and prevent returning unhandled exceptions by issuing user-defined ORA- error messages from stored subprograms using the procedure RAISE_APPLICATION_ERROR.
What is pragma in SQL
The SQLite-specific PRAGMA statement can be used to change how the SQLite library functions or to query the library for internal (non-table) data.
What is pragma Restrict_references in Oracle
Note: The RESTRICT_REFERENCES pragma is deprecated; Oracle suggests using DETERMINISTIC and PARALLEL_ENABLE in its place. It states that a user-defined subprogram does not read or write database tables or package variables.
What is the meaning of pragma
Compiler pragmas, also known as directives, allow you to give the compiler extra information that can change compilation details that are not otherwise under your control. For instance, the pack pragma affects the arrangement of data inside a structure.
How do you handle exceptions in PL SQL
A user-defined exception must be declared and then raised explicitly, using either a RAISE statement or the procedure DBMS_STANDARD. RAISE_APPLICATION_ERROR. PL/SQL allows you to define your own exceptions in accordance with the needs of your program.
What is the use of SAVE exception in Oracle
If you want the PL/SQL runtime engine to execute all DML statements generated by the FORALL, even if one or more of them fail with an error, add the SAVE EXCEPTIONS clause to your FORALL statement. If you use INDICES OF, you will need to take some care to find your way back to the offending statement.
What is ref cursor in Oracle with example
In essence, a REF CURSOR is a pointer or handle to a result set on the database. REF CURSORs are represented through the OracleRefCursor ODP.NET class. A REF CURSOR is a PL/SQL data type whose value is the memory address of a query work area on the database.
What is dynamic SQL in Oracle with example
Oracle provides two ways to implement dynamic SQL in a PL/SQL application: Native dynamic SQL, where you insert dynamic SQL statements directly into PL/SQL blocks.
How do I run a cursor in Oracle
How to use Explicit Cursor?
- The cursor says DECLARE in the Declaration section.
- OPEN the Execution Section with the cursor.
- In the Execution Section, FETCH the data from the cursor into PL/SQL variables or records.
- Before concluding the PL/SQL Block, CLOSE the cursor in the execution section.
What is Sqlcode and Sqlerrm in Oracle
The built-in error reporting functions in Oracle PL/SQL are called SQLCODE and SQLERRM. When an error occurs in PL/SQL at runtime, SQLCODE returns the number of the most recent error encountered, and SQLERRM returns the message associated with its error-number argument.
Can we use DDL statements in autonomous triggers
Autonomous triggers, in contrast to regular triggers, can issue DDL statements (such as CREATE and DROP) through the EXECUTE IMMEDIATE statement and contain transaction control statements (such as COMMIT and ROLLBACK).
Which pragma is used make a routine independent of main transaction
A routine is designated as autonomous—that is, separate from the primary transaction—by the pragma AUTONOMOUS_TRANSACTION.
What is collections in Oracle PL SQL
An ordered group of elements with the same data type is referred to as a collection. Each element is identified by a special subscript that denotes its place in the collection.