PL/SQL Programming and Oracle Database Concepts
Test your knowledge of PL/SQL programming including stored procedures, functions, packages, triggers, cursors, exception handling, and Oracle database data types and transactions.
Questions
Raw types are used to store _________ data.
- Binary
- Character
- ASCII
- All of the above
SQL has facility for programmed handling of errors that arise during the manipulation of data.
- True
- False
_________ data type stores unstructured binary data upto 4GB length.
- CLOB
- BLOB
- LONG
- All of the above
In a PL/SQL block structure, which parts are optional?
- DELCARE and BEGIN
- DECALRE and EXCEPTION
- EXCEPTION and END
- BEGIN and END
A Rollback statement cannot be used to close transaction.
- True
- False
If the Oracle Engine for its internal processing has opened a cursor they are known as _________
- Explicit Cursor
- Implicit Cursor
- Active Data Set
- None of the above
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 stored procedure on the server.
- A block of code in a PL/SQL library.
- A standalone procedure on the client machine.
- A block of code in the body of the program unit ORDERTOTAL.
- A local subprogram defined within the program unit ORDERTOTAL.
Implicit cursors are declared for
- Some DML,PL/SQL statements
- All DML,PL/SQL statements
- Only PL/SQL statements
- None of the Above
Which is the procedure used to issue User-Defined error messages from stored Sub-Programs?
- Raise Application procedure
- Raise Application Error procedure
- Application Error procedure
- None of the Above
How do you handle an Exception?
- Trap it with a Handler
- Propagate it to the Calling Environment
- A & Then B
- B & Then A
Under which two circumstances do you design database triggers? (Choose two)
- To duplicate the functionality of other triggers.
- To replicate built-in constraints in the Oracle server such as primary key and foreign key.
- To guarantee that when a specific operation is performed, related actions are performed.
- For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement.
Which two statements about the overloading feature of packages are true? (Choose two)
- Only local or packaged sub programs can be overloaded.
- Overloading allows different functions with the same name that differ only in their return types.
- Overloading allows different subprograms with the same number, type and order of the parameter.
- Overloading allows different subprograms with the same name and same number or type of the parameters.
- Overloading allows different subprograms with the same name but different in either number or type or order of parameter.
What does “REPLACE” indicate in creating procedures?
- An existing will be dropped and it will be replaced by the new version.
- An existing will be dropped and it will not be replaced by the new version.
- No change will occur
- There is no such option available in creating procedures.
Which two statements about packages are true? (Choose two)
- Packages can be nested.
- You can pass parameters to packages.
- A package is loaded into memory each time it is invoked.
- The contents of packages can be shared by many applications.
- You can achieve information hiding by making package constructs private.
A function must return zero or more values to its calling environment, whereas a procedure returns a value to the calling environment.
- True
- False
Which of the following statements is false with respect to packages?
- The package itself cannot be called, parameterized, or nested.
- The format of a package is similar to that of a subprogram.
- The contents can be shared by many applications once written.
- None of the above.
Identifiers defined only in the package body are public constructs. These are visible outside the package body
- True
- False
Which two program declarations are correct for a stored program unit? (Choose two)
- CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER
- CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER) RETURN NUMBER
- CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER)
- CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER(10,2)
- CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER(10, 2))
What is true about stored procedures?
- A stored procedure uses the DELCLARE keyword in the procedure specification to declare formal parameters.
- A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification.
- A stored procedure must have at least one executable statement in the procedure body.
- A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters.
Which three are valid ways to minimize dependency failure? (Choose three)
- Querying with the SELECT * notification.
- Declaring variables with the %TYPE attribute.
- Specifying schema names when referencing objects.
- Declaring records by using the %ROWTYPE attribute.
- Specifying package.procedure notation while executing procedures.