Question: Which statement would you use to invoke a stored procedure in isql*plus?

Similar documents
Oracle Database: Program with PL/SQL

When a database trigger routine does not have to take place before the triggering event, which timing should you assign to the trigger?

ADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine.

Introduction to Computer Science and Business

Oracle PLSQL Training Syllabus

Vendor: Oracle. Exam Code: 1Z Exam Name: Oracle Database 11g: Program with PL/ SQL. Version: Demo

Oracle Database 12c: Program with PL/SQL Duration: 5 Days Method: Instructor-Led

Oracle Database 11g: Program with PL/SQL Release 2

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Ed 2

Oracle Database 12c R2: Program with PL/SQL Ed 2 Duration: 5 Days

Conditionally control code flow (loops, control structures). Create stored procedures and functions.

ORACLE TRAINING. ORACLE Training Course syllabus ORACLE SQL ORACLE PLSQL. Oracle SQL Training Syllabus

Oracle Database 11g: Program with PL/SQL

5. Single-row function

IZ0-144Oracle 11g PL/SQL Certification (OCA) training

Proje D2K. CMM (Capability Maturity Model) level Project Standard:- Corporate Trainer s Profile

"Charting the Course... Oracle 18c PL/SQL (5 Day) Course Summary

Oracle - Oracle Database: Program with PL/SQL Ed 2

Introduction p. 1 The Logical and Physical View of Tables p. 1 Database Types p. 4 NULLs p. 6 DDL and DML Statements p. 7 Column and Table Constraint

Oracle Exam 1z0-144 Oracle Database 11g: Program with PL/SQL Version: 8.5 [ Total Questions: 103 ]

Oracle12c Release 1 PL/SQL (3 Days)

1Z Oracle Database 11g - Program with PL/SQL Exam Summary Syllabus Questions

PL/SQL Block structure

Database Programming with PL/SQL

Oracle Developer Track Course Contents. Mr. Sandeep M Shinde. Oracle Application Techno-Functional Consultant

Oracle PL/SQL - 12c & 11g [Basic PL/SQL & Advanced PL/SQL]

SQL+PL/SQL. Introduction to SQL

Index. Boolean expression, , Business rules enforcement. see Declarative constraints table with Oracle constraints and,

Question No : 1 Which statement is true about triggers on data definition language (DDL) statements?

Oracle EXAM 1Z0-144 Oracle Database 11g: Program with PL/SQL

Oracle Database: Introduction to SQL/PLSQL Accelerated

Creating and Managing Tables Schedule: Timing Topic

1Z0-144.v Number: 1Z0-144 Passing Score: 800 Time Limit: 120 min File Version:

UNIT II PL / SQL AND TRIGGERS

Oracle Database 11g: SQL and PL/SQL Fundamentals

UNIT-IV (Relational Database Language, PL/SQL)

1Z0-144 Q&As Oracle Database 11g: Program with PL/ SQL

Contents I Introduction 1 Introduction to PL/SQL iii

non-transferable license to use this Student Guide.

Introduction to SQL/PLSQL Accelerated Ed 2

ORACLE: PL/SQL Programming

Oracle PLSQL. Course Summary. Duration. Objectives

PL/SQL. Exception. When the PL/SQL engine cannot execute the PLSQL block it raise an error. Every Oracle error has an error number

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals Ed 2

Oracle Database: Program with PL/SQL Ed 2 Erlernen Sie diese leistungsstarken Programmiersprache

Oracle Database: SQL and PL/SQL Fundamentals

1Z0-147.v Number: 1Z0-147 Passing Score: 800 Time Limit: 120 min File Version:

Oracle EXAM - 1Z Program with PL/SQL. Buy Full Product.

Exam Name: Oracle9i program with pl/sql Exam Type: Oracle Exam Code: 1Z0-147 Total Questions: 132

Developer. 1 enterprise. Professional Guide. Oracle Advanced PL/SQL. example questions for 1Z0-146 examination

