Tuesday, May 20, 2014

Multi - Org Concept in Oracle Apps R12


 Multi-Org in simple term means the implementation of multiple business units 
 (or Organization) under a single installation of Oracle Applications. The concept 
 of Multi-Org will manage the operations of an enterprise which has got subsidiaries
 across globe under a single oracle apps window, taking appropriate care of data
 security and data maintenance. Below are some of the features of multiple 
 organization functionality.

Any number of Business Units in an Enterprise can be supported within a single 
installation of Oracle Application. User can access the data corresponding to 
and limited to the operating unit. Reporting can be managed at different 
organization levels like, Business Group, Ledger, Operating unit etc.
Transactions like Procurement, Receiving, Selling, Shipping Etc. with the same 
Party Can be Performed through Different Organization and can be managed 

internally through inter company postings

A real time organization construct in R12



Here in this example construct, CCS Company has organization structure as follows

1 Business Group - Which controls the organization in America and Australia

2 Legal Entities - one in US and one in AU
2 Primary Ledgers - one in US and one in AU
2 Operating Units - one in US and one in AU
3 Inventory Organizations – two in US and one in AU
How Organization Hierarchy flow in Oracle R12


Multi-Org and Multi-Org Access Control in R12 (MOAC)

Prior to R12, user has to switch between responsibilities to enter transaction and 

for doing other activities for a particular organization. This is very time consuming 
to do activities in an environment like this if you have 100 operating units. 
To overcome this factor, oracle has introduced a new feature in R12 which allow the 
user to switch the organization from the same responsibility which enables the user 
to access different organization and its data from a single responsibility. 

To achieve the new objective, Oracle has introduced new functionality called Multi-Org 

Access Control (MOAC) in release 12. Following are the set up steps needs to follow for 
implementing the MOAC architecture for a particular application.



R12 Table Changes


Suppliers:

New R12 tables  -> Old 11i Tables
AP_SUPPLIERS - replaces PO_VENDORS
AP_SUPPLIER_SITES_ALL- replaces PO_VENDOR_SITES_ALL

Additional supplier related tables in IBY (Payments) and HZ (TCA):
IBY_EXTERNAL_PAYEES_ALL - stores Payee(supplier) information.
HZ_PARTIES - Party data for the suppliers.
HZ_PARTY_SITES - Party site data for the supplier sites.

Invoices:

Additional table in R12: AP_INVOICE_LINES_ALL
Allocations - AP_CHRG_ALLOCATIONS_ALL is obsolete in R12

Taxes:

Functionality provided by E-Business Tax
New tables in R12
ZX_LINES - Detailed Tax lines for the invoice (trx_id = invoice_id)
ZX_LINES_SUMMARY - Summary tax lines for the invoice (trx_id = invoice_id)
ZX_REC_NREC_DIST  - Tax distributions for the invoice (trx_id = invoice_id)
ZX_LINES_DET_FACTORS - Tax determination factors for the invoice (trx_id = invoice_id)

Payments:

Functionality moved to central Payments (IBY)
New IBY tables in R12:
IBY_PAY_SERVICE_REQUESTS  - Payment Process Request information

Accounting:

Functionality moved to SubLedger Accounting (SLA)
New R12 tables:
XLA_EVENTS -> replaces AP_ACOCUNTING_EVENTS_ALL 
XLA_AE_HEADERS -> replaces AP_AE_HEADERS_ALL
XLA_AE_LINES-> replaces AP_AE_LINES_ALL
XLA_DISTRIBUTION_LINKS

Trial Balance:

New R12 Table
XLA_TRIAL_BALANCES
AP_LIABILITY_BALANCE-> not used in new R12 transactions
AP_TRIAL_BALANCE -> not used in new R12 transactions

Bank Accounts:

Functionality moved to Cash Management.
CE_BANK_ACCOUNTS -> replaces AP_BANK_ACCOUNTS_ALL
CE_BANK_ACCT_USES_ALL  -> replaces AP_BANK_ACCOUNT_USES_ALL
CE_PAYMENT_DOCUMENTS -> AP_CHECK_STOCKS_ALL



AP Suppliers in R12-Oracle R12


In R12 Accounts Payables, that there is no more supplier form. The Suppliers have gone to self-service now. This is not the only change in the supplier. The suppliers objects have moved from AP product to TCA (Trading Community Architecture) DataModel. Due to this, even the underlying tables have changed. Supplier information is no more stored in PO_VENDORS Table now.
3 new tables have been introduced.
• AP_SUPPLIERS
• AP_SUPPLIER_SITES_ALL
• AP_SUPPLIER_CONTACTS
But don't panic as your customizations can still work as there are views created with names of PO_VENDORS, PO_VENDOR_SITES_ALL and PO_VENDOR_CONTACTS for backward compatibility.
Being a part of the TCA, these tables are closely linked to the hz tables. Here is the list of few imp HZ Tables that are affected when a new supplier is added.

TABLE NAME
DESCRIPTION
HZ_PARTIES
Master table along with AP_SUPPLIERS instead of PO_VENDORS
HZ_PARTY_SITES
Master table for supplier sites along with AP_SUPPLIER_SITES_ALL instead of PO_VENDORS_SITES_ALL
HZ_LOCATIONS
Contains the party sites information
HZ_PARTY_USG_ASSIGNMENTS
Stores party usages
HZ_ORGANIZATION_PROFILES
Captures additional Supplier information, e.g. credit scoring details of Supplier or the Number of Employees working in Supplier Organization
IBY_EXTERNAL_PAYEES_ALL
Captures Payment related details of the Supplier
POS_SUPPLIER_MAPPINGS
It holds the mapping between the AP_SUPPLIERS.VENDOR_ID and HZ_PARTIES.PARTY_ID
This is useful in cases whereby two vendors effectively belong the same HZ_Party Record.
See the diagram below for Supplier/Sites Mappings to TCA Objects.

So whenever a supplier is added in R12, an entry is made in all these tables. Functionally also, creating the supplier is different from 11i. Here are the steps to create a new supplier.
1. Hit the CREATE SUPPLIER button
2. Enter a unique supplier name (Organization Name) along with other optional other information like Alias, Tax Registration Number, D-U-N-S number.
3. If the Supplier Number Entry option in the Payables System Setup window is set to Automatic, Payables automatically enters a Supplier Number for you. If this option is set to Manual, you must enter a unique Supplier Number.
4. Click Apply. The system creates the supplier record and accesses the Suppliers: Quick Update page.
5. To create Supplier Sites, you will have to create the locations for that supplier. For that, click on the "Address Book" Button.
6. On the Address Book page, click the Create button.
7. Fill all the address details and address purpose. i.e. Purchasing, Payment or RFQ Only.
8. You can add as many locations as you wish.
9. When created, you can manage the addresses for other information.
<< Click to view the image in large size >>
10. The system only displays sites that are in your MOAC profile
11. The address status indicates whether the supplier has provided any updates for the address. Using iSupplier Portal's Supplier Profile Management tools, suppliers can enter address book information online, creating any number of new addresses, modifying the details for existing addresses, and indicating how each address is used.
12. Suppliers can also inactivate addresses that are obsolete. Buyer administrators need to approve any changes in order to update the master supplier details.
13. Address statuses include:
• New. A supplier has created a new address.
• Change Pending. A supplier has changed the address details. Click the Update icon to review the changes that have been made. The page displays the original address details and the changes, indicated by a blue dot. Buyer administrators can approve or make additional modifications to the changes before approving or rejecting the change. If the supplier has indicated that the address should be removed, there is a status change from Active to Inactive.
• Current. There are no pending updates for the address.
14. Since suppliers are stored in TCA, the address details for the supplier may be used by other Oracle products so be careful if removing supplier addresses. If the address is inactivated, the system no longer associates it to any contacts, and any bank account assignments to the address are inactivated. Methods to inactivate addresses include:
 You can click the Remove button on the Address Book page. This sets the address status to inactive and sets the Inactive Date for every site that is associated with the address in all operating units to today's date.
 You can update the address and set its status to Inactive. This changes the address status and does not inactivate any of the sites that are using the address.
 You can use the Manage Sites page to manually update the Inactive Date for each site.



HZ(TCA) tables in Oracle Receivables


This article describes few important HZ tables in AR and their relationships with each other.

HZ_PARTIES:

The HZ_PARTIES table stores basic information about parties that can be shared with any relationship that the party might establish with another party. The primary key for this table is PARTY_ID.

Few Important Columns are

ARTY_ID: Party identifier
PARTY_NUMBER: Unique identification number for this party
PARTY_NAME: Name of the party
PARTY_TYPE: The party type can only be Person, Organization, Group or Relationship.

HZ_PARTY_SITES:

The HZ_PARTY_SITES table links a party (HZ_PARTIES) and a location (HZ_LOCATIONS) and stores location-specific party information. One party can optionally have one or more party sites. One location can optionally be used by one or more parties. The primary key for this table is PARTY_SITE_ID.

Few Important Columns are

PARTY_SITE_ID: Party site identifier.
PARTY_ID: Identifier for the party. Foreign key to the HZ_PARTIES table.
LOCATION_ID: Identifier for the party site. Foreign key to the HZ_LOCATIONS table.
PARTY_SITE_NUMBER: Party site number.
PARTY_SITE_NAME: User-defined name for the site.
ADDRESSEE: Addressee information.

HZ_LOCATIONS:

The HZ_LOCATIONS table stores information about a delivery or postal address such as building number, street address, postal code, and directions to a location. This table provides physical location information about parties (organizations and people) and customer accounts. The primary key for this table is

LOCATION_ID:

Few Important Columns are

LOCATION_ID: Unique identifier for this location
COUNTRY: Country code from the TERRITORY_CODE column in the FND_TERRITORY table
ADDRESS1: First line for address
ADDRESS2: Second line for address
ADDRESS3: Third line for address
ADDRESS4: Fourth line for address
CITY: City
POSTAL_CODE: Postal Code
STATE: State
ADDRESS_KEY: Derived key that facilitates fuzzy searches

HZ_CUST_ACCOUNTS:

The HZ_CUST_ACCOUNTS table stores information about customer accounts , or business relationships that the deploying company establishes with a party of type Organization or Person. This table focuses on business relationships and how transactions are conducted in the relationship. Since a party can have multiple customer accounts, this table might contain several records for a single party. For example, an individual person can establish a personal account, family account, and a professional account for a consulting practice. The primary key for this table is CUST_ACCOUNT_ID.

Few Important Columns are

CUST_ACCOUNT_ID: Customer account identifier
PARTY_ID: A foreign key to the HZ_PARTY table.
ACCOUNT_NUMBER: Account Number
CUSTOMER_TYPE: Receivables lookup code for the CUSTOMER_TYPE attribute. I for internal customers, R for revenue generating external customers.
CUSTOMER_CLASS_CODE: Customer class identifier

HZ_CUST_ACCT_SITES_ALL:

The HZ_CUST_ACCT_SITES_ALL table stores all customer account sites across all operating units. Customer account sites are addresses, for customer accounts, where the deploying company does business with its customers. One customer account can have multiple customer account sites, and customer account sites for one customer account can belong to multiple operating units. The primary key for this table is CUST_ACCT_SITE_ID.

Few Important Columns are

CUST_ACCT_SITE_ID: Customer site identifier
CUST_ACCOUNT_ID: Identifier for a customer account. Foreign key to the HZ_CUST_ACCOUNTS table
PARTY_SITE_ID: Identifier for a party site. Foreign key to the HZ_PARTY_SITES table
BILL_TO_FLAG: Indicates if this is a Bill-To site.
SHIP_TO_FLAG: Indicates if this is a Ship-To site.
MARKET_FLAG: Indicates if this is a Marketing site.

HZ_CUST_SITE_USES_ALL:

The HZ_CUST_SITE_USES_ALL table stores business purposes assigned to customer account sites, for example Bill-To, Ship-To, and Statements. Each customer account site can have one or more purposes. This table is a child of the HZ_CUST_ACCT_SITES_ALL table, with the foreign
key CUST_ACCT_SITE_ID. The HZ_CUST_SITE_USES_ALL table also stores operating unit identifier, though the HZ_CUST_ACCT_SITES_ALL table itself stores the operating unit for customer account sites. The primary key for this table is SITE_USE_ID.

