Oracle PL/SQL Database Fundamentals
Test your knowledge of Oracle database concepts including PL/SQL programming, stored procedures, functions, cursors, exceptions, triggers, packages, and database constraints
Questions
Query to view installed Oracle version information ?
- 1. select banner from v$version;
- 2. select version from v$instance;
- 3. select version from v$version;
- Both 1 and 2
- Both 2 and 3
Which is not a valid PL/SQL Exception ?
- Too_many_rows
- No_Data_Found
- Divide_Error
- Zero_Error
Which is not a valid PL/SQL Cursor Exceptions?
- Cursor_Already_Open
- Cursor_Not_Closed
- Invalid_Cursor
- None of the Above
Which one is not a valid pseudo-columns?
- USER
- UID
- CURVAL
- All are valid
What is correct regarding output of SIGN function?
- >0 for positive value
- 0 for positive value
- 0 for negative value
- 1 for positive value
The command used to open a CURSOR FOR loop is
- open
- fetch
- parse
- None
Which procedure can be used to create a customized error message?
- RAISE_ERROR
- SQLERRM
- RAISE_APPLICATION_ERROR
- RAISE_SERVER_ERROR
What happens when rows are found using a FETCH statement ?
- It causes the cursor to close
- It loads the current row values into variables
- It causes the cursor to open
- It creates the variables to load the values
Which two statements are true? (Choose two)
- a) A function must return a value.
- b) A procedure must return a value.
- c) A function executes a PL/SQL statement.
- d) A function is invoked as part of an expression.
- e) A procedure must have a return data type specify in its declaration.
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
- IN
- OUT
- RETURN
The ADD_PLAYER, UPD_PLAYER_STAT and UPD_PITCHER_STAT procedures are grouped together in a package. A variable must be shared among only these procedures. Where should you declare this variable?
- a) In the package body.
- b) In the data base triggers.
- c) In the package specification.
- d) In the procedures declare section using the exact name in each.
For which trigger timing can you reference the NEW and OLD qualifiers?
- Statement and Row
- Statement only
- Row only
- Oracle Forms trigger
Examine this code: CREATE OR REPLACE STORED FUNCTION get_sal (p_raise_amt NUMBER, p_employee_id employees.employee_id%TYPE) RETURN NUMBER IS v_salary NUMBER; v_raise NUMBER(8,2); BEGIN SELECT salary INTO v_salary FROM employees WHERE employee_id = p_employee_id; v_raise := p_raise_amt * v_salary; RETURN v_raise; END; Which statement is true?
- a) This statement creates a stored procedure named get_sal.
- b) This statement returns a raise amount based on an employee id.
- c) This statement creates a stored function named get_sal with a status of invalid.
- d) This statement creates a stored function named get_sal.
- e) This statement fails.
When using a packaged function in a query, what is true?
- a) The COMMIT and ROLLBACK commands are allowed in the packaged function.
- b) You can not use packaged functions in a query statement.
- c) The packaged function cannot execute an INSERT, UPDATE, or DELETE statement against the table that is being queried.
- d) The packaged function can execute and INSERT, UPDATE, or DELETE statement against the table that is being queried if it is used in a subquery.
- e) The packaged function can execute an INSERT, UPDATEM or DELETE statement against the table that is being queried if the pragma RESTRICT REFERENCE is used.
Which three are true regarding error propagation? (Choose three)
- a) An exception cannot propagate across remote procedure calls.
- b) An exception raised inside a declaration immediately propagates to the current block.
- c) The use of the RAISE; statement in an exception handler reprises the current exception
- d) An exception raised inside an exception handler immediately propagates to the enclosing block.
Which procedure of the dbms_output supply package would you use to append text to the current line of the output buffer?
- a) GET.
- b) GET_LINE.
- c) PUT_TEXT_LINE.
- d) PUT_LINE.
An Oracle instance is executing in a nondistributed configuration. The instance fails because of an operating system failure. Which background process would perform the instance recovery when the atabase is reopened ?
- PMON
- SMON
- RECO
- ARCn
- CKPT
A tablespace has a table with 30 extents in it. Is this bad?
- True
- False
You need to enforce these two business rules: 1. No two rows of a table can have duplicate values in the specified column. 2. A column cannot contain null values. Which type of constraint ensure that both of the above rules are true ?
- Check
- Unique
- Not Null
- Primary Key
- Foreign Key