2. Programming written ( main theme is to test our data structure knowledge, proficiency

ORACLE Job Placement Paper. Paper Type : General - other

Exam Name: Oracle Database 11g: Program with PL/SQL

Table of Contents. Oracle SQL PL/SQL Training Courses

COWLEY COLLEGE & Area Vocational Technical School

JPexam. 最新の IT 認定試験資料のプロバイダ IT 認証であなたのキャリアを進めます

Oracle PL SQL Training & Certification

A Unit of SequelGate Innovative Technologies Pvt. Ltd. All Training Sessions are Completely Practical & Real-time

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL

CO Oracle Database 12c: Advanced PL/SQL

Oracle Database 11g & PL/SQL

Oracle Database: Introduction to SQL

Projects. Corporate Trainer s Profile. CMM (Capability Maturity Model) level Project Standard:- TECHNOLOGIES

M.C.A. (CBCS) Sem.-III Examination November-2013 CCA-3004 : Database Concepts and Tools. Faculty Code: 003 Subject Code:

Topics Fundamentals of PL/SQL, Integration with PROIV SuperLayer and use within Glovia

Oracle 1Z Develop PL/SQL Program Units. Download Full Version :

The PL/SQL Engine: PL/SQL. A PL/SQL Block: Declaration Section. Execution Section. Declaration Section 3/24/2014

PLSQL 9i Index. Section Title Page

Oracle. PL/SQL Procedural Language

ORACLE VIEWS ORACLE VIEWS. Techgoeasy.com

SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database.

PL/SQL is a combination of SQL along with the procedural features of programming languages.

Question Bank PL/SQL Fundamentals-I

Oracle 1z Oracle 1z0-101 Develop pl/ sql program units. Practice Test. Version

CHAPTER 44. Java Stored Procedures

ORACLE DEV 11G CURRICULUM. Introduction to SQL

1Z0-101 develop pl/sql program units

c. Invoke your procedure again, passing a job ID of ST_MAN and a job title of Stock Manager. What happens and why?

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

SQL Interview Questions

Oracle Database: SQL and PL/SQL Fundamentals NEW

1Z0-147 Oracle 9i: Program with PL/SQL

Oracle EXAM - 1Z Oracle Database 11g: Program with PL/SQL. Buy Full Product.

Course Contents of ORACLE 9i

Oracle 1Z Oracle9i: Program with PL/SQL. Download Full Version :

Now, we can refer to a sequence without having to use any SELECT command as follows:

CHAPTER. Oracle Database 11g Architecture Options

Business Analytics. SQL PL SQL [Oracle 10 g] P r i n c e S e t h i w w w. x l m a c r o. w e b s. c o m

Lecture 08. Spring 2018 Borough of Manhattan Community College

Oracle Syllabus Course code-r10605 SQL

O R A C L E A C A D E M Y

ORACLE DATABASE 12C INTRODUCTION

Oracle Notes Part-5. Two Types of Cursor : 1)Implicit Cursor

Oracle SQL & PL SQL Course

1Z Z0-146-Oracle Database 11g: Advanced PL/SQL Exam Summary Syllabus Questions

Oracle 1Z Oracle Database 11g: Advanced PL/SQL.

Appendix A Practices and Solutions

Transcription:

What are the two types of subprograms? procedure and function Which statement would you use to invoke a stored procedure in isql*plus? EXECUTE Which SQL statement allows a privileged user to assign privileges to other users? GRANT Which column of the USER_OBJECTS data dictionary view contains the date and time a particular object was initially stored in the database? CREATED Which column of the USER_OBJECTS data dictionary view indicates whether the database object is a procedure, function, trigger, or package? OBJECT_TYPE What is the syntax of the SHOW ERRORS SQL*Plus command? SHOW ERRORS [construct_type] [construct_name] Which two values are allowed for the STATUS column of the USER_OBJECTS data dictionary view? VALID and INVALID

Which system privilege allows a user to create procedures, functions, and packages? CREATE PROCEDURE Which SQL statement allows a privileged user to remove privileges from a user? REVOKE If you are not the object's owner, which privilege must you be granted to run a PL/SQL construct, such as a function or procedure? EXECUTE Which view contains a STATUS column that indicates whether a database object is valid? USER_OBJECTS Which system privilege is required to manually recompile a stored procedure owned by another user? ALTER ANY PROCEDURE What is returned when you use the SQL*Plus DESCRIBE command with a PL/SQL construct, such as a procedure or function? the construct's argument list Which column of the USER_SOURCE data dictionary view contains the source code that defines the associated procedure, function, or package? TEXT Where are BFILES stored? in a file stored outside of the database

