0% found this document useful (0 votes)
300 views5 pages

14 Oracle Supplied Packages

The DBMS_DDL package allows you to perform DDL commands like ALTER TABLE within PL/SQL and recompile dependent objects. DBMS_JOB allows you to schedule jobs to automatically execute procedures like the daily data download task. DBMS_OUTPUT places messages in a buffer to be displayed later, while SET SERVEROUTPUT ON must be used in SQL*Plus to view the output. Dynamic SQL with DBMS_SQL is executed under the current user and is checked for validity during the parse phase.

Uploaded by

RASHMI_HR
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
300 views5 pages

14 Oracle Supplied Packages

The DBMS_DDL package allows you to perform DDL commands like ALTER TABLE within PL/SQL and recompile dependent objects. DBMS_JOB allows you to schedule jobs to automatically execute procedures like the daily data download task. DBMS_OUTPUT places messages in a buffer to be displayed later, while SET SERVEROUTPUT ON must be used in SQL*Plus to view the output. Dynamic SQL with DBMS_SQL is executed under the current user and is checked for validity during the parse phase.

Uploaded by

RASHMI_HR
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

After adding a new column to the EMP table, you must recompile all dependent

PL/SQL constructs. Which package/procedure can you invoke?

DBMS_COMPILE.MODIFIED
DBMS_SQL.ALTER_COMPILE
DBMS_RECOMPILE.INVALID
DBMS_DDL.ALTER_COMPILE

Explanation:
DBMS_DDL is an Oracle supplied package that allows you to perform Data Definition
Language (DDL) commands within a PL/SQL construct.

ALTER_COMPILE is one procedure of this package that allows you to compile PL/SQL
constructs.

Which Oracle supplied package allows you to create automated, unattended


scheduling of PL/SQL program units?

DBMS_JOB
DBMS_DDL
DBMS_PIPE
DBMS_OUTPUT

Explanation:
DBMS_JOB is an Oracle supplied package that allows you to create jobs or
schedules. These jobs are created by specifying the time to execute, iteration, and the
action or actions to perform.

The DOWNLOAD_CORE_DATA procedure must be invoked each day at 7:00


am. Which action will you take to perform this task?

Invoke the procedure manually each day at 7:00 am.


Create a job to execute this procedure daily using the DBMS_JOB package.
Create a job to execute this procedure daily using the DBMS_SQL package.
Specify the PRAGMA RUN_DAILY compiler directive in the procedure's declaration.

Explanation:
DBMS_JOB is the Oracle supplied package that allows you to execute procedures or
schedule tasks to execute intermittently.
You could invoke the procedure manually each day at 7:00 am, but it is not the best answer
for this scenario.

Which procedure of the DBMS_OUTPUT supplied package allows you to place


messages in a buffer to be displayed at a later time?

PUT
PLACE_LINE
OUTPUT_LINE
CREATE_LINE

Explanation:
DBMS_OUTPUT is an Oracle supplied package that allows you to display messages during
a SQL*Plus session. PUT is the procedure within this package that allows you to add text to
the buffer only. You can then display the contents of the buffer using the PUT_LINE or
NEW_LINE procedure. PUT_LINE is a procedure within this package that places a line of
text into a buffer and then displays the contents of the buffer to the screen. NEW_LINE is a
procedure within this package that places an end-of-line marker in the output buffer.

To view the results of the DBMS_OUTPUT package in SQL*Plus, you must first issue the
SET SERVEROUTPUT ON command.

You are debugging a PL/SQL program unit in SQL*Plus. When using


DBMS_OUTPUT.PUT_LINE, you do not see the output on the screen. Which
command must you execute to see the results of DBMS_OUTPUT.PUT_LINE?

SET ECHO ON
SET VERIFY ON
SET FEEDBACK ON
SET SERVEROUTPUT ON
Explanation:
DBMS_OUTPUT is an Oracle supplied package that allows you to display messages during
a SQL*Plus session. To view the execution results of DBMS_OUTPUT in SQL*Plus, you
must first issue the SET SERVEROUTPUT ON command.

When using DBMS_SQL to create dynamic SQL, which processing phase will
check the validity of the statement?

bind
parse
fetch
execute

Explanation:
When a SQL statement is processed, it must pass through the parse, bind, execute, and
fetch phases.

During the parse phase, the statement is checked for syntax errors and validity. All object
references are resolved and the user's privileges to those objects are checked.

When invoking the Oracle supplied DBMS_SQL package, under which user
account are the operations executed?

SYS only
SYSTEM only
current user only
SYS and current user only

Explanation:
Operations performed with DBMS_SQL are executed under the current user. They are not
executed under the SYS or SYSTEM accounts.

Which two Oracle supplied packages can you use to perform DDL commands
within a PL/SQL program unit? (Choose two.)

DBMS_SQL
DBMS_JOB
DBMS_DDL
DBMS_PIPE
DBMS_OUTPUT

Explanation:
DBMS_SQL is an Oracle supplied package that allows you to perform Data Definition
Language commands (DDL) within a PL/SQL construct. It also allows you to create dynamic
SQL.

DBMS_DDL is an Oracle supplied package that allows you to perform certain Data Definition
Language (DDL) commands within a PL/SQL construct.

Examine this procedure:

CREATE OR REPLACE PROCEDURE manage_temp_tables


IS
BEGIN
DELETE FROM temp_table1;
DROP TABLE temp_table2;
END;

Why would you receive an error during compilation?


The DROP command within a PL/SQL construct must be executed using the DBMS_DROP
package.
Data definition commands within a PL/SQL construct must be executed using the
DBMS_SQL package.
Data manipulation commands within a PL/SQL construct must be executed using the
DBMS_SQL package.
Data manipulation commands within a PL/SQL construct must be executed using the
DBMS_DML package.

Explanation:
Data Definition Language (DDL) commands cannot be executed from within a PL/SQL
construct unless you use the DBMS_SQL package.

Data Manipulation Language (DML) commands can be executed directly without the need of
a package.

Which Oracle supplied package allows you to send a message to another user of
the same session?

DBMS_SQL
DBMS_JOB
DBMS_PIPE
DBMS_MESSAGE

Explanation:
DBMS_PIPE is the Oracle supplied package that allows two or more sessions connected to
the same instance to communicate through a pipe.

You use several subprograms within this package to create, send, accept, and read the
contents of a pipe.

A procedure must insert rows into a table. The name of this table is not known
until runtime. Which Oracle supplied package must you use to accomplish this
task?

DBMS_SQL
DBMS_PIPE
DBMS_INSERT
DBMS_DYNAMIC

Explanation:
DBMS_SQL is an Oracle supplied package that allows you to perform Data Definition
Language commands (DDL) within a PL/SQL construct. It also allows you to create dynamic
SQL.

Dynamic SQL is a statement that is not complete in the source code. It is not completed
until runtime. For example, the name of a table could be passed through a parameter and
used to complete the INSERT statement within this procedure.

Which function of the DBMS_SQL package returns the total number of rows
affected by the last operation?

PARSE
EXECUTE

FETCH_ROWS

OPEN_CURSOR

Explanation:
The EXECUTE function of the DBMS_SQL package executes the SQL statement and
returns the number of rows processed.

The PARSE procedure of the DBMS_SQL package immediately parses the SQL statement
specified.

The FETCH_ROWS function of the DBMS_SQL package fetches a row or rows from an
open cursor.

The OPEN_CURSOR function of the DBMS_SQL package opens a cursor, obtaining a


pointer to memory.

You might also like