Oracle PL/SQL and SQL Fundamentals
Test your knowledge of Oracle PL/SQL programming concepts including packages, procedures, error handling, and SQL queries with functions, aggregations, and subqueries.
Questions
Which operator can be used with a multiple-row subquery?
- =
- LIKE
- BETWEEN
- NOT IN
- Is
- <>
Which three SELECT statements display 2000 in the format "$2,000.00"? (Choose three.)
- SELECT TO_CHAR(2000, '$#,###.##') from dual
- SELECT TO_CHAR(2000, '$0,000.00') from dual
- SELECT TO_CHAR(2000, '$9,999.00') from dual
- SELECT TO_CHAR(2000, '$9,999.99') from dual
- SELECT TO_CHAR(2000, '$2,000.00') FROM dual;
- SELECT TO_CHAR(2000, '$N,NNN.NN') FROM dual;
Which of the following correctly describe the aggregate functions?
- It returns a single result row based on single rows
- It returns a single result row based on groups of rows
- It can only appear in ORDER BY clauses
- It cannot appear in select lists
Which of the following SQL statements can calculate and return the absolute value of -33?
- SELECT ABS(-33) "Absolute" FROM DUAL;
- SELECT ABS(-33), Absolute FROM DUAL;
- SELECT ABS("-33") Absolute FROM DUAL;
- None of these
What does the following SQL script do? SELECT AVG(MAX(salary)) FROM employees GROUP BY department_id;
- it has a syntax error, the AVG clause is not valid
- it calculates the average of the maximum salaries of all the departments
- it has a syntax error, the MAX clause is not valid
- it has no error, but the GROUP BY clause is not effective
Which are DML statements? (Choose all that apply)
- COMMIT
- MERGE
- UPDATE
- DELETE
- CREATE
- DROP
Which Function can return a non-Null value if passed null arguments?
- NULLIF
- LENGTH
- CONCAT
- INSTR
- TAN
SQL has facility for programmed handling of errors that arise during the manipulation of data.
- True
- False
In a PL/SQL block structure, which parts are optional?
- a) DELCARE and BEGIN
- b) DECALRE and EXCEPTION
- c) EXCEPTION and END
- d) BEGIN and END
A Rollback statement cannot be used to close transaction.
- True
- False
You want to create a PL/SQL block of code that calculates discounts on customer orders. This code will be invoked from several places, but only within the program unit ORDERTOTAL. What is the most appropriate location to store the code that calculates the discounts?
- a) A stored procedure on the server.
- b) A block of code in a PL/SQL library.
- c) A standalone procedure on the client machine.
- d) A block of code in the body of the program unit ORDERTOTAL.
- e) A local subprogram defined within the program unit ORDERTOTAL.
Which is the procedure used to issue User-Defined error messages from stored Sub-Programs?
- a) Raise Application procedure
- b) Raise Application Error procedure
- c) Application Error procedure
- d) None of the Above
Which line of the following code has an error? SELECT * FROM emp WHERE comm = NULL ORDER BY ename;
- SELECT *
- FROM emp
- WHERE comm = NULL
- There is no error in this statement.
- Examine this procedure: CREATE OR REPLACE PROCEDURE DELETE_PLAYER(V_IDIN NUMBER) IS BEGIN DELETE FROM PLAYER WHERE ID = V_ID EXCEPTION WHEN STATS_EXIST_EXCEPTION THEN DBMS_OUTPUT.PUT_LINE(Cannotdeletethisplayer, childrecordsexistin PLAYER_BAT_STAT table); END; What prevents this procedure from being created successfully?
- a) A comma has been left after the STATS_EXIST_EXCEPTION exception.
- b) The STATS_EXIST_EXCEPTION has not been declared as a number.
- c) The STATS_EXIST_EXCEPTION has not been declared as an exception.
- d) none of the above
Which operator will be evaluated first in the following SELECT statement? SELECT (2+3*4/2–5) FROM dual;
- +
- *
- /
- –
Which two statements about the overloading feature of packages are true? (Choose two)
- a) Only local or packaged sub programs can be overloaded.
- b) Overloading allows different functions with the same name that differ only in their return types.
- c) Overloading allows different subprograms with the same number, type and order of the parameter.
- d) Overloading allows different subprograms with the same name and same number or type of the parameters.
- e) Overloading allows different subprograms with the same name but different in either number or type or order of parameter.
Which two statements about packages are true? (Choose two)
- a) Packages can be nested.
- b) You can pass parameters to packages.
- c) A package is loaded into memory each time it is invoked.
- d) The contents of packages can be shared by many applications.
- e) You can achieve information hiding by making package constructs private.
Which of the following statements is false with respect to packages?
- a) The package itself cannot be called, parameterized, or nested.
- b) The format of a package is similar to that of a subprogram.
- c) The contents can be shared by many applications once written.
- d) None of the above.
Private constructs in the package body are hidden and inaccessible. Is this an advantage of a package?
- a)Yes
- b)No
- c)
- d)
When you use the DEFINE variable command, what datatype is the variable?
- VARCHAR2
- CHAR
- LONG
- NUMBER