What are the two distinct parts of an internal LOB? LOB value - data that constitutes the real object being stored LOB locator - a pointer to the location of the LOB value stored in the database Which database object provides for the administration of access and usage of BFILEs? DIRECTORY Which function would you use to initialize a BFILE column? BFILENAME Which three types of LOBs are internal LOBs? CLOB, NCLOB, and BLOB Which LOB data type represents a multibyte character large object? NCLOB Which statement would you use to migrate a LONG column to a NCLOB column? ALTER TABLE Which LOB data type represents a character large object? CLOB Which DBMS_LOB procedure would you use to load a BFILE? DBMS_LOB.FILEOPEN

Can you migrate a LONG column to a CLOB or NCLOB column? Yes Which supplied package manages LOBs? DBMS_LOB Can you migrate a LONG RAW column to a CLOB column? No. You can migrate a LONG RAW column to a BLOB column, not a CLOB column. Are dependencies between objects residing on different databases handled the same as those residing on the same database? No. When remote referenced objects are marked invalid, any local dependent objects are not marked invalid What does the utldtree.sql script do? It creates the DEPTREE_FILL procedure and two additional views, DEPTREE and IDEPTREE, which can be used to determine indirect dependencies between database objects. Which three guidelines can minimize recompilation failure? declaring identifiers using the %TYPE and %ROWTYPE attributes, using SELECT * notation in queries, and including a column list in INSERT statements Does modifying a procedure's argument list affect the constructs that the procedure executes? No, but it does affect other constructs that reference the procedure

What is automatic implicit recompilation? the process by which invalid subprograms are implicitly recompiled the next time they are referenced What happens when a change is made to a database object that is referenced by other database objects? All dependent objects are marked invalid. When a local procedure depends on another local procedure, and the called procedure is changed, when is the dependent procedure recompiled? the next time it is executed What are database objects that rely on database objects in a different database referred to as? remote dependent objects What are database objects that rely on another database object in the same database referred to as? local dependent objects When a local procedure depends on a remote procedure and the remote procedure is modified, when is the local procedure recompiled? the second time it is executed after the change Which standard data dictionary view can you use to display dependencies between database objects? USER_DEPENDENCIES Which syntax can you use to manually recompile a package?

ALTER PACKAGE package_name COMPILE; Which two views are created by running the utldtree.sql script? DEPTREE and IDEPTREE When does code included in the executable section of a package body execute? the first time the package is referenced within a session or when the package is recompiled Within a package, where would you include code that needs to execute only the first time the package is referenced within a session? in the executable section of a package body Is a package variable accessible after the package has finished executing? Yes, the state of a package variable persists throughout the current user session. What is an overloaded package? a package that contains two different subprograms with the same name, but argument lists that differ in number, order, or data type family Which compiler directive would you use to specify the purity level of a function? PRAGMA RESTRICT_REFERENCES What are package subprograms that reference each other known as? mutually referential subprograms

Can stand-alone stored procedures be overloaded? No, only local subprograms or packaged subprograms can be overloaded When using forward declaration, what must be specified in the package specification prior to declaring the calling subprogram? the subprogram name and formal parameter list Must procedures within a package have a unique name? No. By overloading a package, you can create two procedures with the same name, but the procedures' argument lists must differ in number, order, or data type family What are the three parts of a package body? header, declaration, and executable section What are variables declared in a package specification or body known as? package variables Does PL/SQL allow forward references? No, you must declare a construct before referencing it. What is a forward declaration? when you declare only a subprogram specification, prior to declaring the body of the subprogram, so that other subprograms may reference it In which three languages can a procedure being called in a CALL statement be written? PL/SQL, C, or Java

What does a CALL statement within a trigger body allow you to do? call a stored procedure What are the three DDL_Event triggers? CREATE, ALTER, and DROP What are the two options for the LOGON and LOGOFF triggers? ON SCHEMA - fires for the specific user ON DATABASE - fires for all users Which data dictionary view contains the status of a trigger and the date the trigger was created? USER_OBJECTS If a database trigger fails, is the DML operation that invoked the trigger rolled back? Yes Which three programming languages can be used to create a database trigger? PL/SQL, C, or Java If an error occurs when a trigger is being created, what happens? The trigger is still created. What does the CREATE TRIGGER privilege allow a user to do? to create database triggers on a table in their schema and to drop and alter the database triggers they have created

