Oracle PL/SQL · Free Tool

Oracle PL/SQL
API Package Generator

Instantly generate a complete Oracle PL/SQL API package with INSERT, UPDATE, and DELETE procedures — including exception handling — straight from your table definition.

Build Your API Package

Fill in your table details below. The Oracle PL/SQL API Generator will produce a ready-to-run package specification and body.

oracle-plsql-api-generator.sql
Schema-qualified optional: SCHEMA.TABLE_NAME
Single column primary key
Include the primary key column. Column order will be preserved.
Leave blank to use default p_
Leave blank for PKG_<TABLE>
Generated Package

What is the Oracle PL/SQL API Generator?

The Oracle PL/SQL API Generator is a free, browser-based tool that creates a complete PL/SQL package — including the package specification and body — for any Oracle database table. By entering your table name, column list, and primary key, you instantly receive production-ready INSERT, UPDATE, and DELETE procedures with proper exception handling, removing hours of repetitive boilerplate coding from your development workflow.

Whether you're building Oracle APEX applications, PL/SQL REST APIs, or database-driven back-ends, this Oracle PL/SQL API Generator follows Oracle best practices: parameterised DML, %TYPE anchored declarations, structured exception blocks, and optional autonomous COMMIT control.

📦

Package Spec & Body

Generates both the CREATE OR REPLACE PACKAGE specification and its corresponding body in a single click, ready to compile in SQL*Plus, SQL Developer, or Oracle APEX SQL Workshop.

🛡

Built-in Exception Handling

Every generated procedure includes a structured EXCEPTION block with DUP_VAL_ON_INDEX, NO_DATA_FOUND, and WHEN OTHERS handlers raising descriptive application errors.

🔧

Customisable Prefix & Naming

Specify your own parameter prefix (default p_) and package name convention to match your team's coding standards without manual find-and-replace.

Instant Copy & Paste

The one-click copy button puts the entire generated PL/SQL package on your clipboard, so you can paste straight into SQL Developer, VS Code, or Oracle APEX without any reformatting.

How to Use the PL/SQL API Generator

  1. 1

    Enter Your Table Name

    Type the Oracle table name in the Table Name field. You can optionally prefix with a schema, e.g. HR.EMPLOYEES. The generator uses this for the DML statements and derives the default package name.

  2. 2

    List All Columns

    Paste your comma-separated column list into the Table Columns field. Include every column you want the API to handle — the generator will use %TYPE anchoring for each parameter.

  3. 3

    Specify the Primary Key Column

    Enter the single primary key column in the Primary Key Column field. The DELETE procedure will use only this parameter; the UPDATE procedure uses it in the WHERE clause.

  4. 4

    Set Options (Optional)

    Customise the parameter prefix (default p_), package name, and toggle COMMIT, ROLLBACK, and error-logging options to match your project standards.

  5. 5

    Generate & Copy

    Click Generate PL/SQL API Package. Review the output, then hit Copy Code to send the complete package to your clipboard — ready to run in your Oracle environment.

Benefits of Using This Oracle PL/SQL API Generator

Save Hours of Boilerplate

Generating a fully structured PL/SQL package manually takes 30–60 minutes per table. This tool does it in seconds.

Oracle Best Practices Built-In

Anchored %TYPE declarations, named exceptions, and RAISE_APPLICATION_ERROR follow Oracle PL/SQL conventions from day one.

🔄

Consistent Across Tables

Every generated package follows the same structure, making code reviews, maintenance, and onboarding dramatically easier across large schemas.

🎓

Great for Learning PL/SQL

Students and developers new to Oracle can use the generated code as a reference for proper package structure, DML, and error-handling patterns.

🔐

No Data Leaves Your Browser

All generation happens client-side in JavaScript. Your table names and column definitions are never sent to any server — your schema stays private.

🔌

Works with Oracle APEX

Generated packages slot directly into Oracle APEX application processes, validations, and dynamic actions without any modification.

Frequently Asked Questions

What Oracle versions does the generated PL/SQL support?
The generated package code is compatible with Oracle Database 11g and later, including 12c, 18c, 19c, 21c, and Oracle 23ai. All syntax — %TYPE anchors, RAISE_APPLICATION_ERROR, and structured exception blocks — is part of standard PL/SQL available in every modern Oracle edition.
Can I use this Oracle PL/SQL API Generator for tables with composite primary keys?
The current version supports single-column primary keys. For composite keys, generate using either column as the PK, then manually adjust the DELETE and UPDATE procedures to include both columns in the WHERE clause. A composite key option is planned for a future update.
What does the parameter prefix do and what is the default?
The parameter prefix is prepended to every procedure parameter name to distinguish it from column names in DML statements. The default prefix is p_, so a column called SALARY becomes parameter p_salary. Common alternatives include pi_ (parameter-in) or v_ (variable). Leave the field blank to use p_.
Should I include COMMIT in my PL/SQL package procedures?
It depends on your architecture. For standalone utility packages called directly from SQL*Plus or scripts, including COMMIT is fine. If the procedures are called from a larger transaction or an Oracle APEX process that manages its own commit, uncheck the COMMIT option to let the caller control transaction boundaries — this is usually the safer approach in enterprise systems.
How does the exception handling work in the generated package?
Each procedure contains an EXCEPTION block with handlers for the most common Oracle errors: DUP_VAL_ON_INDEX (unique constraint violation), NO_DATA_FOUND (update/delete on non-existent row), and a catch-all WHEN OTHERS that calls RAISE_APPLICATION_ERROR with a descriptive message including SQLERRM. If ROLLBACK is enabled, it is called before re-raising the error.
Can I use the generated code with Oracle REST Data Services (ORDS)?
Yes. The generated procedures can be exposed via ORDS by mapping them to REST endpoints in Oracle SQL Developer or Oracle APEX. Each procedure accepts simple scalar parameters that map cleanly to ORDS bind variables or request body fields. See also our SQL Formatter for cleaning up complex queries before wrapping them in REST handlers.