PL/SQL Interview Questions
- Which of the following statements is true about implicit cursors?
- Implicit cursors are used for SQL statements that are not named.
- Developers should use implicit cursors with great care.
- Implicit cursors are used in cursor for loops to handle data processing.
- Implicit cursors are no longer a feature in Oracle.
- Which of the following is not a feature of a cursor FOR loop?
- Record type declaration.
- Opening and parsing of SQL statements.
- Fetches records from cursor.
- Requires exit condition to be defined.
- A developer would like to use referential datatype declaration on a variable. The variable name is EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE, and LNAME, respectively. How would the developer define this variable using referential datatypes?
- Use employee.lname%type.
- Use employee.lname%rowtype.
- Look up datatype for EMPLOYEE column on LASTNAME table and use that.
- Declare it to be type LONG.
- Which three of the following are implicit cursor attributes?
- %found
- %too_many_rows
- %notfound
- %rowcount
- %rowtype
- If left out, which of the following would cause an infinite loop to occur in a simple loop?
- LOOP
- END LOOP
- IF-THEN
- EXIT
- Which line in the following statement will produce an error?
- cursor action_cursor is
- select name, rate, action
- into action_record
- from action_table;
- There are no errors in this statement.
- The command used to open a CURSOR FOR loop is
- open
- fetch
- parse
- None, cursor for loops handle cursor opening implicitly.
- What happens when rows are found using a FETCH statement
- It causes the cursor to close
- It causes the cursor to open
- It loads the current row values into variables
- It creates the variables to hold the current row values
- Read the following code:
CREATE OR REPLACE PROCEDURE find_cpt (v_movie_id {Argument Mode} NUMBER, v_cost_per_ticket {argument mode} NUMBER) IS BEGIN IF v_cost_per_ticket > 8.5 THEN SELECT cost_per_ticket INTO v_cost_per_ticket FROM gross_receipt WHERE movie_id = v_movie_id; END IF; END;Which mode should be used for V_COST_PER_TICKET?
- IN
- OUT
- RETURN
- IN OUT
- Read the following code:
CREATE OR REPLACE TRIGGER update_show_gross {trigger information} BEGIN {additional code} END;The trigger code should only execute when the column, COST_PER_TICKET, is greater than $3. Which trigger information will you add?
- WHEN (new.cost_per_ticket > 3.75)
- WHEN (:new.cost_per_ticket > 3.75
- WHERE (new.cost_per_ticket > 3.75)
- WHERE (:new.cost_per_ticket > 3.75)























