Oracle PL/SQL and SQL Fundamentals
Covers Oracle PL/SQL concepts including cursors (explicit and implicit), packages, variable declarations, exceptions, triggers, and SQL functions
Questions
Select the VALID trigger type(s)?
- AFTER statement trigger
- INSERT row trigger
- DELETE row trigger
- UPDATE row trigger
Which of the following statements about an SQL statement are not correct?
- SQL statements are not case-sensitive, unless indicated.
- Keywords can be abbreviated.
- SQL statements can be on one or more lines.
- Keywords cannot be split across lines.
What is a database cursor?
- A cursor is SQL keyword specifying a retrieved data order.
- Cursor is acronym for Current Set Of Records and is a database object pointing to a currently selected set of records.
- A blinking vertical line that indicates the location of the next input on the display screen.
- None of the above.
What does ACID stand for?
- Access. Constraint. Index. Data.
- Atomicity. Consistency. Isolation. Durability.
- Access. Consistency. Isolation. Data.
- None of the above
Select incorrect variable declarations
- foo_text varchar2(10) := 'hello world';
- foo_char char(1) := 'Y';
- foo_number varchar2(10);
- foo_text number(10);
What command can you use to see the errors from a recently created view or stored procedure?
- SHOW MISTAKES;
- SHOW ERRORS;
- DISPLAY ERRORS;
- DISPLAY MISTAKES;
- None of the above.
What is the value of l_child_number? DECLARE l_parent_number NUMBER := 1; BEGIN DECLARE l_child_number NUMBER := 2; BEGIN l_child_number := l_parent_number + l_child_number; END; DBMS_OUTPUT.PUT_LINE(TO_CHAR(l_child_number)); EXCEPTION WHEN OTHERS THEN l_child_number := 0; DBMS_OUTPUT.PUT_LINE(TO_CHAR(l_child_number); END;
- 1
- 2
- 3
- 0
- None of the above
Which of the following is not a valid Oracle PL/SQL exception.
- NO_DATA_FOUND ORA-01403
- DUP_VAL_ON_INDEX ORA-00001
- TWO_MANY_ROWS ORA-01422
- OTHERS
- None of the above. These are all valid.
Which of the following is not a grouping function?
- DISTINCT
- SUM
- MIN
- COUNT
- All of the above.
- None of these above.
Which of the following is not an Oracle DML function?
- DECODE
- TRUNCATE
- TO_CHAR
- NVL
- Trick question, all of these are Oracle DML functions.
The || is is an example of what function SELECT last_name || ', ' || first_name || ' ' || middle_name FROM employees;
- Incantination
- Integration
- Continuation
- Concatenation
- Pipeline
- None of the above
Assuming the date and time is 09/09/2009 09:09:09, what value will the following statement return SELECT TO_CHAR(TRUNC(SYSDATE),'MM/DD/YYYY HH24:MI:SS') FROM dual;
- 09/09/2009 00:00:00
- 09/09/2009 09:09:09AM
- 09/09/2009
- 09/09/2009 09:09:09
- None of the above.
Select the best answer. Which listed attribute is an invalid attribute of an Explicit cursor.
- %NOTFOUND
- %FOUND
- %ROWCOUNT
- %ISOPEN
- None of the above. All of these are valid.
Where do you declare an explicit cursor in the PL/SQL language?
- In the PL/SQL working storage section
- In the PL/SQL declaration section
- In the PL/SQL body section
- In the PL/SQL exception section
- None of the above
Select the best answer. This is an example of what _____ type of cursor? DECLARE l_date DATE; BEGIN SELECT TRUNC(SYSDATE) INTO l_date FROM DUAL; END;
- Explicit
- Implicit
- Select
- PL/SQL
- None of the above
Select the best answer. This is an example of what _____ type of cursor? DECLARE l_date DATE; CURSOR c1 IS SELECT TRUNC(SYSDATE) FROM DUAL; BEGIN OPEN c1; FETCH c1 INTO l_date; CLOSE c1; END;
- Explicit
- Implicit
- Select
- PL/SQL
- None of the above.
Select the best answer to complete this variable declaration for a record. DECLARE l_foo_table SOME_TABLE_________; BEGIN ...
- %ROWTYPE
- %TABLE
- %COLUMNTYPE
- %TYPE
- None of the above
Select the best answer to complete this variable declaration for a column value. DECLARE l_foo_column_id SOME_TABLE.SOME_COLUMN_________; BEGIN ...
- %ID
- %ROWTYPE
- %TYPE
- %COLUMNTYPE
- None of the above.
Select the best answer PACKAGE foo_foo IS PROCEDURE foo ( p_foo_text IN VARCHAR2 ); PROCEDURE foo (p_foo_number IN NUMBER); END;
- Package specification is invalid. Too many procedures named foo.
- Package specification is invalid. First procedure should be called called foo_1, second procedure should be called foo_2.
- Package specification is valid. This is an example of overloading.
- Package specification is invalid. We can only have one procedure named foo in the package
- Package specification is valid. We can have an unlimited number of procedures name foo.
- None of the above
List the correct sequence of commands to process a set of records when using explicit cursors
- INITIALIZE, GET, CLOSE
- OPEN, FETCH, CLOSE
- CURSOR, GET, FETCH, CLOSE
- CURSOR, FETCH, CLOSE
- GET, SEEK, HIDE
- None of the above.