Do DDL triggers fire for the creation of tablespaces? Yes. DDL triggers fire for clusters, functions, indexes, packages, procedures, roles, sequences, synonyms, tables, tablespaces, triggers, types, views, or users. What is the result if a row level database trigger attempts to read the same table on which the triggering event is defined? An error occurs because the table is mutating Should you place a colon at the end of a CALL statement? No Which column of the USER_TRIGGERS view contains the source code of the database trigger? TRIGGER_BODY What are the five Database_event triggers? AFTER SERVERERROR, AFTER LOGON, BEFORE LOGOFF, AFTER STARTUP, and BEFORE SHUTDOWN Which data dictionary view could you query to display compilation errors that occurred when a trigger was compiled? USER_ERRORS Which two data dictionary views could you use to display all triggers that you and other users have created and that you have access to? ALL_OBJECTS and ALL_TRIGGERS

Which command could you use in isql*plus to see compilation errors that occurred when a trigger was compiled? SHOW ERRORS After compiling a trigger, which SQL*Plus command can you use to display compilation errors? SHOW ERRORS If you have the appropriate privileges, which two data dictionary views could you query to display all triggers defined on a table? DBA_OBJECTS and DBA_TRIGGERS If you have the appropriate privileges, which two data dictionary views could you query to display all triggers defined on a table? DBA_OBJECTS and DBA_TRIGGERS Which type of database trigger allows you to capture the values that exist before the trigger body executes and the values after the trigger body executes? row level, because a row level trigger fires once for each affected row Which two triggers monitor how often you log on and log off the database? LOGON and LOGOFF Can a function be invoked from within a SELECT clause of a SQL statement? Yes, as long as the function returns an Oracle server internal data type and does not modify database tables.

Can a function include more than one RETURN statement in its executable section? Yes, this is customary in an IF block to return different values based on some condition. However, only one of the RETURN statements executes. Can you rollback a DROP FUNCTION statement? No. The DROP FUNCTION statement is a DDL command and is, therefore, auto-committing. When passing a SQL*Plus variable to a function, why is the variable prefixed with a colon? This statement is actually an implicit PL/SQL anonymous block, and when referencing host variables within a PL/SQL construct, you must use the colon to distinguish them from local PL/SQL variables. Which statement should you use to permanently remove a function from the database? DROP FUNCTION Which statement is the equivalent to removing a function and recreating it? CREATE AND REPLACE FUNCTION Must a function return a value? Yes, functions must return a single value How is a function invoked? as part of an expression Can functions be invoked using the EXECUTE statement? No, functions must be executed as part of an expression.

How many IN arguments are required for a stored function? None, a function can return a value that is not derived from an input argument. What are the four sections of a PL/SQL function? header, declaration, executable, and exception What is the purpose of the RETURN statement included in a function's header section? to specify the data type to be returned Will a function compile successfully without a RETURN statement in the executable section? Yes. Although a function will compile successfully without a RETURN statement in the executable section, it will generate a run-time error if no value is returned to the calling environment when executed Which statement would you issue to drop a stored function from the database? DROP FUNCTION Can a user-defined function be referenced in a FROM clause of a SQL statement? No When invoking functions, what is used to transfer values to and from the calling environment? formal parameters Which three components are included in a stored function header? the function name, the argument list, and the RETURN statement that identifies the data type to be returned

Which type of named subprogram must you use to return a value within a SQL statement? a function What is the syntax for defining a stored function? CREATE [OR REPLACE] FUNCTION function_name [(parameter1 [mode1] datatype1, parameter2 [mode2] datatype2,... )] RETURN datatype IS AS... BEGIN... [EXCEPTION]... END function_name; Can functions be invoked within a CHECK constraint? No Which PL/SQL statement passes a function value back to the calling environment? RETURN When defining a function, where is the argument list defined? in the header section after the procedure name, but before the RETURN statement What is the purpose of the RETURN statement in the executable section of a function? to return the value of the parameter to the calling environment If you recreate a function using the CREATE AND REPLACE FUNCTION statement, what happens to the privileges on the function? The function privileges remain the same.