Few Important Columns are

SITE_USE_ID: Site use identifier
CUST_ACCT_SITE_ID: Identifier for the customer account site. Foreign key to the HZ_CUST_ACCT_SITES_ALL table
SITE_USE_CODE: Business purpose assigned to customer site account, such as Bill-To, Market, and Statements.
PRIMARY_FLAG: Indicates if this site is the primary site for this customer account. Y for the primary customer account site. N for other customer account sites.

HZ_CUSTOMER_PROFILES:

The HZ_CUSTOMER_PROFILES table stores information about the credit characteristics of a single customer account or a customer account site or a party. A profile class defined in the
HZ_CUSTOMER_PROFILE_CLASSES table can be used to provide default values for the attributes in this table. The primary key for this table is CUST_ACCOUNT_PROFILE_ID.

Few Important Columns are

CUST_ACCOUNT_PROFILE_ID: Unique identifier of this customer profile
CUST_ACCOUNT_ID: Identifier for the Customer Account. Foreign key to the HZ_CUST_ACCOUNTS table.
STATUS: Indicates whether the profile is active or inactive

HZ_CUST_PROFILE_CLASSES:

The HZ_CUST_PROFILE_CLASSES table stores information about the credit characteristics that are common across a group of customer accounts. The characteristics specified in this table can be used as default characteristics for similar customer accounts. The primary key for this table is PROFILE_CLASS_ID.

HZ_PARTY_RELATIONSHIPS:

The HZ_PARTY_RELATIONSHIPS table stores information about relationships between parties.



Thanks
Sajal Agarwal

Oracle applications – order management tables and its details

Entered
oe_order_headers_all 1 record created in header tableoe_order_lines_all Lines for particular records
oe_price_adjustments When discount gets applied
oe_order_price_attribs If line has price attributes then populated
oe_order_holds_all If any hold applied for order like credit check etc.
Booked
oe_order_headers_all Booked_flag=Y Order booked.wsh_delivery_details Released_status Ready to release
Pick Released 
wsh_delivery_details Released_status=Y Released to Warehouse (Line has been released to Inventory for processing)
wsh_picking_batches After batch is created for pick release. 
mtl_reservations This is only soft reservations. No physical movement of stock
Full Transaction
mtl_material_transactions No records in mtl_material_transactionsmtl_txn_request_headers
mtl_txn_request_lines
wsh_delivery_details Released to warehouse.wsh_new_deliveries if Auto-Create is Yes then data populated.wsh_delivery_assignments deliveries get assigned
Pick Confirmed
wsh_delivery_details Released_status=Y Hard Reservations. Picked the stock. Physical movement of stock
Ship Confirmed
wsh_delivery_details Released_status=C Y To C:Shipped ;Delivery Note get printed Delivery assigned to trip stopquantity will be decreased from stagedmtl_material_transactions On the ship confirm form, check Ship all boxwsh_new_deliveries If Defer Interface is checked I.e its deferred then OM & inventory not updated. If Defer Interface is not checked.: Shipped
oe_order_lines_all Shipped_quantity get populated.wsh_delivery_legs 1 leg is called as 1 trip.1 Pickup & drop up stop for each trip.
oe_order_headers_all If all the lines get shipped then only flag N
Autoinvoice
wsh_delivery_details Released_status=I Need to run workflow background process.
ra_interface_lines_all Data will be populated after wkfw process.
ra_customer_trx_all After running Autoinvoice Master Program forra_customer_trx_lines_all specific batch transaction tables get populated
Price Detailsqp_list_headers_b To Get Item Price Details.
qp_list_lines
Items On Hand Qty
mtl_onhand_quantities TO check On Hand Qty Items.
Payment Terms
ra_terms Payment terms
AutoMatic Numbering System
ar_system_parametes_all you can chk Automactic Numbering is enabled/disabled.
Customer Information
hz_parties Get Customer information include name,contacts,Address and Phonehz_party_sites
hz_locations
hz_cust_accounts
hz_cust_account_sites_all
hz_cust_site_uses_all
ra_customers
Document Sequence
fnd_document_sequences Document Sequence Numbersfnd_doc_sequence_categories
fnd_doc_sequence_assignments
Default rules for Price List
oe_def_attr_def_rules Price List Default Rulesoe_def_attr_condns
ak_object_attributes
End User Details 
csi_t_party_details To capture End user Details
Sales Credit Sales Credit Information(How much credit can get)oe_sales_credits

Attaching Documents 
fnd_attached_documents Attched Documents and Text information
fnd_documents_tl
fnd_documents_short_text
Blanket Sales Order
oe_blanket_headers_all Blanket Sales Order Information.
oe_blanket_lines_all

Processing Constraints
oe_pc_assignments Sales order Shipment schedule Processing Constratins
oe_pc_exclusions
Sales Order Holds
oe_hold_definitions Order Hold and Managing Details.
oe_hold_authorizations
oe_hold_sources_all
oe_order_holds_all
Hold Relaese
oe_hold_releases_all Hold released Sales Order.
Credit Chk Details
oe_credit_check_rules To get the Credit Check Againt Customer.
Cancel Ordersoe_order_lines_all Cancel Order Details.



Monday, May 12, 2014

Workflow TimeOut activity


This is short post about "how Timeout" Parameter work in a workflow activity.


For any workflow activity we have property Timeout "check the Node tab of workflow activity tab". Timeout has 3 values


1. No Timeout
2. Item Attribute
3. Relative Time

No Timeout - means no timeout at all.
Item Attribute - this value will be populated from an attribute

Relative Time - means we can hardcoded time out values in days/hours/minutes based on the requirement, and in this post I will talk about this only. 

Please note that once an activity is time out it will be picked up by the workflow background process (WBP). WBP will pick a time out activity only when it is eligible for Pickup.

Let says relative Timeout is 30 minutes and WBP us scheduled to run after every 10 minutes. Once this activity is time out WBP will not pick it immediately, it will pick it after 30 minutes only (as per out example on 3rd run).


Recently we came across an issue where customer has activity A1.
On execution A1 ,

  1. workflow progress to A3  if there is HOLD and once we release HOLD workflow progress to A6.
  2. If there is no Hold detected on execution of A1, workflow  progress to A2 , A5 etc 


Customer stated that if A1 detect a Hold it go to A3 and remain there for ever, even after the Hold has been released. some how WPG is not progressing  A3 to A6, thus hundreds of records stuck in A3. Customer has also stated that same thing was working earlier without any issue, he also stated that after removing the Hold If he Manually Progress the records that stuck at A3, workflow Progress to A6.

On Investigation we notice that some how they set the time out to 100 days and because of that WBP was not picking A3 at all ( after hold has released) .
As per this setup of time-out this activity will be eligible to progress by workflow Background process only after 100 days.

To fix the issue ,we set the relative time to a reasonable value and everything works fine.

Be careful when you decide about attribute like this.


Friday, May 2, 2014

Processing Constraints in Oracle Order management

Processing constraints are rules that control who can change what and when they can change it. Processing constraints can prevent certain changes, but can also be set up to perform actions based on those changes. They can define actions that can result from these changes, such as requiring a reason for the change, triggering an action in Audit Trail or Versioning, or raising an Integration Event.

This post describes how to set up your processing constraints based on validation conditions in validation templates (for example, Booked = Yes) which are evaluated for groups of records (record sets).
Processing constraints are rules that control
·         Who can change?
·         What change is allowed?
·         When the change is permissible?

Setup processing constraints for Create, Delete, Update and Cancel operations for order or line based on user responsibility.

Example:
Cancel sales orders, order lines, returns, and return lines.  Order Management automatically adjusts reservations for canceled lines.  The order cancellation feature of Order Management enables you to specify who has the authority to perform a cancellation request.  Cancellations look at constraints.  If you are allowed to cancel sales, the system will perform a cancellation request.  Once a line or order is cancelled, the workflow closes the line.
Processing constraints for orders and returns determine whether you can cancel orders, returns, and lines based on their workflow status.  In addition to your user defined processing constraints, system defined rules exist.  Under these rules you cannot cancel an order if:

·         It has been closed.
·         It has already been cancelled
·         A work order is open for an ATO line.
·         Any part of a line has been shipped or invoiced.
·         Any return line has been received or credited.
Order Management honors processing constraints that you define for the Cancel operation that are stricter than these rules, but if you define any that conflict with these rules, they are ignored.

To prevent a responsibility from cancelling:
Navigate to:        Setup>Rules>Processing Constraints


        Select the entity to be constrained.
        Select the operation to be constrained.
        Enter the constraining conditions.

In the Applicable To Tab:
        Select the responsibilities authorized to perform this operation.
        Save the constraint.

To allow a responsibility to cancel when a reason is provided:
        Select the entity to be constrained.
        Select the operation to be constrained.
        Select the action to be taken if this constraint occurs.
        Enter the constraining conditions.
        Enter the responsibility constrained from performing this operation.
        Save the constraint. 


Select an Attribute to constraint, based upon the operation selected.
    If you select the value UPDATE for the Operation field and you do not select an Attribute value, the constraint allows no update to any field of the entity, by any user.
In User Action, select one of the following:
        Not Allowed: You cannot perform the constrained operation
        Require Reason and History: You can perform the operation only if you enter a reason. Use this with Operation CANCEL, Operation UPDATE if the constrained attribute is Ordered Quantity only, and for recording Audit Trail history when requiring a reason for an attribute change
        Requires History: You can perform the operation and will not be prompted to
·         Enter a Reason. You still have the option to enter both a Reason and Comment, and if you do so, the information is recorded. Use the value for enabling Audit Trail history to be recorded without a reason for an attribute change


Following are the user actions that can be performed:






Processing Constraints Listing Report:
List all processing constraints and the corresponding constrained entities, constrained attributes, constrained operations, validation entities, record sets, validation templates and responsibilities to which constraint is applicable.

 
 
 
 

Tuesday, April 29, 2014

Migrating, Upgrading, and Downgrading Overview



This section explains the difference between migrating, upgrading, and downgrading, and lists the Oracle database versions that can be migrated or upgraded.

What Is Migrating?

Migrating is the process of transforming an installed version of an Oracle database into a later version. For example, transforming an Oracle7 database to an Oracle8i database is migrating the database system.

What Is Upgrading?

Upgrading is the process of transforming an installed version of an Oracle database release into another release of the same version. For example, transforming an Oracle8 database Release 8.0.4 to Release 8.1.6 is upgrading the database system.


What Is Downgrading?

Downgrading is the process of transforming an installed version of an Oracle database from a later release back into an earlier release. For example, transforming an Oracle database from Release 8.1.6 back into Release 8.0.4 is downgrading, and transforming an Oracle database from Version8 back into Version7 is downgrading.





Thanks

PL/SQL Multiple choice Interview Question and answer


1. Examine this procedure: CREATE OR REPLACE PROCEDURE

DELETE_PLAYER(V_IDIN NUMBER) IS BEGIN DELETE FROM PLAYER WHERE ID =
V_ID EXCEPTION WHEN STATS_EXI TS_EXCEPTI ON 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. Only predefined exceptions are allowed in the EXCEPTION section.

Answer  C

2. Under which two circumstances do you design database triggers? (Choose two)

A. To duplicate the functionality of other triggers.
B. To replicate built-in constraints in the Oracle server such as primary key and foreign key.
C. To guarantee that when a specific operation is performed, related actions are performed.
D. For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement.

Answer C, D

3. Local procedure A calls remote procedure B. Procedure B was compiled at 8 A.M. Procedure

A was modified and recompiled at 9 A.M. Remote procedure B was later modified and recompiled at 11 A.M. The dependency mode is set to TI MESTAMP. What happens when procedure A is invoked at 1 P.M?

A. There is no affect on procedure A and it runs successfully.
B. Procedure B is invalidated and recompiles when invoked.
C. Procedure A is invalidated and recompiles for the first time it is invoked.
D. Procedure A is invalidated and recompiles for the second time it is invoked.

