Home / Interview / PL/SQL :: General Questions

Interview :: PL/SQL

31) What will you get by the cursor attribute SQL%FOUND?

It returns the Boolean value TRUE if at least one row was processed.

32) What will you get by the cursor attribute SQL%NOTFOUND?

It returns the Boolean value TRUE if no rows were processed.

33) What do you understand by PL/SQL packages?

A PL/SQL package can be specified as a file that groups functions, cursors, stored procedures, and variables in one place.

34) What are the two different parts of the PL/SQL packages?

PL/SQL packages have the following two parts:

Specification part: It specifies the part where the interface to the application is defined.

Body part: This part specifies where the implementation of the specification is defined.

35) Which command is used to delete a package?

The DROP PACKAGE command is used to delete a package.

36) How to execute a stored procedure?

There are two way to execute a stored procedure.

From the SQL prompt, write EXECUTE or EXEC followed by procedure_name.

Simply use the procedure name

37) What are the advantages of stored procedure?

Modularity, extensibility, reusability, Maintainability and one time compilation.

38) 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.

39) 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.

40) 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.