For a function to compile successfully, what is the minimum number of RETURN statements? Two. One RETURN statement must be included in the header section to specify the data type to be returned, and another RETURN statement must be included in the executable section to return the value. Which procedure in the Oracle-supplied DBMS_OUTPUT package places a line of text into the buffer and displays the buffer contents to the screen? PUT_LINE Which procedure of the DBMS_OUTPUT package retrieves one or more lines from the buffer into a PL/SQL table? GET_LINES Why would you use the RECEIVE_MESSAGE function of the DBMS_PIPE package? to retrieve a message from the named pipe and place it into the local message buffer to be unpacked by the UNPACK_MESSAGE procedure Which action does the EXECUTE function of the DBMS_SQL package perform? It executes the SQL statement and returns the total number of rows processed. Which procedure of the DBMS_OUTPUT package retrieves a single line from the buffer into a variable? GET_LINE Which Oracle-supplied package can you use to display messages in a SQL*Plus session? DBMS_OUTPUT

Using DBMS_SQL, what happens during the fetch phase of executing a SQL statement? Rows are selected based on the query criteria. Which procedure of the DBMS_SQL package allows you to assign values to bind variables at runtime? BIND_VARIABLE Which procedure of the DBMS_SQL package allows you to assign values to bind variables at runtime? BIND_VARIABLE Which procedure of the DBMS_DDL package can you use to generate statistics for a given table? ANALYZE_OBJECT Which SQL*Plus command must you first issue to view output from DBMS_OUTPUT? SET SERVEROUTPUT ON What happens during the parse phase of executing a SQL statement? The statement is checked for syntax errors and validity, all object references are resolved, and the user's privileges to those objects are checked. In the DBMS_OUTPUT package, which two procedures can you use to place messages in a buffer for future use? PUT and PUT_LINE

Which function of the DBMS_PIPE package sends the contents of the message buffer to the pipe? SEND_MESSAGE Which action does the NEW_LINE procedure of the DBMS_OUTPUT package perform? It places an end-of-line marker in the output buffer. Which procedure of the DBMS_DDL Oracle-supplied package allows you to compile PL/SQL constructs? ALTER_COMPILE Which two Oracle-supplied packages could you use if you needed to perform DDL within a PL/SQL procedure? DBMS_DDL or DBMS_SQL Which Oracle-supplied package provides many subprograms for managing both local and distributed transactions? DBMS_TRANSACTION Which function of the DBMS_SQL package opens a new cursor and returns a cursor identification number? OPEN_CURSOR Which Oracle-supplied package allows two or more sessions connected to the same instance to communicate through a pipe? DBMS_PIPE

Which function of the DBMS_SQL package fetches a row or rows from an open cursor? FETCH_ROWS Using DBMS_SQL, what happens during the bind phase of executing a SQL statement? Oracle obtains the needed values for any bind variables included in the SQL statement. Which term refers to SQL statements that are NOT completed until run-time? dynamic SQL What is the difference between the PUT and PUT_LINE procedures of the Oracle-supplied DBMS_OUTPUT package? The PUT_LINE procedure also appends a newline character Which action does the CLOSE_CURSOR procedure of the DBMS_SQL package accomplish? It closes a specified cursor that was previously opened using DBMS_SQL. What does the BIND_VARIABLE procedure of the DBMS_SQL package do? It binds a scalar value to a variable named in the parsed SQL statement of a given cursor Which function of the DBMS_SQL package opens a cursor and is always required? OPEN_CURSOR Which Oracle-supplied package can you use to create jobs or schedules? DBMS_JOB

Which four basic steps would you take to dynamically execute a SQL statement using the DBMS_SQL package? 1. Call the OPEN_CURSOR function to allocate memory and obtain a pointer. 2. Call the PARSE procedure to validate the SQL statement. 3. Call the EXECUTE function to run the SQL statement. 4. Call the CLOSE_CURSOR procedure to close the cursor. Which procedure of the DBMS_SQL package immediately parses a specified SQL statement? PARSE Which statement would you use to prevent a single trigger from executing? ALTER TRIGGER Which statement would you use to permanently remove a trigger from the database? DROP TRIGGER Which keywords can you include in an ALTER TABLE statement to temporarily disable all triggers on a table? DISABLE ALL TRIGGERS When creating a DML trigger, which five components must be identified? trigger name, timing, DML event, table, and trigger body Which keyword should you use if the trigger body should execute prior to the triggering event? BEFORE

