Skip to content

1Z0-149 Oracle Database Program with PL/SQL Practice Questions

Prepare for 1Z0-149 with more than an answer.

246 questions in the full set20 sample questionsUpdated Jan 23, 2026

Unlock the full exam and previous versions

  • v1Version 1 246 questions Current
  • 1z0-148Legacy Oracle Database 12c: Advanced PL/SQL 74 questions Locked
Exam fee
$245 USD
Level
Professional
Valid for
Lifetime (no recertification required)
Domains covered on the exam 18
  1. Declaring PL/SQL Variables8%
  2. Writing Executable Statements10%
  3. Writing SQL in PL/SQL8%
  4. Writing Control Structures12%
  5. Working with Composite Data Types12%
  6. Using Explicit Cursors12%
  7. Handling Exceptions10%
  8. Using PL/SQL Subprograms6%
  9. Creating Procedures and Using Parameters8%
  10. Creating Functions6%
  11. Creating Packages8%
  12. Working with Packages6%
  13. Using Dynamic SQL6%
  14. Design Considerations for PL/SQL Code8%
  15. Creating Compound, DDL, and Event Database Triggers6%
  16. Using the PL/SQL Compiler4%
  17. Managing PL/SQL Code4%
  18. Managing Dependencies2%
  1. 1

    A developer needs to execute a DDL statement, such as TRUNCATE TABLE, from within a PL/SQL procedure. The name of the table to be truncated is passed as a parameter to the procedure. Which method should be used to execute the DDL statement?

    Show answer details

    Correct answer: C

    DDL statements cannot be executed using static SQL in PL/SQL because the objects they reference must exist at compile time. When the object name is dynamic (passed as a parameter), Native Dynamic SQL (NDS) with EXECUTE IMMEDIATE is the required method. The entire DDL command must be constructed as a string and then executed.

  2. 2

    A PL/SQL procedure is defined with AUTHID CURRENT_USER. The procedure updates the SALES table. User SCOTT, who owns the procedure, grants EXECUTE privilege on it to user JANE. User JANE does not have any direct privileges on the SALES table. What happens when JANE executes the procedure?

    Show answer details

    Correct answer: B

    AUTHID CURRENT_USER specifies that the procedure executes with the privileges of the user who invokes it (the invoker), not the user who owns it (the definer). In this case, JANE is the invoker. Since JANE lacks the necessary UPDATE privilege on the SALES table, the SQL statement within the procedure will fail due to insufficient privileges.

  3. 3

    What is the primary purpose of enabling compile-time warnings using ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL'?

    Show answer details

    Correct answer: C

    PL/SQL compile-time warnings identify conditions that are not syntax errors but could lead to runtime errors or poor performance. Examples include unreachable code, subprograms that don't return a value on all paths, or severe performance warnings like passing a NOT NULL parameter to a subprogram that declares it without the constraint. Enabling warnings is a best practice for improving code quality and robustness.

  4. 4

    True or False: A user-defined PL/SQL record type can be used as a column data type in a database table.

    Show answer details

    Correct answer: B

    A record type defined within a PL/SQL block or package (TYPE ... IS RECORD) is a PL/SQL-only construct and cannot be used as a data type for a table column. To store a composite structure in a table column, you must create a SQL OBJECT type using the CREATE TYPE ... AS OBJECT DDL statement.

  5. 5

    A procedure processes a large set of rows fetched using BULK COLLECT. After processing, it needs to insert the modified data into a history table. Which statement provides the most performant way to insert all the records from the collection into the history table?

    Show answer details

    Correct answer: C

    FORALL is the companion to BULK COLLECT. It takes an entire collection and sends all the DML operations (like INSERT, UPDATE, or DELETE) to the SQL engine in a single call. This bulk binding approach drastically reduces the performance overhead of context switching that occurs when executing DML inside a regular loop.

  6. 6

    A financial services application uses a PL/SQL package to calculate loan eligibility. To improve performance for frequently called scenarios, the lead developer decides to use a result-cached function. The function takes a customer ID and loan amount as input. During testing, it's discovered that the function returns stale data if the customer's credit score, stored in a separate CREDIT_SCORES table, is updated. Which clause must be added to the function definition to ensure the cache is invalidated when the CREDIT_SCORES table changes?

    Show answer details

    Correct answer: B

    The RELIES_ON clause is specifically designed for result-cached functions to declare their dependency on database objects. When data in the CREDIT_SCORES table changes, the database automatically invalidates the function's result cache, ensuring subsequent calls re-execute the function and fetch fresh data. DETERMINISTIC is for functions that always return the same result for the same inputs, but it doesn't manage dependencies on table data. PARALLEL_ENABLE is for parallel query execution, and AUTONOMOUS_TRANSACTION is for independent transactions.

  7. 7

    A DBA is reviewing a large PL/SQL package and notices several procedures pass a large record type (defined with %ROWTYPE from a table with 50 columns) as an IN OUT parameter. The DBA suspects this is causing performance degradation due to excessive copying of the record's data. Which compiler hint should be used in the procedure definition to request pass-by-reference semantics and potentially improve performance?

    Show answer details

    Correct answer: A

    The NOCOPY hint is used in a subprogram's parameter list to request that the compiler pass the corresponding actual parameter by reference instead of by value. This is particularly effective for large composite types like records or collections passed as OUT or IN OUT parameters, as it avoids the overhead of creating a temporary copy of the data.

  8. 8

    A developer needs to create a PL/SQL package that will be deployed across different customer environments running Oracle Database 12c, 18c, and 19c. The package should use a new feature available only in 19c when possible, but fall back to an older implementation on earlier database versions. Which PL/SQL feature allows for this version-specific code implementation within a single source file?

    Show answer details

    Correct answer: C

    Conditional compilation allows the PL/SQL compiler to selectively include or exclude code based on conditions evaluated at compile time. By using the $IF directive with the DBMS_DB_VERSION.VERSION inquiry directive, a developer can write code blocks that are only compiled and included in the final package if the database version meets a certain criterion (e.g., is 19c or higher), providing a clean way to manage version-specific logic.

  9. 9

    A security audit requires that a specific sensitive procedure, process_payroll, within the HR_PKG package can ONLY be called by the BATCH_JOB_PKG and the FINANCE_REPORTS_PKG. No other database object or user should be able to execute this procedure directly. Which is the most effective and secure method to enforce this access restriction?

    Show answer details

    Correct answer: B

    The ACCESSIBLE BY clause provides a compile-time, whitelist-based access control mechanism for PL/SQL units. By specifying the calling packages in this clause, you instruct the compiler to raise an error if any other unit attempts to call the protected procedure. This is more secure than grant-based systems because it prevents access even from users with high privileges (like SYS) or through dynamic SQL, enforcing the restriction at the code level.

  10. 10

    A data processing pipeline needs to load configuration settings from a key-value table into a PL/SQL collection for fast lookups. The keys are VARCHAR2 strings (e.g., 'TIMEOUT', 'LOG_LEVEL') and the values are also VARCHAR2. The number of settings is unknown and can change. Which composite data type is the most appropriate choice for this requirement?

    Show answer details

    Correct answer: D

    An INDEX BY table, also known as an associative array, is the only PL/SQL collection type that allows a VARCHAR2 index. This makes it ideal for key-value pairs where the key is a string. It allows for direct, fast lookups using the string key (e.g., config_settings('TIMEOUT')), which perfectly matches the requirement. Nested tables and VARRAYs are indexed by integers only.

Create an account to continue.