Answer  D


4. This statement fails when executed:

CREATE OR REPLACE TRI GGER CALC_TEAM_AVG
AFTER I NSERT ON PLAYER
BEGIN
INSERT INTO PLAYER_BATSTAT ( PLAYER_I D, SEASON_YEAR, AT_BATS, HI TS)
VALUES ( : NEW. I D, 1 997, 0, 0) ;
END;

To which type must you convert the trigger to correct the error?

A. Row
B. Statement
C. ORACLE FORM trigger
D. Before

Answer  A

5. An internal LOB is _____.

A. A table.
B. A column that is a primary key.
C. Stored in the database.
D. A file stored outside of the database, with an internal pointer to it from a database column.

Answer   C


6. You have a row level BEFORE UPDATE trigger on the EMP table. This trigger contains a

SELECT statement on the EMP table to ensure that the new salary value falls within the minimum and maximum salary for a given job title. What happens when you try to update a salary value in the EMP table?

A. The trigger fires successfully.
B. The trigger fails because it needs to be a row level AFTER UPDATE trigger.
C. The trigger fails because a SELECT statement on the table being updated is not allowed.
D. The trigger fails because you cannot use the minimum and maximum functions in a BEFORE UPDATE trigger.

Answer   C

7. You need to implement a virtual private database (vpd). In order to have the vpd functionality, a trigger is required to fire when every user initiates a session in the database.

What type of trigger needs to be created?

A. DML trigger
B. System event trigger
C. INSTEAD OF trigger
D. Application trigger

Answer  B

8. Examine this code:

CREATE OR REPLACE PROCEDURE insert_dept (p_location_id NUMBER)
IS v_dept_id NUMBER(4);
BEGIN INSERT INTO departments
VALUES (5, .Education ., 150, p_location_id);
SELECT department_id INTO v_dept_id FROM employees WHERE employee_id=99999;
END insert_dept; /

 CREATE OR REPLACE PROCEDURE insert_location ( p_location_id NUMBER, p_city VARCHAR2)
 IS BEGIN
INSERT INTO locations(location_id, city)
VALUES (p_location_id, p_city);
 insert_dept(p_location_id);
 END insert_location; /

You just created the departments, the locations, and the employees table. You did not insert any rows. Next you created both procedures. You new invoke the insert_location procedure using the following command: EXECUTE insert_location (19, .San Francisco .) What is the result in this EXECUTE command?

A. The locations, departments, and employees tables are empty.
B. The departments table has one row. The locations and the employees tables are empty.
C. The location table has one row. The departments and the employees tables are empty.
D. The locations table and the departments table both have one row. The employees table is empty.

Answer  A


9. The OLD and NEW qualifiers can be used in which type of trigger?

A. Row level DML trigger
B. Row level system trigger
C. Statement level DML trigger
D. Row level application trigger
E. Statement level system trigger
F. Statement level application trigger

Answer  A

10. Which view displays indirect dependencies, indenting each dependency?

A. DEPTREE
B. IDEPTREE
C. INDENT_TREE
D. I_DEPT_TREE

Answer  B

12. Examine this code:

CREATE OR REPLACE PROCEDURE audit_action (p_who VARCHAR2) AS

BEGIN INSERT INTO audit(schema_user) VALUES(p_who);

END audit_action; /

CREATE OR REPLACE TRIGGER watch_it

AFTER LOGON ON DATABASE CALL audit_action(ora_login_user) /

What does this trigger do?

A. The trigger records an audit trail when a user makes changes to the database.
B. The trigger marks the user as logged on to the database before an audit statement is issued.
C. The trigger invoked the procedure audit_action each time a user logs on to his/her schema and adds the username to the audit table.
D. The trigger invokes the procedure audit_action each time a user logs on to the database and adds the username to the audit table.

Answer  D

13. Examine this procedure:

CREATE OR REPLACE PROCEDURE UPD_BAT_STAT (V_ID IN NUMBER DEFAULT 10, V_AB IN NUMBER DEFAULT 4) IS
BEGIN
UPDATE PLAYER_BAT_STAT
SET AT_BATS = AT_BATS + V_AB
 WHERE PLAYER_ID = V_ID;
COMMIT;
END;

Which two statements will successfully invoke this procedure in SQL *Plus? (Choose two)

A. EXECUTE UPD_BAT_STAT;
B. EXECUTE UPD_BAT_STAT(V_AB=>10, V_ID=>31);
C. EXECUTE UPD_BAT_STAT(31, ‘FOUR’, ‘TWO’);
D. UPD_BAT_STAT(V_AB=>10, V_ID=>31);
E. RUN UPD_BAT_STAT;

Answer  A, B

14. Examine this code:

CREATE OR REPLACE FUNCTION gen_email_name (p_first_name VARCHAR2,

p_last_name VARCHAR2, p_id NUMBER)

RETURN VARCHAR2 IS

v_email_name VARCHAR2(19);

BEGIN v_email_name := SUBSTR(p_first_name, 1, 1) || SUBSTR(p_last_name, 1, 7) ||

.@Oracle.com .;

UPDATE employees SET email = v_email_name

WHERE employee_id = p_id; RETURN v_email_name;

END;

Which statement removes the function?

A. DROP gen_email_name;

B. REMOVE gen_email_name;

C. DELETE gen_email_name;

D. DROP FUNCTION gen_email_name;

Answer  D

15. Examine this code:

CREATE OR REPLACE PACKAGE comm_package IS

g_comm NUMBER := 10;

PROCEDURE reset_comm(p_comm IN NUMBER);

END comm_package; /

User Jones executes the following code at 9:01am:

EXECUTE comm_package.g_comm := 15

User Smith executes the following code at 9:05am:

EXECUTE comm_paclage.g_comm := 20 Which statement is true?

A. g_comm has a value of 15 at 9:06am for Smith.

B. g_comm has a value of 15 at 9:06am for Jones.

C. g_comm has a value of 20 at 9:06am for both Jones and Smith.

D. g_comm has a value of 15 at 9:03 am for both Jones and Smith.

E. g_comm has a value of 10 at 9:06am for both Jones and Smith.

F. g_comm has a value of 10 at 9:03am for both Jones and Smith

Answer  B

16. Examine this package:

CREATE OR REPLACE PACKAGE BB_PACK IS V_MAX_TEAM_SALARY

NUMBER(12,2);

PROCEDURE ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME VARCHAR2,

V_SALARY NUMBER);

END BB_PACK; /

CREATE OR REPLACE PACKAGE BODY BB_PACK IS

V_PLAYER_AVG NUMBER(4,3);

PROCEDURE UPD_PLAYER_STAT V_ID IN NUMBER, V_AB IN NUMBER DEFAULT 4,

V_HITS IN NUMBER) IS

BEGIN UPDATE PLAYER_BAT_STAT SET AT_BATS = AT_BATS + V_AB, HITS = HITS +

V_HITS WHERE PLAYER_ID = V_ID;

COMMIT;

VALIDATE_PLAYER_STAT(V_ID);

END UPD_PLAYER_STAT;

PROCEDURE ADD_PLAYER (V_ID IN NUMBER, V_LAST_NAME VARCHAR2,

V_SALARY NUMBER) IS

BEGIN INSERT INTO PLAYER(ID,LAST_NAME,SALARY) VALUES (V_ID,

V_LAST_NAME, V_SALARY); UPD_PLAYER_STAT(V_ID,0,0);

END ADD_PLAYER;

END BB_PACK /

Which statement will successfully assign .333 to the V_PLAYER_AVG variable from a

procedure outside the package?

A. V_PLAYER_AVG := .333;

B. BB_PACK.UPD_PLAYER_STAT.V_PLAYER_AVG := .333;

C. BB_PACK.V_PLAYER_AVG := .333;

D. This variable cannot be assigned a value from outside of the package.

Answer: D


17. Examine this package:

CREATE OR REPLACE PACKAGE manage_emps IS

tax_rate CONSTANT NUMBER(5,2) := .28;

v_id NUMBER;

PROCEDURE insert_emp (p_deptno NUMBER, p_sal NUMBER);

PROCEDURE delete_emp; PROCEDURE update_emp;

FUNCTION calc_tax (p_sal NUMBER) RETURN NUMBER;

END manage_emps; /

CREATE OR REPLACE PACKAGE BODY manage_emps IS

PROCEDURE update_sal (p_raise_amt NUMBER) IS

BEGIN UPDATE emp SET sal = (sal * p_raise_emt) + sal WHERE empno = v_id;

END;

PROCEDURE insert_emp (p_deptno NUMBER, p_sal NUMBER) IS

BEGIN INSERT INTO emp(empno, deptno, sal) VALYES(v_id, p_depntno, p_sal);

END insert_emp;

PROCEDURE delete_emp IS

BEGIN DELETE FROM emp WHERE empno = v_id;

END delete_emp;

PROCEDURE update_emp IS v_sal NUMBER(10, 2); v_raise NUMBER(10, 2);

BEGIN SELECT sal INTO v_sal FROM emp WHERE empno = v_id;

IF v_sal < 500 THEN v_raise := .05;

ELSIF v_sal < 1000 THEN v_raise := .07;

ELSE v_raise := .04;

END IF; update_sal(v_raise);

END update_emp;

FUNCTION calc_tax (p_sal NUMBER) RETURN NUMBER IS

BEGIN RETURN p_sal * tax_rate;

END calc_tax;

END manage_emps; /

What is the name of the private procedure in this package?

A. CALC_TAX

B. INSERT_EMP

C. UPDATE_SAL

D. DELETE_EMP

E. UPDATE_EMP

F. MANAGE_EMPS

Answer  C

18. Which two dopes the INSTEAD OF clause in a trigger identify? (Choose two)

A. The view associated with the trigger.

B. The table associated with the trigger.

C. The event associated with the trigger.

D. The package associated with the trigger.

E. The statement level or for each row association to the trigger.

Answer  A, C

19. Which three are valid ways to minimize dependency failure? (Choose three)

A. Querying with the SELECT * notification.

B. Declaring variables with the %TYPE attribute.

C. Specifying schema names when referencing objects.

D. Declaring records by using the %ROWTYPE attribute.

E. Specifying package.procedure notation while executing procedures.

Answer  A, B, D

20. Examine this code: CREATE OR REPLACE PROCEDURE add_dept ( p_name

departments.department_name%TYPE DEFAULT .unknown ., p_loc

departments.location_id%TYPE DEFAULT 1700) IS BEGIN INSERT INTO

departments(department_id, department_name, loclation_id)

VALUES(dept_seq.NEXTVAL,p_name, p_loc); END add_dept; / You created the add_dept

procedure above, and you now invoke the procedure in SQL *Plus.

Which four are valid invocations? (Choose four)

A. EXECUTE add_dept(p_loc=>2500)

B. EXECUTE add_dept(‘Education’, 2500)

C. EXECUTE add_dept(’2500′, p_loc =>2500)

D. EXECUTE add_dept(p_name=>’Education’, 2500)

E. EXECUTE add_dept(p_loc=>2500, p_name=>’Education’)

Answer  A, B, C, E


21. Examine the procedure:

CREATE OR REPLACE PROCEDURE INSERT TEAM

(V_ID in NUMBER,V_CITY in VARCHER2 DEFAULT ‘AUSTIN’V_NAME

in VARCHER2)

IS

BEGIN

INSERT INTO TEAM (id, city,name)

VALUES (v_id,v_city,v_name);

COMMIT;

END;

Which two statements will successfully invoke this procedure in SQL Plus? (Choose two)

A. EXECUTE INSERT_TEAM;

B. EXECUTE INSERT_TEAM (3, V_NAME=>’LONGHORNS’, V_CITY=>’AUSTIN’);

C. EXECUTE INSERT_TEAM (3, ‘AUSTIN’, ‘LONGHORNS’);

D. EXECUTE INSERT_TEAM (V_ID := V_NAME := ‘LONGHORNS’, V_CITY := ‘AUSTIN’);

E. EXECUTE INSERT_TEAM (3, ‘LONGHORNS’);

Answer:  B, C

22. How can you migrate from a LONG to a LOB data type for a column?