Which keyword must you include in an ALTER TRIGGER statement to temporarily prevent a trigger from executing? DISABLE Which two keywords specify trigger timing in relation to the triggering event? BEFORE and AFTER By default, are triggers statement level or row level? statement level Which special type of row trigger can be coded for views to fire the trigger in place of executing the triggering statement? INSTEAD OF What is the syntax for creating a statement trigger? CREATE [OR REPLACE] TRIGGER trigger_name timing event1 [OR event2 OR event3] ON table_name BEGIN... END; Which additional keywords must a row trigger include? FOR EACH ROW What happens when you disable a database trigger? The trigger remains in the data dictionary, but will not execute until it is re-enabled

Which type of database trigger fires once for the triggering event? statement trigger Which syntax can you use to disable a trigger? ALTER TRIGGER trigger_name DISABLE; Which two actions occur when a database trigger terminates abnormally? A rollback occurs, and the triggering statement is rolled back. When would you use the UPDATE OF keywords in a trigger definition? if you want the trigger to fire in response to updating a specific column or columns in the specified table Which keyword should you include if the trigger body should execute following the triggering event? AFTER Database triggers can be defined on which types of database objects? tables or views Can you reference the OLD and NEW qualifiers in a statement level trigger? No, only in a row level trigger that affects each row processed How are trigger predicates like INSERTING, UPDATING, and DELETING usually referenced? in an IF statement

In the trigger body, which determines how many times the trigger body will execute? trigger type Within row triggers, for which purpose are the OLD and NEW qualifiers used? to reference old and new values of columns Which data dictionary view would you use to display the source code for only database triggers that you have created? USER_TRIGGERS What is the syntax to re-enable a database trigger? ALTER TRIGGER trigger_name ENABLE; Other than dropping a trigger, how can you temporarily prevent the trigger from executing? by disabling the trigger Which syntax would you use to prevent all triggers on a given table from executing? ALTER TABLE... DISABLE ALL TRIGGERS; Which type of trigger fires for each row affected by the triggering event? row trigger When a trigger is defined to execute for multiple DML statements, how can you determine the type of statement that invoked the trigger? by referencing the INSERTING, UPDATING, and DELETING trigger predicates

What is the syntax for creating a row level trigger? CREATE [OR REPLACE] TRIGGER trigger_name timing event1 [OR event2 OR event3] ON table_name [REFERENCING OLD AS old NEW AS new] FOR EACH ROW [WHEN condition] BEGIN... END; Which statement should you use to compile a database trigger? ALTER TRIGGER Which additional clause can be included in the header of a database trigger to determine for which affected rows the trigger should execute? WHEN What is a pragma? a directive to the PL/SQL compiler Can public package variables be referenced outside the package? Yes, by prefixing them with the package name What is the syntax for creating a package specification? CREATE [OR REPLACE] PACKAGE package_name IS AS... END package_name;

Can procedures declared only in the package body be invoked from outside the package? No, they are considered to be private Can packages be nested? No Can private package variables be referenced outside the package? No, only by other constructs within the package What is meant by the "purity level" of a package? the extent to which the package is free from adverse database side effects Which types of programming constructs can be included in a package? cursors, variables, types, exceptions, procedures, and functions Which elements are included in a package specification? the package name, public declarations, and declarations of public PL/SQL subprograms included in the package body From where can public variables within a package be referenced? from inside and outside of the package Of which type are variables declared within the declaration section of a package body? private

In a package, must all constructs be declared in the body? Yes, all constructs must be declared in the package body if a package body is required Of which type are variables declared in the package specification? public Which elements are included in a package body? the package name, private declarations, and public and private PL/SQL subprograms Which four purity levels can be specified in a PRAGMA RESTRICT_REFERENCES statement? WNDS - Writes no database state RNDS - Reads no database state WNPS - Writes no package state RNPS - Reads no package state What is the syntax for creating a package body? CREATE [OR REPLACE] PACKAGE BODY package_name IS AS... END package_name Must all packages have a specification and a body? No, packages that do not contain procedures or functions do not require a body What is a group of logically-related subprograms and constructs called? a package

