Explain the Rollback statement?

The Rollback statement is issued when the transaction ends. Following conditions are true for a Rollback statement: The work done in a transition is undone as if it was never issued. All locks acquired by transaction are released. In PL/SQL (Procedural Language/Structured Query Language), the ROLLBACK statement is used to undo the changes made in … Read more

Explain the Commit statement.

Following conditions are true for the Commit statement: Other users can see the data changes made by the transaction. The locks acquired by the transaction are released. The work done by the transaction becomes permanent. In PL/SQL (Procedural Language/Structured Query Language), the COMMIT statement is used to make the changes performed in the current transaction … Read more

What is the difference between syntax error and runtime error?

A syntax error can be easily detected by a PL/SQL compiler. For example: incorrect spelling etc. while, a runtime error is handled with the help of exception-handling section in a PL/SQL block. For example: SELECT INTO statement, which does not return any rows. In PL/SQL, as in many programming languages, the difference between syntax error … Read more

What are the cursor attributes used in PL/SQL?

%ISOPEN: it checks whether the cursor is open or not. %ROWCOUNT: returns the number of rows affected by DML operations: INSERT,DELETE,UPDATE,SELECT. %FOUND: it checks whether cursor has fetched any row. If yes – TRUE. %NOTFOUND: it checks whether cursor has fetched any row. If no – TRUE. In PL/SQL, cursor attributes are used to get … Read more

What are the advantages of stored procedure?

Modularity, extensibility, reusability, Maintainability and one time compilation. Stored procedures in PL/SQL offer several advantages: Modularity and Reusability: Stored procedures allow you to encapsulate a set of SQL statements into a single named unit, making the code modular and reusable. Once created, a stored procedure can be called from different parts of a program or … Read more