A. Use the DBMS_MANAGE_LOB.MIGRATE procedure.

B. Use the UTL_MANAGE_LOB.MIGRATE procedure.

C. Use the DBMS_LOB.MIGRATE procedure.

D. Use the ALTER TABLE command.

E. You cannot migrate from a LONG to a LOB date type for a column.

Answer  D

23. You need to remove the database trigger BUSINESS_HOUR . Which command do you use

to remove the trigger in the SQL *Plus environment?

A. DROP TRIGGER business_hour;

B. DELETE TRIGGER business_hour;

C. REMOVE TRIGGER business_hour;

D. ALTER TRIGGER business_hour REMOVE;

E. DELETE FROM USER_TRIGGERS WHERE TRIGGER_NAME = .BUSINESS_HOUR;

Answer  A


24. You are about to change the arguments of the CALC_TEAM_AVG function. Which

dictionary view can you query to determine the names of the procedures and functions that

invoke the CALC_TEAM_AVG function?

A. USER_PROC_DEPENDS

B. USER_DEPENDENCIES

C. USER_REFERENCES

D. USER_SOURCE

Answer  B

25. You create a DML trigger. For the timing information, which is valid with a DML trigger?

A. DURING

B. INSTEAD

C. ON SHUTDOWN

D. BEFORE

E. ON STATEMENT EXECUTION

Answer  D


26. 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.

Answer  E

27. Which statement about triggers is true?

A. You use an application trigger to fire when a DELETE statement occurs.

B. You use a database trigger to fire when an INSERT statement occurs.

C. You use a system event trigger to fire when an UPDATE statement occurs.

D. You use INSTEAD OF trigger to fire when a SELECT statement occurs.

Answer B

28. Examine this procedure: CREATE OR REPLACE PROCEDURE ADD_PLAYER (V_ID IN

NUMBER, V_LAST_NAME VARCHAR2) IS BEGIN INSERT INTO PLAYER

(ID,LAST_NAME) VALUES (V_ID, V_LAST_NAME); COMMIT; END; This procedure must

invoke the APD_BAT_STAT procedure and pass a parameter. Which statement,

when added to the above procedure will successfully invoke the UPD_BAT_STAT procedure?

A. EXECUTE UPD_BAT_STAT(V_ID);

B. UPD_BAT_STAT(V_ID);

C. RUN UPD_BAT_STAT(V_ID);

D. START UPD_BAT_STAT(V_ID);

Answer  B

29. Which four triggering events can cause a trigger to fire? (Choose four)

A. A specific error or any errors occurs.

B. A database is shut down or started up.

C. A specific user or any user logs on or off.

D. A user executes a CREATE or an ALTER table statement.

E. A user executes a SELECT statement with an ORDER BY clause.

F. A user executes a JOIN statement that uses four or more tables.

Answer  A, B, C, D


30. There is a CUSTOMER table in a schema that has a public synonym CUSTOMER and you

are granted all object privileges on it. You have a procedure PROCESS_CUSTOMER that

processes customer information that is in the public synonym CUSTOMER table. You have just

created a new table called CUSTOMER within your schema. Which statement is true?

A. Creating the table has no effect and procedure PROCESS_CUSTOMER still accesses data from

public synonym CUSTOMER table.

B. If the structure of your CUSTOMER table is the same as the public synonym CUSTOMER table

then the procedure PROCESS_CUSTOMER is invalidated and gives compilation errors.

C. If the structure of your CUSTOMER table is entirely different from the public synonym

CUSTOMER table then the procedure PROCESS_CUSTOMER successfully recompiles and accesses

your CUSTOMER table.

D. If the structure of your CUSTOMER table is the same as the public synonym CUSTOMER table

then the procedure PROCESS_CUSTOMER successfully recompiles when invoked and accesses your

CUSTOMER table.

Answer  D

31. Examine this package: CREATE OR REPLACE PACKAGE BB_PACK IS

V_MAX_TEAM_SALARY NUMBER(12,2); PROCEDURE ADD_PLAYER(V_ID IN

NUMBER, V_LAST_NAME VARCHAR2, V_SALARY_NUMBER; END BB_PACK; /

CREATE OR REPLACE PACKAGE BODY BB_PACK IS PROCEDURE

UPD_PLAYER_STAT (V_ID IN NUMBER, V_AB IN NUMBER DEFAULT 4, V_HITS IN

NUMBER) IS BEGIN UPDATE PLAYER_BAT_STAT SET AT_BATS = AT_BATS + V_AB,

HITS = HITS + V_HITS WHERE PLAYER_ID = V_ID) COMMIT; END

UPD_PLAYER_STAT; PROCEDURE ADD_PLAYER (V_ID IN NUMBER, V_LAST_NAME

VARCHAR2, V_SALARY NUMBER) IS BEGIN INSERT INTO

PLAYER(ID,LAST_NAME,SALARY) VALUES (V_ID, V_LAST_NAME, V_SALARY);

UPD_PLAYER_STAT(V_ID,0.0); END ADD_PLAYER; END BB_PACK; Which statement

will successfully assign $75,000,000 to the V_MAX_TEAM_SALARY variable from within a

stand-alone procedure?

A. V_MAX_TEAM_SALARY := 7500000;

B. BB_PACK.ADD_PLAYER.V_MAX_TEAM_SALARY := 75000000;

C. BB_PACK.V_MAX_TEAM_SALARY := 75000000;

D. This variable cannot be assigned a value from outside the package.

Answer  C

32. Examine this code: CREATE OR REPLACE TRIGGER update_emp AFTER UPDATE ON

emp BEGIN INSERT INTO audit_table (who, dated) VALUES (USER, SYSDATE); END; You

issue an UPDATE command in the EMP table that results in changing 10 rows. How many rows

are inserted into the AUDIT_TABLE ?

A. 1

B. 10

C. None

D. A value equal to the number of rows in the EMP table.

Answer  A

33. Examine this package

CREATE OR REPLACE PACKAGE discounts IS

G_ID NUMBER:=7839;

DISCOUNT_RATE NUMBER 0. 00;

PROCEDURE DISPLAY_PRICE (V_PRICE NUMBER);

END DISCOUNTS;

/

CREATE OR REPLACE PACKAGE BODY discounts

IS

PROCEDURE DISPLAY_PRICE (V_PRICE_NUMBER)

IS

BEGIN DBMS_OUTPUT.PUT_LINE(‘DISCOUNTED||2_4

(V_PRICE*NVL(DISCOUNT_RATE, 1)))

END DISPLAY_PRICE;

BEGIN DISCOUNT_RATE;=0. 10;

END DISCOUNTS;

/

Which statement is true?

A. The value of DISCOUNT_RATE always remain 0. 00 in a session.

B. The value of DISCOUNT_RATE is set to 0. 10 each time the package are invoked in a session.

C. The value of DISCOUNT_RATE is set to 1 each time the procedure DISPLAY_PRICE is invoked.

D. The value of DISCOUNT_RATE is set to 0. 10 when the package is invoked for first time in a

session.

Answer:  D



34. Examine this code:CREATE OR REPLACE TRIGGER secure_emp BEFORE LOGON ON

employees BEGIN IF (TO_CHAR(SYSDATE, .DY.) IN ( .SAT., .SUN.)) OR

(TO_CHAR(SYSDATE, .HH24:MI .) NOT BETWEEN .08:00 AND .18:00 )

THEN RAISE_APPLICATION_ERROR (-20500, .You may insert into the EMPLOYEES table

only during business hours. .);

END IF;

END;

What type of trigger is it?

A. DML trigger

B. INSTEAD OF trigger

C. Application trigger

D. System event trigger

E. This is an invalid trigger.

Answer  E

35. Which table should you query to determine when your procedure was last compiled?

A. USER_PROCEDURES

B. USER_PROCS

C. USER_OBJECTS

D. USER_PLSQL_UNITS

Answer  C

36. Examine this code:CREATE OR REPLACE FUNCTION gen_email_name (p_first_name

VARCHAR2, p_last_name VARCHAR2, p_id NUMBER) RETURN VARCHAR2 is

v_email_name VARCHAR2(19);

BEGIN v_email_home := SUBSTR(p_first_name, 1, 1) || SUBSTR(p_last_name, 1, 7) ||

.@Oracle.com .;

UPDATE employees SET email = v_email_name WHERE employee_id = p_id; RETURN

v_email_name;

END;

You run this SELECT statement:

SELECT first_name, last_name gen_email_name(first_name, last_name, 108) EMAIL FROM

employees; What occurs?

A. Employee 108 has his email name updated based on the return result of the function.

B. The statement fails because functions called from SQL expressions cannot perform DML.

C. The statement fails because the functions does not contain code to end the transaction.

D. The SQL statement executes successfully, because UPDATE and DELETE statements are ignoring

in stored functions called from SQL expressions.

E. The SQL statement executes successfully and control is passed to the calling environment.

Answer  B

37. What part of a database trigger determines the number of times the trigger body executes?

A. Trigger type

B. Trigger body

C. Trigger event

D. Trigger timing

Answer  A

38. What happens during the execute phase with dynamic SQL for INSERT, UPDATE, and

DELETE operations?

A. The rows are selected and ordered.

B. The validity of the SQL statement is established.

C. An area of memory is established to process the SQL statement.

D. The SQL statement is run and the number of rows processed is returned.

E. The area of memory established to process the SQL statement is released.

Answer  D

39. Given a function CALCTAX : CREATE OR REPLACE FUNCTION calc tax (sal

NUMBER) RETURN NUMBER IS BEGIN RETURN (sal * 0.05); END;

If you want to run the above function from the SQL *Plus prompt, which statement is true?

A. You need to execute the command CALCTAX(1000); .

B. You need to execute the command EXECUTE FUNCTION calc tax; .

C. You need to create a SQL *Plus environment variable X and issue the command :X :=

CALCTAX(1000); .

D. You need to create a SQL *Plus environment variable X and issue the command EXECUTE :X :=

CALCTAX;

E. You need to create a SQL *Plus environment variable X and issue the command EXECUTE :X :=

CALCTAX(1000);

Answer  E

40. Which statements are true? (Choose all that apply)

A. If errors occur during the compilation of a trigger, the trigger is still created.

B. If errors occur during the compilation of a trigger you can go into SQL *Plus and query the

USER_TRIGGERS data dictionary view to see the compilation errors.

C. If errors occur during the compilation of a trigger you can use the SHOW ERRORS command

within iSQL *Plus to see the compilation errors.

D. If errors occur during the compilation of a trigger you can go into SQL *Plus and query the

USER_ERRORS data dictionary view to see compilation errors.

Answer  A, C, D

41. You need to create a trigger on the EMP table that monitors every row that is changed and

places this information into the AUDIT_TABLE. What type of trigger do you create?

A. FOR EACH ROW trigger on the EMP table.

B. Statement-level trigger on the EMP table.

C. FOR EACH ROW trigger on the AUDIT_TABLE table.

D. Statement-level trigger on the AUDIT_TABLE table.

E. FOR EACH ROW statement-level trigger on the EMP table.

Answer  A

42. Examine this package: CREATE OR REPLACE PACKAGE BB:PACK IS

V_MAX_TEAM:SALAR NUMBER(12,2); PROCEDURE ADD_PLAYER(V_ID IN NUMBER,

V_LAST_NAME VARCHAR2, V_SALARY NUMBER); END BB_PACK; / CREATE OR

REPLACE PACKAGE BODY BB_PACK IS PROCEDURE UPD_PLAYER_STAT (V_ID IN

NUMBER, V_AB IN NUMBER DEFAULT 4, V_HITS IN NUMBER) IS BEGIN UPDATE

PLAYER_BAT_STAT SET AT_BATS = AT_BATS + V_AB, HITS = HITS + V_HITS WHERE

PLAYER_ID = V_ID; COMMIT; END UPD_PLAYER_STAT; PROCEDURE ADD_PLAYER

(V_ID IN NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER) IS BEGIN

INSERT INTO PLAYER(ID,LAST_NAME,SALARY) VALUES (V_ID, V_LAST_NAME,

V_SALARY); UPD_PLAYER_STAT(V_ID,0,0); END ADD_PLAYER; END BB_PACK; You