Within a package, from where can private variables be referenced? from within any construct of the package When executing a procedure using the EXECUTE command, how must you reference procedures that are defined within a package? using the package name as a prefix or package_name.procedure_name (arguments) Which statement permanently removes a package specification and body from the database? DROP PACKAGE package_name Which statement permanently removes a package body from the database without affecting the package's specification? DROP PACKAGE BODY package_name; a package contains more than one subprogram and a variable is declared in the package body before any of the subprograms, where is the variable visible? in all of the package's subprograms, but not outside the package In a package, where are private constructs declared? in the package body only When is a package loaded into memory? when any construct within the package is invoked Which compiler directive indicates that the package body should not compile correctly if it fails one of its references? PRAGMA RESTRICT_REFERENCES

When is the order of declaration of constructs in a package important? when the constructs reference each other, otherwise order is irrelevant Why would you use a PRAGMA statement in a PL/SQL program unit? to pass information to the PL/SQL compiler Is there a defined limit on the number of subprograms that can be defined in a package? No Why would you define a package specification without a corresponding package body? to define public variables What are the two components of a database package? a specification and a body Which part of a package, the specification or the body, is required? the specification Which SQL*Plus command should you use to invoke a procedure? EXECUTE Which compiler directive would you include in the declaration section of a PL/SQL stored procedure to associate an error code with a user-defined exception? PRAGMA EXCEPTION_INIT (exception_name, number);

In a named procedure, do you use the DECLARE statement to declare local variables? No, you use the DECLARE statement only in anonymous blocks. What are the parameters passed into a procedure at invocation called? actual parameters When calling a procedure, which method of passing parameters associates actual parameters with formal parameters based on the order in which the parameters were declared? positional Where is the declarative section of a procedure located? between the IS or AS keyword and the BEGIN keyword When passing a parameter to a procedure, which parameter mode should you use if the value will only be read and NOT modified? IN When would you use a local subprogram? when only the existing PL/SQL block needs to reference the code Can you use both named and positional notation within the same subprogram call? Yes When creating a procedure using a CREATE OR REPLACE PROCEDURE statement, where is the source code of the procedure stored? in the data dictionary

Which statement would you use to remove a procedure from the database? DROP PROCEDURE When defining a parameter in a procedure's formal parameter list, how can you specify the data type of the parameter? by specifying a valid Oracle data type or by using %TYPE or %ROWTYPE What is a named PL/SQL procedure stored on the Oracle server called? a server-side procedure Which two actions occur when a server-side procedure terminates abnormally? A rollback occurs, and the raised exception is passed back to the calling environment. When defining a procedure, what are the three parameter modes allowed for formal parameters? IN, OUT, and IN OUT Which keywords can be included in a CREATE PROCEDURE statement to drop and re-create an already existing stored procedure? OR REPLACE What is a subprogram defined in the declarative section of another PL/SQL block called? a local subprogram If no mode is specified for a formal parameter in a procedure declaration, to which mode does the parameter default? IN

What should you do to handle an unexpected run-time error in a PL/SQL stored procedure? Declare an exception, associate an error code, and include an EXCEPTION block to handle the error If a server-side procedure encounters an error for which there is no explicit error-handling logic, what happens to the raised exception? It is returned to the calling procedure or the calling environment From which underlying data dictionary view does the SHOW ERRORS command retrieve information about procedure compilation errors? USER_ERRORS When defining parameters in a procedure's formal parameter list, which keyword can you include to have the parameter automatically assigned a value if no value is explicitly passed to the procedure? DEFAULT When calling a procedure, how do you specify the passed parameters using named notation? by passing each parameter including the parameter name and the value assignment with the =>operator between the parameter name and value When declaring procedure parameters in a formal parameter list, which four pieces of information can be declared for each parameter? name, mode, data type, and default value In a procedure declaration, where is the formal parameter list specified? after the procedure name and before the IS or AS keyword

