Exam Information
Free practice questions with explanations
Oracle 1Z0-149 Practice Questions
Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.
- Questions
- 15
- Answered
- 0
- Correct
- 0
- Score
- -
-
1 Question 1 Single choice Handling Exceptions
A nightly PL/SQL batch procedure loads orders into a staging table. A developer wants any ORA-01400 (cannot insert NULL) raised during the load to be trapped by a named exception so the code can log the failing order id and continue with the next row, without relying on the error code number in the handler. The procedure must remain compatible with future releases that may renumber messages. Which approach is the BEST?
Correct Answer: DExplanationThe EXCEPTION_INIT pragma binds a user-defined exception name to a specific Oracle error number, giving the handler a readable name while still trapping the internal error. Comparing SQLCODE inside WHEN OTHERS works, but it is a fragile pattern that the requirement implicitly rules out because it hard-codes numbers in control logic and catches everything. Raising a custom exception before the insert does not trap the database error and would miss NULLs the pre-check logic does not anticipate. RAISE_APPLICATION_ERROR produces a new application error rather than handling ORA-01400, so it cannot be caught as the original error and does not meet the requirement.
-
2 Question 2 Single choice Creating Procedures and Using Parameters
A team maintains a procedure ship_order with parameters p_order_id, p_carrier, p_priority (default 'STANDARD'), p_notify (default TRUE), and p_warehouse. A new release adds an optional parameter p_gift_wrap with a default value at the end of the list. Hundreds of existing anonymous blocks call ship_order positionally, and the team cannot change them before go-live. Which statement about invoking the procedure is correct after the change?
Correct Answer: BExplanationParameters with default values can be omitted, and because the new parameter is appended at the end, positional calls that supply only the original arguments still resolve correctly. Named notation is needed only when a caller wants to supply a later defaulted parameter while skipping earlier ones. A PLS-00306 error would occur for an incompatible argument list, not for appending a defaulted parameter. NOCOPY is a parameter-passing performance hint with no bearing on defaults. Positional binding is by position, so p_warehouse is not reassigned to the new parameter.
-
3 Question 3 Single choice Using Explicit Cursors
A payroll procedure opens a cursor that selects employees in a department and must update each selected row's salary as it is read, so that rows locked by the cursor are updated in the current position. Management also requires that a concurrent session cannot change these rows between fetch and update. A developer writes the cursor declaration with FOR UPDATE and attempts to use WHERE CURRENT OF in the UPDATE statement inside a simple LOOP. Which statement describes the correct behaviour and the most appropriate form?
Correct Answer: CExplanationWhen a cursor declares FOR UPDATE, Oracle locks the rows in the result set at OPEN time, which prevents other sessions from changing them until commit or rollback. WHERE CURRENT OF then targets the row most recently fetched by that cursor. Locks are not released per FETCH. WHERE CURRENT OF works with simple loops as well as cursor FOR loops, so the claim that it is restricted to cursor FOR loops is false. FOR UPDATE does take row locks, so no LOCK TABLE statement is needed.
-
4 Question 4 Multiple choice Design Considerations for PL/SQL Code
A reporting package exposes a function that is called from thousands of SQL statements per hour. It computes a tax rate from a country code using only its input argument and a constant table, never reading database tables or package state. The team also wants a large batch process that updates a million rows to log generated order ids back into an audit table in one round trip, without writing a loop with individual DML statements. Which TWO actions meet these requirements? (Choose two.)
Correct Answer: B, CExplanationDETERMINISTIC tells the optimizer the function returns the same result for the same inputs, allowing result reuse across SQL calls, which fits a pure tax calculation. FORALL combined with RETURNING ... BULK COLLECT INTO returns the generated values in bulk, avoiding row-by-row round trips. PARALLEL_ENABLE is designed for table functions used as row sources, not scalar functions called in WHERE clauses. Autonomous transactions do not improve performance and would break the audit atomicity. NOCOPY affects parameter passing semantics, not context switches between SQL and PL/SQL.
-
5 Question 5 Order list Creating Triggers
A security team wants an event database trigger that records every logon by the application schema APP_OWNER into a table, and must avoid breaking logins if the audit table is unavailable. The DBA must deploy the trigger into a 19c database with a rollback plan in place. Arrange the steps in the correct order.
Drag the steps into the correct order, or use the arrows.
- Save the current trigger definition, if any, so it can be restored if the new trigger causes problems
- Test the trigger by logging on as APP_OWNER in a non-production session and querying the audit table
- Create a table in the APP_OWNER schema to hold the logon audit rows and grant insert privilege as needed
- Create the AFTER LOGON ON SCHEMA trigger that inserts into the audit table inside a PRAGMA AUTONOMOUS_TRANSACTION block with an exception handler
Correct Answer:- Create a table in the APP_OWNER schema to hold the logon audit rows and grant insert privilege as needed
- Create the AFTER LOGON ON SCHEMA trigger that inserts into the audit table inside a PRAGMA AUTONOMOUS_TRANSACTION block with an exception handler
- Test the trigger by logging on as APP_OWNER in a non-production session and querying the audit table
- Save the current trigger definition, if any, so it can be restored if the new trigger causes problems
ExplanationThe audit table must exist before the trigger can reference it, so creating it comes first. Saving any existing trigger definition should happen before the change so a rollback is possible, which means it belongs ahead of creating the trigger. The trigger is then created with an autonomous transaction and an exception handler so a failed insert does not block the logon. Testing in a non-production session confirms behaviour last. In the recorded list the save step is listed after the create step, so the correct sequence is audit table, save existing definition, create trigger, test.
-
6 Question 6 Drag and drop Using Dynamic SQL
A developer writes a procedure that builds a SELECT statement at run time from user-supplied filter values and must avoid SQL injection and unnecessary hard parses. Match each requirement to the technique that satisfies it.
Drag each item onto its matching target. On a phone: tap an item, then tap a target.
Run a dynamically built DDL statement such as CREATE INDEX from a procedurePass filter values into the statement without concatenating them as literal textRetrieve the rows of a dynamic query into a PL/SQL collection in one round tripDBMS_SQL.PARSE with a literal concatenated predicateEXECUTE IMMEDIATE with the DDL text and no bind variablesDBMS_OUTPUT.PUT_LINE with a format stringUSING clause bind variables with EXECUTE IMMEDIATEBULK COLLECT INTO with a dynamic cursor opened through OPEN FORCorrect Answer:- Pass filter values into the statement without concatenating them as literal text → USING clause bind variables with EXECUTE IMMEDIATE
- Retrieve the rows of a dynamic query into a PL/SQL collection in one round trip → BULK COLLECT INTO with a dynamic cursor opened through OPEN FOR
- Run a dynamically built DDL statement such as CREATE INDEX from a procedure → EXECUTE IMMEDIATE with the DDL text and no bind variables
ExplanationBind values through the USING clause prevent injection and allow cursor sharing, so they are the right way to pass filter values. OPEN FOR combined with BULK COLLECT lets a dynamic query populate a collection in bulk. DDL cannot take bind variables for object names, so EXECUTE IMMEDIATE with the full statement text is the standard approach. Concatenating literals into a DBMS_SQL.PARSE call reintroduces injection risk, and DBMS_OUTPUT has nothing to do with statement execution.
-
7 Question 7 Dropdown Creating Packages
A developer is building a package that holds a session-independent pricing rate used by SQL statements, and an internal helper that must be callable only from within the same package. The rate must be readable from SQL without a context switch penalty. Complete the package specification by selecting the correct value for each blank.
Choose the correct value for each blank.
CREATE OR REPLACE PACKAGE pricing_pkg AS
c_vat_rate CONSTANT NUMBER := 0.20;
FUNCTION vat_amount(p_net NUMBER) RETURN NUMBER ;
PROCEDURE log_run ;
END pricing_pkg;Correct Answer:CREATE OR REPLACE PACKAGE pricing_pkg AUTHID CURRENT_USER AS
c_vat_rate CONSTANT NUMBER := 0.20;
FUNCTION vat_amount(p_net NUMBER) RETURN NUMBER DETERMINISTIC;
PROCEDURE log_run ACCESSIBLE BY (pricing_pkg);
END pricing_pkg;ExplanationPlacing AUTHID CURRENT_USER on the package specification is a valid invoker-rights clause for packages, and the subprograms are then governed by the caller's privileges. DETERMINISTIC is the correct subprogram clause for a pure calculation, and it is allowed in a specification. An internal helper restricted to the same package is whitelisted with ACCESSIBLE BY on the procedure, which blocks outside callers even when they hold EXECUTE. The alternative with ACCESSIBLE BY (PUBLIC) gives no restriction, and RESULT_CACHE RELIES_ON is not suited to a constant that is not a database table.
-
8 Question 8 Single choice Managing PL/SQL Code
A bank uses conditional compilation in a shared utility package so that debug logging is compiled in only for development. The release team must now deploy the same source to production with logging removed and wants to verify at compile time which branch was built, without editing code. Which approach best satisfies this?
Correct Answer: CExplanationConditional compilation uses $IF blocks driven by inquiry directives, and the directive values are set through the PLSQL_CCFLAGS parameter at compile time, so production builds can select a different branch from the same source. PLSQL_OPTIMIZE_LEVEL affects optimisation, not which code paths are included. PRAGMA INLINE controls inlining of subprograms, not code exclusion. PLSQL_WARNINGS only reports issues and does not remove code.
-
9 Question 9 Single choice Writing Control Structures
A claims processing block iterates over pending claims in a cursor. Claims flagged as duplicates must be skipped entirely, and processing must stop altogether once the running total of approved amounts exceeds 50,000. A developer writes the loop with a duplicate check and a total check. Which control statement combination is correct and most readable?
Correct Answer: AExplanationCONTINUE WHEN skips the remainder of the current iteration and moves to the next one, which fits skipping duplicate claims. EXIT WHEN terminates the loop entirely, which is what the threshold requires. Reversing the two would stop the loop on the first duplicate and skip claims after the threshold is reached, both wrong. GOTO is unnecessary and discouraged. CONTINUE is valid in any loop type, including simple loops and cursor loops.
-
10 Question 10 Single choice Declaring PL/SQL Variables
A developer declares a variable to hold the salary of an employee from the EMPLOYEES table, and the salary column is later changed from NUMBER(8,2) to NUMBER(10,2) by another team. The developer wants the variable to automatically follow future datatype changes and also needs a variable that will hold a whole row of EMPLOYEES. Which declarations meet these needs?
Correct Answer: DExplanationThe %TYPE attribute anchors a variable to a column's datatype, so changes to the column definition propagate to the variable at recompilation. %ROWTYPE declares a record whose fields match all columns of the table, so employees%ROWTYPE is the right choice for a full row. A hard-coded NUMBER(8,2) would not follow the change. Applying %ROWTYPE to a column or %TYPE to a whole table reverses the attributes, and a TABLE OF declaration creates a collection rather than a single row variable.
-
11 Question 11 Single choice Working with Composite Data Types
A batch job must process an in-memory list of customer records keyed by customer id, where ids are sparse (for example 1001, 1007, 2300) and the list must be looked up by id without iterating over unused positions. The developer also needs to assign the whole collection from one function result. Which collection type is most appropriate, and what must be true for the assignment?
Correct Answer: CExplanationAn associative array (INDEX BY table) supports sparse integer keys, so customer ids can be used directly without filling unused slots. Assignment between collections requires the same declared type, which is satisfied when the function returns the same named type. Nested tables and VARRAYs are dense, so sparse ids would require reserving empty positions. A VARCHAR2-keyed array is valid but unnecessary and changes lookup semantics compared with integer ids.
-
12 Question 12 Single choice Using PL/SQL Subprograms
A DBA team asks why a developer's anonymous block should call a stored procedure rather than repeat the same logic in each reporting script. The procedure is needed by three applications, and the team must change the business rule in one place without redeploying the scripts. Which statement correctly describes the benefit that meets this requirement?
Correct Answer: CExplanationA stored procedure is compiled and held in the data dictionary, so callers reference the single definition, and changing it once updates behaviour for all callers the next time they invoke it, provided it is recompiled and not invalidated mid-run. Stored subprograms do not run in client memory and do not guarantee better performance than anonymous blocks. Anonymous blocks can call procedures freely. Stored subprograms are not cached per session in a way that forces reconnects.
-
13 Question 13 Single choice Managing Dependencies
A developer changes a procedure that is referenced by a dozen other procedures and a view. After the change, a reporting job fails with ORA-04068 because a package that calls the procedure was left in an invalid state. The team wants to find all objects that depend on the procedure before deploying future changes. Which data dictionary view should they query first, and what must they do after the change?
Correct Answer: DExplanationUSER_DEPENDENCIES lists the objects that reference a given object, which is the right view for impact analysis. After changing a referenced procedure, dependent packages and procedures become invalid or must be revalidated, so recompiling them restores validity. USER_SOURCE shows code text, USER_ERRORS shows compilation errors, and USER_OBJECTS shows status, but none of them list dependencies directly. Dropping the schema is destructive and unnecessary, and granting EXECUTE does not address invalidation.
-
14 Question 14 Single choice Handling Exceptions
A procedure performs a transfer between two accounts and must raise a business exception when the balance is insufficient, with a message that calling applications can read. The exception must propagate to the caller so the application can decide how to respond, and must not be masked by a generic handler. A developer considers several designs. Which design best meets these requirements?
Correct Answer: CExplanationA user-defined exception allows the balance check to be expressed by name, and RAISE_APPLICATION_ERROR within the allowed -20000 to -20999 range gives the caller a meaningful error number and message that propagates outward. Catching everything with WHEN OTHERS and returning NULL hides the error and loses the message. DBMS_OUTPUT is not visible to applications and reports success falsely. NO_DATA_FOUND is raised by SELECT INTO when no row exists and does not describe a balance shortfall.
-
15 Question 15 Single choice Using Explicit Cursors
A reporting procedure needs to process orders for a region passed as a parameter. The cursor is opened several times in a loop with different regions, and the team wants the cursor declaration to be reusable without rebuilding the query text, and each fetch loop should close the cursor cleanly even when an error occurs mid-run. Which approach best meets these requirements?
Correct Answer: CExplanationA parameterised explicit cursor can be opened with different values while sharing one declaration, and a cursor FOR loop opens and closes the cursor automatically, including on exceptions that exit the loop. Concatenating the region into the query text is poor practice and an injection risk, and cursors are not closed merely by session behaviour. FOR UPDATE does not close cursors, and SQL%ROWCOUNT reports rows affected, not closure. Implicit cursors cannot be reused across regions with parameters.
These are 15 of the 65 questions in the full 1Z0-149 pack.
Get All 65 QuestionsGet all 65 questions & answers
Full access options for Oracle 1Z0-149
Self-study
PDF Version
- 65 actual exam questions
- Compatible with all devices
- Printable PDF format
- No download limits
- 90 days free updates
- 24/7 customer support
Best value
Bundle Pack
- Discounted PDF + online access
- 65 actual exam questions
- Both PDF and online practice test
- Free 90 days updates
- No download or practice limits
- 24/7 customer support
Exam simulation
Online Practice Test
- 65 actual exam questions
- Actual exam environment
- 90 days free updates
- Browser-based software
- 24/7 customer support
100% Money Back Guarantee
Your success comes first
At DumpsProvider, we give you a 100% money back guarantee on all of our exam dumps. For us, your success is the #1 priority and we are more than confident that our exam material will help you pass the 1Z0-149 Exam (Oracle Database 19c: Program with PL/SQL) on your very first attempt.
In a rare case, if you fail your exam, we will refund your amount without asking a single question.