make a change to the body of the BB_PACK package. The BB_PACK body is recompiled. What

happens if the stand alone procedure VALIDATE_PLAYER_STAT references this package?

A. VALIDATE_PLAYER_STAT cannot recompile and must be recreated.

B. VALIDATE_PLAYER_STAT is not invalidated.

C. VALDIATE_PLAYER_STAT is invalidated.

D. VALIDATE_PLAYER_STAT and BB_PACK are invalidated.

Answer  B


43. Which code can you use to ensure that the salary is not increased by more than 10% at a

time nor is it ever decreased?

A. ALTER TABLE emp ADD CONSTRAINT ck_sal CHECK (sal BETWEEN sal AND sal*1.1);

B. CREATE OR REPLACE TRIGGER check_sal BEFORE UPDATE OF sal ON emp FOR EACH

ROW WHEN (new.sal < old.sal OR new.sal > old.sal * 1.1) BEGIN

RAISE_APPLICATION_ERROR ( – 20508, .Do not decrease salary not increase by more than 10% );

END;

C. CREATE OR REPLACE TRIGGER check_sal BEFORE UPDATE OF sal ON emp WHEN

(new.sal < old.sal OR new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( – 20508,

.Do not decrease salary not increase by more than 10% ); END;

D. CREATE OR REPLACE TRIGGER check_sal AFTER UPDATE OR sal ON emp WHEN

(new.sal < old.sal OR -new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( – 20508,

.Do not decrease salary not increase by more than 10% ); END;

Answer  B

44. Which two statements describe the state of a package variable after executing the package in

which it is declared? (Choose two)

A. It persists across transactions within a session.

B. It persists from session to session for the same user.

C. It does not persist across transaction within a session.

D. It persists from user to user when the package is invoked.

E. It does not persist from session to session for the same user.

Answer  A, E

45. Which two programming constructs can be grouped within a package? (Choose two)

A. Cursor

B. Constant

C. Trigger

D. Sequence

E. View

Answer  A, B


46. Examine this code:CREATE OR REPLACE PRODECURE add_dept (p_dept_name

VARCHAR2 DEFAULT .placeholder ., p_location VARCHAR2 DEFAULT .Boston .)

IS BEGIN INSERT INTO departments VALUES (dept_id_seq.NEXTVAL, p_dept_name,

p_location);

END add_dept; /

Which three are valid calls to the add_dep procedure ? (Choose three)

A. add_dept;

B. add_dept( .Accounting .);

C. add_dept(, .New York .);

D. add_dept(p_location=> .New York .);

Answer  A, B, D

47. You have created a stored procedure DELETE_TEMP_TABLE that uses dynamic SQL to

remove a table in your schema. You have granted the EXECUTE privilege to user A on this

procedure. When user A executes the DELETE_TEMP_TABLE procedure, under whose

privileges are the operations performed by default?

A. SYS privileges

B. Your privileges

C. Public privileges

D. User A.s privileges

E. User A cannot execute your procedure that has dynamic SQL.

Answer  B


48. Examine this function:

CREATE OR REPLACE FUNCTION CALC_PLAYER_AVG (V_ID in

PLAYER_BAT_STAT.PLAYER_ID%TYPE)

RETURN NUMBER IS V_AVG NUMBER;

BEGIN SELECT HITS / AT_BATS INTO V_AVG FROM PLAYER_BAT_STAT WHERE

PLAYER_ID = V_ID;

RETURN (V_AVG);

END;

Which statement will successfully invoke this function in SQL *Plus?

A. SELECT CALC_PLAYER_AVG(PLAYER_ID) FROM PLAYER_BAT_STAT;

B. EXECUTE CALC_PLAYER_AVG (31);

C. CALC_PLAYER (.RUTH.);

D. CALC_PLAYER_AVG(31);

E. START CALC_PLAYER_AVG(31)

Answer  A



49. The number of cascading triggers is limited by which data base initialization parameter?

A. CASCADE_TRIGGER_CNT.

B. OPEN_CURSORS.

C. OPEN_TRIGGERS.

D. OPEN_DB_TRIGGERS.

Answer: B


50. When creating store procedures and functions which construct allows you to transfer values

to and from the calling environment?

A. Local variables.

B. Arguments.

C. Boolean variables.

D. Substitution variables.

Answer:  B



51. You need to remove database trigger BUSINESS_RULE. Which command do you use to

remove the trigger in the SQL*Plus environment?

A. DROP TRIGGER business_rule;

B. DELETE TRIGGER business_rule;

C. REMOVE TRIGGER business_rule;

D. ALTER TRIGGER business_rule;

E. DELETE FROM USER_TRIGGER

F. WHERE TRIGGER_NAME= ‘BUSINESS_RULE’;

Answer:  A



52. Which two tables are fused track object dependencies? (Choose two)

A. USER_DEPENDENSIES.

B. USER_IDEPTREE.

C. IDEPTREE.

D. USER_DEPTREE.

E. USER_DEPENDS.

Answer:  A, C

53. The QUERY_PRODUCT procedure directly references the product table. There is a

NEW_PRODUCT_VIEW view created based on the NOT NULL columns of the table. The

ADD_PRODUCT procedure updates the table indirectly by the way of

NEW_PRODUCT_VIEW view. Under which circumstances does the procedure

ADD_PRODUCT get invalidated but automatically get complied when invoked?

A. When the NEW_PRODUCT_VIEW is dropped.

B. When rows of the product table are updated through SQI Plus.

C. When the internal logic of the QUERY_PRODUCT procedure is modified.

D. When a new column that can contain null values is added to the product table.

E. When a new procedure s created that updates rows in the product table directly.

Answer:  D



54. You need to recompile several program units you have recently modified through a PL/SQL

program. Which statement is true?

17

A. You cannot recompile program units using a PL/SQL program.

B. You can use the DBMS_DDL. REOMPILE package procedure to recompile the program units.

C. You can use the DBMS_ALTER. COMPILE packaged procedure to recompile the program units.

D. You can use the DBMS_DDL.ALTER_COMPILE packaged procedure to recompile the program

units.

E. You can use the DBMS_SQL.ALTER_COMPILE packaged procedure to recompile the program

units.

Answer:  D



55. Which type of argument passes a value from a calling environment?

A. VARCHER2.

B. BOOLEAN.

C. OUT.

D. IN.

Answer:  D



56. In order for you to create run a package MAINTAIN_DATA which privilege do you need?

A. EXECUTE privilege on the MAINTAIN_DATA package.

B. INVOKE privilege on the MAINTAIN_DATA package.

C. EXECUTE privilege on the program units in the MAINTAIN_DATA package.

D. Object privilege on all of the objects that the MAINTAIN_DATA package is accessing.

E. Execute privilege on the program units inside the MAINTAIN_DATA package and execute

privilege on the MAINTAIN_DATA package.

Answer:  A



57. You have created a script file EMP_PROC.SQL that holds the text to create a procedure

PROCESS_EMP. You have compiled the procedure for SQL Plus environment by running the

script file EMP_PROC.SQL. What happens if there are syntax errors in the procedure

PROCESS_EMP?

A. The errors are stored in the EMP_PROC.ERR file.

B. The errors are displayed to the screen when the script file is run.

C. The errors are stored in the procedure_errors data dictionary view.

D. YOU need to issue the SHOW ERRORS command in the SQL Plus environment to see the errors.

E. YOU need to issue the display errors command in the SQL Plus environment to see the errors.

Answer:  D



58. Which statement about the local dependent object is TRUE?

A. They are on different nodes.

B. They are in a different database.

C. They are on the same node in the same database.

D. They are on the same node in a different database.

Answer:  C



59. You need to create a stored procedure, which deletes rows from a table. The name

of the table from which the rows are to be deleted is unknown until run time.

Which method do you implement while creating such a procedure?

A. Use SQL command delete in the procedure to delete the rows.

B. Use DBMS_SQL packaged routines in the procedure to delete the rows.

C. Use DBMS_DML packaged routines in the procedure to delete the rows.

D. Use DBMSDELETE packaged routines in the procedure to delete the rows.

E. You cannot have a delete statement without providing a table name before compile time.

Answer:  B



60. Under which situation do you create a server side procedure?

A. When the procedure contains no SQL statements.

B. When the procedure contains no PL/SQL commands.

C. When the procedure needs to be used by many client applications accessing several remote

databases.

D. When the procedure needs to be used by many users accessing the same schema objects on a local

database.

Answer:  D



61. Which code successfully calculates tax?

A. CREATE OR REPLACE PROCEDURE calc (p_no IN NUMBER)

RETURN tax IS

V_sal NUMBER;

Tax NUMBER;

BEGIN

SELECT sal INTO v_sal

FROM emp

WHERE EMPNO=p_no;

Tax:=v_sal * 0. 05;

END;

B. CREATE OR REPLACE FUNCTION calctax (p_no NUMBER)

RETURN NUMBER IS

V_sal NUMBER;

BEGIN

SELECT sal INTO v_sal

FROM emp

WHERE empno =p_no;

RETURN (v_sal* 0. 05);

END;

C. CRETAE OR REPLACE FUNCTION calctax(p_no NUMBER)

RETURN NUMBER IS

V_sal NUMBER;

Tax NUMBER;

BEGIN

SELECT sal INTO v_sal

FROM emp

WHERE empno =p_no;

Tax:=v_sal * 0. 05;

END;

D. CREATE OR REPLACE FUNCTION calctax(p_no NUMBER)IS

V_sal NUMBER;

Tax NUMBER;

BEGIN

SELECT sal INTO v_sal

FROM emp

WHERE empno =p_no;

Tax :=v_sal * 0. 05;

RETURN(tax);

END;

Answer:  B



62. The programmer view developed a procedure ACCOUNT_TRANSACTION left

organization. You were assigned a task to modify this procedure. YOU want to find all the

program units invoking the ACCOUNT_TRANSACTION procedure.

How can you find this information?

A. Query the USER_SOURCE data dictionary view.

B. Query the USER_PROCEDURES data dictionary view.

C. Query the USER_DEPENDENCIES data dictionary views.

D. Set the SQL Plus environment variable trade code=true and run the ACCOUNT_TRANSACTION

procedure.

E. Set the SQL Plus environment variable DEPENDENCIES=TRUE and run the

Account_Transaction procedure.

Answer:  C


63. All users currently have the INSERT privileges on the PLAYER table. You want only your

users to insert into this table using the ADD_PLAYER procedure. Which two actions must you

take? (Choose two)

A. GRANT SELECT ON ADD_PLAYER TO PUBLIC;

B. GRANT EXECUTE ON ADD_PLAYER TO PUBLIC;

C. GRANT INSERT ON PLAYER TO PUBLIC;

D. GRANT EXECUTE, INSERT ON ADD_PLAYER TO PUBLIC;

E.  REVOKE INSERT ON PLAYER FROM PUBLIC;

Answer:  B, E



64. Which Oracle supply package allows you to run jobs at use defined times?

A. DBMS_JOB

B. DBMS_RUN

C. DBMS_PIPE

D. DBMS_SQL

Answer:  A



65. You need to drop a table from within a stored procedure. How do you implement this?

A. You cannot drop a table from a stored procedure.

B. Use the DROP command in the procedure to drop the table.

C. Use the DBMS_DDL packaged routines in the procedure to drop the table.

D. Use the DBMS_SQL packaged routines in the procedure to drop the table.

E. Use the DBMS_DROP packaged routines in the procedure to drop the table.

Answer:  D



66. Examine this package

CREATE OR REPLACE PACKAGE BB_PACK

IS

V_MAX_TEAM_SALARY NUMBER(12,2);

PROCEDURE ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME)

VARCHAR2(V_SALARY NUMBER);

END BB_PACK;

/

CREATE OR REPLACE PACKAGE BODY BB_PACK

IS

V_PLAYER_AVG NUMBER(4,3);

PROCEDURE UPD_PLAYER_STAT

V_ID IN NUMBER, V_AB IN NUMBER DEFAULT4, V_HITS IN NUMBER)