Which type of named subprogram would you usually create to perform an action without returning a value? procedure How do you declare a user-defined exception within a PL/SQL stored procedure? Declare a local variable of type EXCEPTION. Which keywords surround the executable section of a stored procedure? BEGIN and END, or BEGIN and EXCEPTION if the procedure contains an exception section Which two parameter modes allow you to return values to the calling environment? OUT and IN OUT What is the syntax for creating a procedure? CREATE [OR REPLACE] PROCEDURE procedure_name [(parameter1 [mode1] data type, parameter2 [mode2] data type,...)] IS AS... BEGIN... ]EXCEPTION]... END [procedure_name Can you roll back a DROP PROCEDURE statement? No, the DROP PROCEDURE statement is a DDL command and is, therefore, auto-committing In a procedure definition, where are local variables declared? after the IS or AS keyword, but before the BEGIN keyword

What are the parameters in the procedure declaration known as? formal parameters When calling a procedure, how do you specify the passed parameters using positional notation? passing only the parameter values separated by commas If you have defined a variable using the SQL*Plus VARIABLE command, how must you reference that variable if you pass it as a procedure parameter in an EXECUTE command? as a host bind variable Which SQL*Plus command can you use to display compilation errors generated as a result of issuing a CREATE OR REPLACE PROCEDURE statement? SHOW ERRORS Which two data dictionary views can you query to retrieve the source code of a procedure that you created? ALL_SOURCE and USER_SOURCE In a PL/SQL stored procedure, where must any local subprograms be declared? between the IS or AS keyword and the BEGIN statement, after all local variable declarations Which section of a stored procedure body is the only section that is required? executable section Which SQL*Plus command should you use to create a variable that will hold a return value from a called procedure? VARIABLE

Which data dictionary view can you query to display compilation errors that you encountered when creating a procedure or function? USER_ERRORS. These errors are also visible in ALL_ERRORS and DBA_ERRORS Which parameter mode must be used for parameters that will be passed into a procedure, modified by the procedure, and passed back to the calling program? IN OUT Where is a local subprogram visible? only from within the procedure in which it is defined Which parameter mode would you use for a formal parameter that needed to be read-only? IN Name the four sections of a PL/SQL stored procedure. header, declaration, executable, and exception How can you constrain a formal parameter of a procedure to a data type and precision from an underlying scalar database column? Use the %TYPE attribute. When running a procedure using the SQL*Plus EXECUTE command, how must the parameter list passed to the procedure be offset? using parentheses Which piece of information can you optionally include with the END statement of a procedure? the name of the procedure

Can a procedure be called from within a SQL statement? No, procedures cannot be called from within a SQL statement, but rather are executed as a PL/SQL statement Which statement would you use to re-create a procedure that already exists in the database? CREATE OR REPLACE PROCEDURE How can a procedure return a value? by including an OUT parameter in the procedure's formal parameter list Which additional clause(s) can be included within the exception block of a PL/SQL subprogram to execute different logic for different user-defined exceptions? WHEN exception_name THEN Can a formal parameter defined with a mode of OUT be placed on the right-hand side of an assignment operator? No, it can only be placed on the left-hand side of an assignment operator because an OUT argument cannot be read. Which method of passing parameters must be used when NOT all arguments are specified or when arguments are specified in a different order than the declaration? named When would you use %ROWTYPE in an argument list? when passing a record argument to or from a procedure or function

When a formal parameter is declared with a DEFAULT clause, can the procedure be called without passing this parameter at invocation? Yes, the parameter is assigned the value specified in the DEFAULT clause Must a procedure return a value? No. Procedures may return values using OUT arguments, but this is not required. When specifying parameter values using the named method, which operator is used to assign a value to an argument at invocation? => Can formal parameters in a procedure declaration be constrained by explicitly specifying a length? No, only by data type. However, you can use %TYPE and %ROWTYPE Which formal parameter list would you use to pass a numeric value, v1, into the procedure, but allow the value to be optional, assuming the value of 1 if no value is passed? (v1 IN NUMBER DEFAULT 1) Where is the exception section of a PL/SQL stored procedure located? between the EXCEPTION and END keywords When calling a procedure, which method of passing parameters allows you to specify parameters in a different order than the order in which they were originally declared? named