IS

BEGIN

UPDATE PLAYER_BAT_STAT

SET ADD_BAT=ADD_BATS+V_AB,

HITS=HITS+V_HITS

WHERE PLAYER_ID=V_ID;

COMMIT;

VALIDATE_PLAYER_STAT(V_ID);

END UPD_PLAYER_STAT;

PROCEDURE ADD_PLAYER

(V_ID IN NUMBER, V_LAST_NAME, VARCHAR2, V_SALARY IN NUMBER);

IS

BEGIN

INSERT INTO PLAYER (ID, LAST_NAME, SALARY)

VALUES(V_ID, V_LAST_NAME, V_SALARY);

UPD_PLAYER_STAT(V_ID,0,0);

END ADD_PLAYER;

END BB_PACK;

Which kind of packaged variables is V_MAX_TEAM_SALARY?

A. PRIVATE

B. PUBLIC

C. IN

D. OUT

Answer:  B



67. Examine this trigger.

CREATE OR REPLACE TRIGGER UPD_TEAM_SALARY

AFTER INSERT OR UPDATE OR DELETE ON PLAYER

FOR EACH ROW

BEGIN

UPDATE TEAM

SET TOT_SALARY=TOT_SALARY+:NEW SALARY.

WHERE ID=:NEW:TEAM_ID;

You will be adding additional coat later but for now you want the current block to

fire when updated the salary column. Which solution should you use to verify that

the user is performing an update on the salary column?

A. ROW_UPDATE(‘SALARY’)

B. UPDATING(‘SALARY’)

C. CHANGING(‘SALARY’)

D. COLUMN_UPDATE(‘SALARY’)

Answer:  B



68. Examine this package:

CREATE OR REPLACE PACKAGE BB_PACK

V_MAX_TEAM_SALARY NUMBER(12,2);

PROCEDURE ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME

VARCHAR2, V_SALARY NUMBER);

DB_PACK;/ CREATE OR REPLACE PACKAGE BODY BB_PACK

IS

V_WHERE_AVG NUMBER(4,3);

PROCEDURE UPD_PLAYER_STAT

(V_ID IN NUMBER, V_AVG IN NUMBER DEFAULT 4,V_HITS IN NUMBER)

IS

BEGIN

UPDATE PLAYER_BAT_STAT

SET AT_BATS=AT_BATS+V_AB,

HITS=HITS+V_HITS

WHERE PLAYER_ID=V_ID;

COMMIT;

VALIDATE_PLAYER_STAT(V_ID);

END UPD_PLAYER_STAT;

PROCEDURE ADD-PLAYER

 (V_ID IN NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER)

IS

BEGIN

INSERT INTO PLAYER(ID, LAST_NAME, SALARY)

VALUES(V_ID, V_LAST_NAME, V_SALARY);

UPD_PLAYER_STAT(V_ID,0,0);

END ADD_PLAYER;

END BB_PACK;

An outside procedure VALIDATE_PLAYER_STAT is executed from this package.

What will happen when this procedure changes?

A. The package specification is dropped.

B. The package specification is invalidated.

C. The package is invalidate.

D. The package body is invalidated.

Answer:  D



69. Examine this package

CREATE OR REPLACE PACKAGE PACK_CUR

IS

CURSOR C1 IS

SELECT PRODID

FROM PRODUCT ORDER BY PRODID DESC;

PROCEDURE PROC1;

PROCEDURE PROC2;

END PACK_CUR;

/

CREATE OR REPLACE PACKAGE BODY PACK_CUR

IS

V_ID NUMBER;

PROCEDURE PROC1 IS

BEGIN

OPEN C1;

LOOP

FETCH C1 INTO V_PRODID;

DBMS_OUTPUT. PUT_LINE (ROW IS :,||C1/ROWCOUNT);

EXIT WHEN C1/ROWCOUNT>=3;

END LOOP;

END PROC1;

PROCEDURE PROC2 IS

BEGIN

LOOP

FETCH C1 TO V_PRODID

DBMS_OUTPUT. PUT_LINE (ROW IS :,||C1/ROWCOUNT);

EXIT WHEN C1/ROWCOUNT>=6;

END LOOP;

CLOSE C1;

END PROC2;

END PACK_CUR;

/

The products table has more than 1000 rows. The SQL plus server output setting is

turned on in your session. You execute procedure proc1 fromsql plus with the

command:

EXECUTE PACK_CUR.PROC1. What is the output in your session?

A.  Error at line 1

B.   Row is:

Row is:

Row is:

C.  Row is:1

Row is:2

Row is:3

D.  Row is:4

Row is:5

Row is:6

Answer:  C



70. Which two statements about packages are true? (Choose two)

A. Both specifications and body are required components of a package.

B. Package specification is optional but the package body is required.

C. A package specification is required but the package body is optional.

D. The specification and body of the package is stored together in a database.

E. The specification and body of the package are stored separately in the database.

Answer:  C, E



71. You want to send a message to another session connected to the same instance.

Which Oracle supplied package will you use to achieve this task?

A. DBMS_JOB

B. DBMS_PIPES

C. DBMS_OUTPUT

D. DBMS_MESSAGE

E. SEND_MESSAGE

Answer:  B



72. Which system privileges must you have to manually recompile a stored procedure

owned by another application developer?

A. ALTER PROCEDURE

B. ALTER ANY PROCEDURE

C. ALTER ALL PROCEDURE

D. COMPILE ANY PROCEDURE

Answer:  B



73. Which situation requires a before update statement level trigger on the table?

A. When you need to populate values of each updated row into another table.

B. When a trigger must fire for each row affected by the triggering statement.

C. When you need to make sure that user making modifications to the table as necessary privileges.

D. When you need to store the information of the use who successfully modified tables and in audit

table.

Answer:  C

74. Examine the trigger

Create a replace trigger cascade_updates

After update (Deptno) on Dept

For each row

BEGIN

UPDATE EMP

SET emp_deptno=: new. Deptno

WHERE emp.Deptno=: old.Deptno;

END

When this trigger will fire successfully?

A. Only when the dept no in the emp table holds a NULL value.

B. Irrespective of any referential integrity constraints between two tables.

C. When there is no referential integrity between the dept number columns of the emp and the dept

tables within their table definitions.

D. Only when there is referential integrity constraint between the emp no columns of the emp and dept

tables within their table definitions.

Answer:  C



75. Examine this code:

CREATE OR REPLACE PROCEUDRE AUDIT_EMP;

(P_ID IN EMP. EMPNO%TYPE)

IS

V_ID NUMBER;

PROCEDURE LOG_EXEC

IS

BEGIN

INSERT INTO LOG_TABLE (USER_ID,LOG_DATE)

VALUES (USERS,SYSDATE);

END LOG_EXEC

V_NAME VARCHAR2(20)

BEGIN

DELECT FROM EMP

WHERE EMPNO = P_ID;

LOG_EXEC;

SELECT ENAME,EMPNO

INTO V_NAME,V_ID

FROM EMP

WHERE EMPNO=P_ID

END AUDIT_EMP;

Why does this code cause and error when compiled?

A. An insert statement is not allowed in a sub program declaration.

B. The LOG_exec procedure should be declared before any identifiers.

C. The V_NAME variable should be declared before declaring the LOG_EXEC procedure.

D. The LOG_EXEC procedure should be invoked as execute log_exec with in the AUDIT_EMP

procedure.

Answer:  C



76. When creating a function in which section will you typically find a return key word?

A. Header Only

B. Declarative

C. Executable and header

D. Executable and exception handling

Answer:  C



77. Examine this package

CREATE OR REPLACE PACKAGE COMPILE_THIS

IS

G_VALUE VARCHAR2(100);

PROCEDURE A;

PROCEDURE B;

END COMPILE_THIS;

/

CREATE OR REPLACE PACKAGE BODY COMPILE_THIS

IS

PROCEDURE A

IS

BEGIN

G_VALUE := (‘HELLO WORLD’);

END A;

PROCEDURE B

IS

BEGIN

C;

DBMS_OUTPUT. PUT_LINE (‘PROCEDURE B CALLING C’);

END B;

PROCEDURE C

IS

BEGIN

B;

DBMS_OUTPUT. PUT_LINE (‘PROCEDURE C CALLING B’);

END;

END COMILE_THIS; /

Procedure C is a local construct to the package. What happens when this package is

compiled?

A. It produces the output Procedure B calling C

B. It produces the output Procedure C calling B

C. It produces a compilation error because procedure C requires a forward declaration.

D. It produces a compilation error because procedure B requires a forward declaration.

E. It produces a compilation error because identified g_value is not declared in procedure A

Answer:  C



78. The ADD_PLAYER, UPD_PLAYER_STAT and UPD_PITCHER_STAT procedures are

grouped together in a package. A variable must be shared among only these procedures. Where

should you declare this variable?

A. In the package body.

B. In the data base triggers.

C. In the package specification.

D. In the procedures declare section using the exact name in each.

Answer:  A



79. Examine the trigger heading

CREATE OR REPLACE TRIGGER SALARY_CHECK

Before update (sal,job) on emp

For each row

Under what conditions does this trigger fire?

A. When a row is inserted to EMP table.

B. When the value of the SAL or JOB column in a row is updated in a emp table.

C. When any column other than the sal or job columns in a row are updated in the EMP table.

D. Only when both values of sal or jobs column in a row are updated together in the EMP table.

Answer:  B



80. Which code can you use to ensure that the salary is neither increased by more than

10% at a time nor is ever decreased?

A. ALTER TABLE emp ADD

constraint_ck_sal CALC(sal BETWEEN sal AND sal*1.1);

B. CREATE OR REPLACE TRIGGER check_sal

BEFORE UPDATE OF sal ON emp

FOR EACH ROW

WHEN(NEW.SAL OR

NEW.SAL>OLD.SAL*1.1)

BEGIN

RAISE_APPLICATION_ERROR(-20508, ‘do not decrease salary nor

increase by more than 10%’);

END;

C. CREATE OR REPLACE TRIGGER check_sal

BEFORE UPDATE OF sal OR emp

WHEN (NEW.SAL OR

NEW.SAL>OLD.SAL*1.1)

BEGIN

RAISE_APPLICATION_ERROR(-20508, ‘Do not decrease salary nor

increase by more than 10%’);

D. CREATE OR REPLACE TRIGGER check_sal

AFTER UPDATE OF sal OR emp

WHEN (NEW.SAL OR

NEW.SAL>OLD.SAL*1.1)

BEGIN

RAISE_APPLICATION_ERROR(-20508, ‘Do not decrease salary nor

increase by more than 10%’);

END;

Answer:  B



81. Which command must you issue to allow users to access the UPD_TEAM_STAT trigger on

the TEAM table?

A. GRANT SELECT, INSERT, UPDATE, DELETE ON TEAM TO PUBLIC;

B. GRANT SELECT, INSERT, UPDATE, DELETE ONUPD_TEAM_STAT TO PUBLIC;

C. GRANT EXECUTE ON TEAM TO PUBLIC;

D. GRANT SELECT, EXECUTE ON TEAM, UPD_TEAM_STAT TO PUBLIC;

Answer:  A



82. Which compiler directive to check the purity level of functions?

A. PRAGMA SECURITY_LEVEL.

B. PRAGMA SEARIALLY_REUSABLE.

C. PRAGMA RESTRICT_REFERRENCES.

D. PRAGMA RESTRICT_PURITY_LEVEL.

E. PRAGMA RESTRICT_FUNCTION_REFERRENCE.

Answer: C



83. You have an AFTER UPDATE row-level trigger on the table EMP. This trigger queries the

EMP table and inserts the updating users information into the AUDIT_TABLE. What happens

when the users update rows on the EMP table?

A. A compile time error occurs.

B. A run time error occurs. The effect of the trigger body and the triggering statement are rolled back.

C. A run time error occurs. The effect of the trigger body is rolled back but the update on the EMP

table takes place.

D. The trigger file successfully update the EMP file on the EMP table occurs and the data is asserted

into the AUDIT_TABLE.

E. A run time error occurs. The update on the EMP table does not take place but the insert into the

AUDIT_TABLE occurs.

Answer:  B



84. Given the header of a procedure ACCOUNT_TRANSACTION:CREATE OR

REPLACE PROCEDURE ACCOUNT_TRANSACTION

IS

BEGIN

END;

Which command will execute the PROCEDURE ACCOUNT_TRANSACTION

from the SQL Plus prompt?

A. ACCOUNT_TRANSACTION;

B. RUN ACCOUNT_TRANSACTION;

C. START ACCOUNT_TRANSACTION;

D. EXECUTE ACCOUNT_TRANSACTION;

Answer:  D



85. Examine this trigger:

CREATE OR REPLACE TRIGGER UPD_PLAYER_STAT_TRIG

AFTER INSERT ON PLAYER

FOR EACH ROW

BEGIN

INSERT INTO PLAYER_BAT_STAT(PLAYER_ID,

SEASON_YEAR,AT_BATS,HITS)

VALUES(player_id_seq.currval, 1997, 0, 0 );

END;

After creating this trigger, you test it by inserting a row into the PAYER table. You

receive this error message:

ORA-04091: table SCOTT.PLAYER is mutating,trigger/function may not see it.

How can you avoid getting this error?

A. Drop the foreign key contraint on the PLAYER_ID column of the PLAYER_BAT_STAT table.

B. Drop the primary key contraint on the PLAYER_ID column of the PLAYER_BAT_STAT table.

C. Drop the primary key constraint on the ID column of the PLAYER table.

D. The code of the trigger is invalid. Drop and recreate the trigger.

Answer:  A



86. Examine this package:

CREATE OR REPLACE PACKAGE manage_emps

IS

Tax_rate CONSTRAINT NUMBER(5,2):=. 28;

v_id NUMBER;

PROCEDURE insert_emp(p_dept NO NUMBER, p_sal NUMBER);

PROCEDURE delete_emp;

PROCEDURE update_emp;

FUNCTION calc_text(p_sal NUMBER)

RETURN NUMBER;

END manage_emps;

/

CREATE OR REPLACE PACKAGE BODY manage_emps

IS

PROCEDURE update_sal

(p_raise_amt NUMBER)

IS

BEGIN

UPDATE EMP

SET SAL=(SAL*p_raise_AMP)+SAL WHERE EMPNO=v_id;

END;

PROCEDURE insert_emp

(p_deptno NUMBER,p_sal NUMBER)

IS

BEGIN

INSERT INTO EMP(EMPNO,DEPTNO,SAL)

VALUES(v_id,p_deptno,p_sal);

INERT INTO EMP;

PROCEURE delete_emp

IS

BEGIN

DELETE FROM EMP

WHERE EMPNO=v_id;

END delete_emp;

PROCEDURE audit_emp;

IS

V_sal NUMBER(10,2);

V_raise NUMBER(10,2);

IS

SELECT SAL

INTO v_sal

FROM EMP

WHERE EMPNO=v_id;

IF v_sal<500 THEN v_raise:=. 05;ELSE

v_sal<1000 THEN v_raise:=. 07;ELSE

v_raise:=. 04;

END IF; update_sal (v_raise);

END update_emp; FUNCTION calc_tax

(p_sal NUMBER)

RETURN NUMBER

IS

BEGIN

RETURN p_sal*tax_rate;

END calc_tax;

END manage_emps;

/

How many public procedures are there in the MANAGE_EMPS package?

A. 1.

B. 2.

C. 3.

D. 4.

E. 5.

F. None.

Answer:  C



87. You want to execute a procedure from SQL Plus. However you are not sure of the

argument list for this procedure. Which command will display the argument list?

A. DESCRIBE.

B. SHOWLIST.

C. SHOW ARG_LIST.

D. SHOW PROCEDURE.

Answer:  A



88. You are creating a stored procedure in the SQL Plus environment. The text of the

procedure is stored in a script file. You run the script file to compile the procedure.

What happens if the procedure contains syntax error?

A. Neither the source code nor the errors are stored in the database.

B. Both the source code and the compilation errors are stored in the database.

C. Compilation errors are appended to the script file that contains the source code.

D. The source code is stored in the database and the errors are stored in an output file.

E. The only compilation errors are written to the database and source code remains in the script file.

Answer:  B



89. Which statement is true?

A. Server side procedures are stored in script files on the server.

B. Server side procedures are visible in the ALL_SOURCE dictionary view.

C. Server side procedures are visible in the SERVER_SOURCE dictionary view.

D. Server side procedures are visible in the SERVER_PROCEDURE data dictionary view.

Answer:  A



90. Examine this package specification:

CREATE OR REPLACE PACKAGE concat_all

IS

V_string VARCHER2(100);

PROCEDURE combine(p_num_val NUMBER);

PROCEDURE combine (p_dateval DATE);

PROCEDURE combine(p_char_val VARCHER2,p_num_val NUMBER);

END concat_all;

/

Which overloaded COMBINE procedure declaration can be added to this package

specification?

A. PROCEDURE combine;

B. PROCEDURE combine (p_no NUMBER);

C. PROCEDURE combine (p_val_1 VARCHER2,p_val_2 NUMBER);

D. PROCEDURE concat_all (p_num_val VARCHER2,p_char_val NUMBER);

Answer:  A



91. Examine this package body:

CREATE OR REPLACE PACKAGE BODY forward_pack

IS

V_sum NUMBER;

- 44 -

PROCEDURE calc_ord(. . . );

PROCEDURE generate_summary(. . . )

IS

BEGIN

Calc_ord(. . . );

. . .

END calc_ord;

END forward_pack;

/

Which construct has a forward declaration?

A. V_SUM

B. CALC_ORD.

C. FORWARD_PACK

D. GENERATE_SUMMARY.

Answer:  B



92. CREATE OR REPLACE PROCEDURE manage_emp(p_eno NUMBER)

IS

V_sal emp.sal%TYPE;

V_job emp.job%TYPE;

BEGIN

SELECT sal,job

INTO v_sal,v_job

FROM emp

WHERE empno=p_eno;

IF(v_sal<1000)THEN

DBMS_OUTPUT.PUT_LINE(‘Delete employees who earn less than$1000’);

DELETE FROM emp

WHERE empno=p_eno;

ELSE

DBMS_OUTPUT.PUT_LINE(‘Updating employee salaries.’);

UPDATE emp

SET sal=sal+100

WHERE empno=p_eno;

END IF;

END;

/

What privileges do you need in order to invoke this procedure?

A. No privileges are required.

B. EXECUTE privilege on the procedure.

C. EXECUTE privilege on the DBMS_OUTPUT package.

D. DELETE and UPDATE privilege on the table EMP.

E. EXECUTE privilege on the procedure, and delete and update privileges on the table EMP.

Answer:  B



93. The ADD_PLAYER procedure inserts rows into the player table. Which command will

show this direct dependency?

A. SELECT * FROM USER_DEPENDENCIES WHERE REFFERENCE_NAME= ‘PLAYER’;

B. SELECT * FROM USER_DEPENDENCIES WHERE REFFERENCE_NAME=

‘ADD_PLAYER’;

C. SELECT * FROM USER_DEPENDENCIES WHERE TYPE= ‘DIR’;

D. SELECT * FROM USER_DEPENDENCIES WHERE REFFERENCE_NAME= ‘TABLE’;

Answer:  A



94. Examine this procedure:

CREATE OR REPLACE PROCEDURE ADD_PLAYER

(V_ID IN NUMBER, V_LAST_NAME VARCHER2(30))

IS

BEGIN

INSERT INTO PLAYER(ID, LAST_NAME)

VALUES(V_ID, V_LAST_NAME);

COMMIT;

END;

Why does this command fail when executed?

A. When declaring arguments length is not allowed.

B. When declaring arguments each argument must have a mode specified.

C. When declaring arguments each argument must have a length specified.

D. When declaring a VARCHAR2 argument it must be specified.

Answer:  A



95. Examine this trigger:

CREATE OR REPLACE TRIGGER CHECK_TOT_SALARY

AFTER INSERT OR UPDATE OF SALARY ON PLAYER

FOR EACH ROW

DECLARE

V_TOT_SALS NUMBER(12, 2);

BEGIN

SELECT SUM(SALARY)

INTO V_TOT_SAL

FROM PLAYER

WHER TEAM_ID=:NEW. SALARY;

END;

Why does this trigger fail when inserting a row into player table?

A. You can’t read data from a table that is being affected by the same trigger.

B. You can’t use the sum function with row triggers.

C. You can’t use the sum function with statement triggers.

D. You can’t reference :NEW with row triggers.

Answer:  A



96. Which procedure of the dbms_output supply package would you use to append text

to the current line of the output buffer?

A. GET.

B. GET_LINE.

C. PUT_TEXT_LINE.

D. PUT_LINE.

Answer:  D



97. What happens during the parse phase with dynamic SQL?

A. Rows are selected and ordered.

B. The number of rows processed is returned.

C. The validity of the SQL statement is established.

D. An area of memory is established to process the SQL statement.

E. An area of memory is established to process the SQL statement is released.

Answer:  C



98. Which script file must be executed before you can determine indirect independence’s using

the DEPTREE AND IDEPTREE VIEWS?

A. UTL_IDEPT.SQL.

B. UTLIDD.SQL.

C. UTLINDD.SQL.

D. UTLDTREE.SQL

Answer:  D



99. Debug the logic in a stored procedure. How do you monitor the value of variables in the

procedure using SQL Plus environment?

A. INSERT TEXT_IO.PUT_LINE statement to view data on the screen when the stored procedure is

executed.

B. Insert break points in the code and observe the variable values displayed to the screen as the

procedure is executed.

C. Insert DBMS_OUTPUT.PUT_LINE statement to view data on the screen when the stored

procedure is executed.

D. Insert DEBUG VARIABLE statements to view the variable values on the screen as the procedure is

executed.

Answer:  C



100. Which two statements are true? (Choose two)

A. A function must return a value.

B. A procedure must return a value.

C. A function executes a PL/SQL statement.

D. A function is invoked as part of an expression.

E. A procedure must have a return data type specify in its declaration.

Answer:  A, D



101. Which allows a PL/SQL user define a function?

A. NEXTVAL.

B. HAVING clause of the SELECT COMMAND.

C. ALTER TABLE command.

D. FROM clause of the SELECT AN UPDATE COMMANDS.

Answer:  B



102. CREATE OR REPLACE PROCEDURE set_bonus

(p_cutoff IN VARCHAR2 DEFAULT ‘WEEKLY’

p_employee_id IN employees_employee_id%TYPE

p_salary IN employees_salary%TYPE,

p_bonus_percent IN OUT NUMBER DEFAULT 1.5,

p_margin OUT NUMBER DEFAULT 2,

p_bonus_value OUT NUMBER)

IS

BEGIN

UPDATE emp_bonus

SET bonus_amount =(p_salary * p_bonus_percent)/p_margin

WHERE employee_id = p_employee_id;

END set_bonus;

You execute the CREATE PROCEDURE statement above and notice that it fails. What are two

reasons why it fails? (Choose two)

A. The syntax of the UPDATE statement is incorrect.

B. You cannot update a table using a stored procedure.

C. The format parameter p_bonus_value is declared but is not used anywhere.

D. The formal parameter p_cutoff cannot have a DEFAULT clause.

E. The declaration of the format parameter p_margin cannot have a DEFAULT clause.

F. The declaration of the format parameter p_bonus_percent cannot have a DEFAULT clause.

Answer:  E, F



103. Which three statements are true regarding database triggers? (Choose three)

A. A database trigger is a PL/SQL block, C, or Java procedure associated with a table, view,

schema, or the database.

B. A database trigger needs to be executed explicitly whenever a particular event takes place.

C. A database trigger executes implicitly whenever a particular event takes place.

D. A database trigger fires whenever a data event (such as DML) or system event (such as logon,

shutdown) occurs on a schema or database.

E. With a schema, triggers fire for each event for all users; with a database, triggers fire for each event

for that specific user.

Answer:  A, C, D



104. Examine this package:

CREATE OR REPLACE PACKAGE pack_cur

IS

CURSOR c1 IS

SELECT prodid

FROM product

ORDER BY Prodid DESC;

PROCEDURE Proc1;

PROCEDURE Proc2;

END pack_cur;

/

CREATE OR REPLACE PACKAGE BODY pack_cur

IS

v_prodif NUMBER;

PROCEDURE proc1 IS

BEGIN

OPEN C1;

LOOP

PROCEDURE proc2 IS

BEGIN

LOOP

FETCH C1 INTO v_prodid;

DBMS_OUTPUT-PUT_LINE ( ‘ Row is: ‘ ll c1 %ROWCOUNT);

EXIT WHEN C1%ROWCOUNT >= 3;

END LOOP;

END Procl;

/

The product table has more than 1000 rows. The SQL*Plus SERVEROUTPUT setting is turned

on in your session.

You execute the procedure PROC1 from SQL *Plus with the command:

EXECUTE pack_cur. PROC1;

You then execute the procedure PROC2 from SQL *Plus with the command:

EXECUTE pack_cur. PROC2;

What is the output in your session from the PROC2 procedure?

A.  ERROR at line 1:

B.  Row is:

Row is:

Rows is:

C.  Row is: 1

Row is: 2

Row is: 3

D.  Row is: 4

Row is: 5

Row is: 6

Answer:  D



105. You have the following table:

CREATE TABLE Emp_log (

Emp_id NUMBER

Log_date DATE,

New_salary NUMBER,

Action VARCHAR (20));

You have the following data in the EMPLOYEES table:

EMPLOYEE_ID LAST_NAME SALARY DEPARTMENT_ID

———– ——————- ———— ————-

100 King 24000 90

101 Kochhar 17000 90

102 De Haan 17000 90

103 Hunold 9000 60

104 Ernst 6000 60

105 Austin 4800 60

106 Pataballa 4800 60

107 Lorentz 4200 60

108 Greenberg 12000 100

201 Hartstein 13000 20

202 Fay 6000 20

You create this trigger:

CREATE OR REPLACE TRIGGER Log_salary_increase

AFTER UPDATE ON employees

FOR EACH ROW

WHEN (new.Salary > 1000)

BEGIN

INSERT INTO Emp_log (Emp_id, Log_date, New_Salary, Action)

VALUES (: new.Employee_id, SYSDATE, :new.salary, ‘NEW SAL’ );

END

/

Then, you enter the following SQL statement:

UPDATE Employee SET Salary = Salary + 1000.0

Where Department_id = 20M

What are the result in the EMP_LOG table?

A.

EMP_ID LOG_DATE NEW_SALARY ACTION

———- ——– ———- ———-

201 24-SEP-02 13000 NEW SAL

202 24-SEP-02 600 NEW SAL

B.

EMP_ID LOG_DATE NEW_SALARY ACTION

———- ——– ———- ———-

201 24-SEP-02 14000 NEW SAL

202 24-SEP-02 7000 NEW SAL

C.

EMP_ID LOG_DATE NEW_SALARY ACTION

———- ——– ———- ———-

201 24-SEP-02 NEW SAL

202 24-SEP-02 NEW SAL

D. No rows are inserted.

Answer:  B



106. Examine this code:

CREATE OR REPLACE FUNCTION gen_email_name

(p_first VARCHAR2, p_last VARCHAR2)

RETURN VARCHAR2

IS

v_email_name VARCHAR (19) ;

BEGIN

v_email_bame := SUBSTR(p_first, 1, 1) || SUBSRE(p_last, 1, 7) ||

RETURN v_email_name;

END

/

Which two statements are true?

A. This function is invalid.

B. This function can be used against any table.

C. This function cannot be used in a SELECT statement.

D. This function can be used only if the two parameters passed in are not bull values.

E. This function will generate a string based on 2 character values passed into the function.

F. This function can be used only on tables where there is a p_first and p_last column.

Answer:  D, E



107. Examine the code examples. Which one is correct?

A. CREATE OR REPLACE TRIGGER authorize_action BEFORE INSERT ON EMPLOYEES

CALL log_exectution; /

B. CREATE OR REPLACE TRIGGER authorize_action BEFORE EMPLOYEES INSERT

CALL log_exectution;

C. CREATE OR REPLACE TRIGGER authorize_action BEFORE EMPLOYEES INSERT

CALL log_exectution;

D. CREATE OR REPLACE TRIGGER authorize_action CALL log_exectution; BEFORE INSERT

ON EMPLOYEES; /

Answer: A



108. Which of the following statements about LOB are true? (Choose Three)

A. LOB is a database object

B. LOB represents a data type that is used to store large, unstructured data.

C. LOB can be stored inside or outside a database.

D. Internal LOB is a category of LOB.

Answer: B, C, D

109. Examine the following statement:

CREATE OR REPLACE TRIGGER Check_sal BEFORE UPDATE OF SALARY ON

EMPLOYEES for each ROW

WHEN (NEW.salary < OLD. Salary OR NEW.Salary > OLD.salary * 1.2)

BEGIN

RAISE_APPLICATION_ERROR(-20004,’You cannot increase salary by more than 10% nor

can you decrease it’);

END;

What will happen when you execute the statement?

A. the statement will fail because the OLD and NEW qualifiers are not prefixed with a colon (:).

B. the statement will fail because a trigger cannot be defined on a particular column of a table.

C. The statement will execute successfully and the trigger will be created.

D. The statement will execute successfully and the trigger will be created, but the trigger will fail

when the salary column of the Employees table is updated.

Answer: C



110. You work as an application developer for Dolliver Inc. The company uses an oracle

database. You own subprograms that reference to other subprograms on remote locations.

Oracle server uses the signature mode of remote dependency in order to manage remote

dependencies among the subprograms. Which of the following statements about the signature

mode of dependency are true? (Choose two)

A. Oracle Server records only the signature for each PL/SQL program unit.

B. Using the signature mode prevents the unnecessary recompilation of dependent local procedures, as

it allows remote procedures to be recompiled without affecting the dependent local procedures.

C. Signature mode is the default mode of remote dependency.

D. Oracle server records both the timestamp and the signature for each PL/SQL program unit.

Answer: B, D

111. You work as an application developer for federal Inc. the company uses an Oracle

database. You have created a function named My_Func in the database. You want to change the

arguments declared for the function. Before changing the arguments you want to see the names

of the procedures and other functions that invoke the My_Func function. Which of the following

data dictionary views will you query to accomplish this? (choose two)

A. USER_DB_LINKS

B. ALL_DEPENDENCIES

C. USER_DEPENDENCIES

D. USER_SOURCE.

Answer:  B, C



112. You work as an application developer for federal Inc. the company uses an oracle database.

The database contains a package named G_Comm. You want to remove the package

specification from the database while retaining the package body. Which of the following

statements will you use to accomplish this?

A. DROP Package G_Comm;

B. DROP Package Specification G_Comm;

C. DROP Package Body G_Comm;

D. You cannot accomplish this;

Answer D



113. Which of the following Oracle supplied package is used to enable HTTP callouts from

PL/SQL and SQL to access data on the Internet?

A. DBMS_DDL

B. UTL_HTTP

C. UTL_SMTP

D. UTL_URL

Answer: B


114. If there is any changes applied to the package specification or body of a stored sub-program

which statement is true about it?

A. Package Specification only requires recompilation

B. Package body only requires recompilation

C. both package & body requires recompilation

D. both package & body does not require recompilation.

Answer: A



115. You disabled all triggers on the EMPLOYEES table to perform a data load. Now, you need

to enable all triggers on the EMPLOYEES table.

Which command accomplished this?

A. You cannot enable multiple triggers on a table in one command.

B. ALTER TRIGGERS ON TABLE employees ENABLE;

C. ALTER employees ENABLE ALL TRIGGERS;

D. ALTER TABLE employees ENABLE ALL TRIGGERS;

Answer:  D


116. Examine this code:

CREATE OR REPLACE STORED FUNCTION get_sal

(p_raise_amt NUMBER, p_employee_id employees.employee_id%TYPE)

RETURN NUMBER

IS

v_salary NUMBER;

v_raise NUMBER(8,2);

BEGIN

SELECT salary

INTO v_salary

FROM employees

WHERE employee_id = p_employee_id;

v_raise := p_raise_amt * v_salary;

RETURN v_raise;

END;

Which statement is true?

A. This statement creates a stored procedure named get_sal.

B. This statement returns a raise amount based on an employee id.

C. This statement creates a stored function named get_sal with a status of invalid.

D. This statement creates a stored function named get_sal.

E. This statement fails.

Answer:  E



117. Examine this code: CREATE OR REPLACE PACKAGE metric_converter IS c_height

CONSTRAINT NUMBER := 2.54; c_weight CONSTRAINT NUMBER := .454; FUNCTION

calc_height (p_height_in_inches NUMBER) RETURN NUMBER; FUNCTION calc_weight

(p_weight_in_pounds NUMBER) RETURN NUMBER; END; / CREATE OR REPLACE

PACKAGE BODY metric_converter IS FUNCTION calc_height (p_height_in_inches

NUMBER) RETURN NUMBER IS BEGIN RETURN p_height_in_inches * c_height; END

calc_height; FUNCTION calc_weight (p_weight_in_pounds NUMBER) RETURN NUMBER IS

BEGIN RETURN p_weight_in_pounds * c_weight END calc_weight END metric_converter; /

CREATE OR REPLACE FUNCTION calc_height (p_height_in_inches NUMBER) RETURN

NUMBER IS BEGIN RETURN p_height_in_inches * metric_converter.c_height; END

calc_height; / Which statement is true?

A. If you remove the package specification, then the package body and the stand alone stored function

CALC_HEIGHT are removed.

B. If you remove the package body, then the package specification and the stand alone stored function

CALC_HEIGHT are removed.

C. If you remove the package specification, then the package body is removed.

D. If you remove the package body, then the package specification is removed.

E. If you remove the stand alone stored function CALC_HEIGHT, then the METRIC_CONVERTER

package body and the package specification are removed.

F. The stand alone function CALC_HEIGHT cannot be created because its name is used in a packaged

function.

Answer:  C


118. Procedure PROCESS_EMP references the table EMP.

Procedure UPDATE_EMP updates rows if table EMP through procedure

PROCESS_EMP.

There is a remote procedure QUERY_EMP that queries the EMP table

through the local procedure PROCESS_EMP.

The dependency mode is set to TIMESTAMP in this session.

Which two statements are true? (Choose two)

A. If the signature of procedure PROCESS_EMP is modified and successfully recompiles, the EMP

table is invalidated.

B. If internal logic of procedure PROCESS_EMP is modified and successfully recompiles,

UPDATE_EMP gets invalidated and will recompile when invoked for the first time.

C. If the signature of procedure PROCESS_EMP is modified and successfully recompiles,

UPDATE_EMP gets invalidated and will recompile when invoked for the first time.

D. If internal logic of procedure PROCESS_EMP is modified and successfully recompiles,

QUERY_EMP gets invalidated and will recompile when invoked for the first time.

E. If internal logic of procedure PROCESS_EMP is modified and successfully recompiles,

QUERY_EMP gets invalidated and will recompile when invoked for the second time.

Answer:  B, E

119. When using a packaged function in a query, what is true?

A. The COMMIT and ROLLBACK commands are allowed in the packaged function.

B. You can not use packaged functions in a query statement.

C. The packaged function cannot execute an INSERT, UPDATE, or DELETE statement against the

table that is being queried.

D. The packaged function can execute and INSERT, UPDATE, or DELETE statement against the

table that is being queried if it is used in a subquery.

E. The packaged function can execute an INSERT, UPDATEM or DELETE statement against the

table that is being queried if the pragma RESTRICT REFERENCE is used.

Answer:  C

120. Which three are true regarding error propagation? (Choose three)

A. An exception cannot propagate across remote procedure calls.

B. An exception raised inside a declaration immediately propagates to the current block.

C. The use of the RAISE; statement in an exception handler reprises the current exception

D. An exception raised inside an exception handler immediately propagates to the enclosing block.

Answer:  A, C, D



Thanks
Sajal