Skip to content

Coming from Oracle APEX ​

pgkiln borrows APEX's model on purpose, so most of what you know carries over. This chapter maps the concepts, explains the differences that matter, and gives tips for porting PL/SQL. What's missing is listed in the feature parity matrix.

Concept map ​

Oracle APEXpgkiln
Instance / workspaceOne pgkiln installation; workspaces group applications and developers in the builder (Workspace utilities → Workspaces; not a security boundary: tenants who must not see each other get separate installations, chapter 3)
Parsing schemaThe app's database role (db_role); schema access comes from its grants. Required, as in APEX (sprint 186), and never a superuser or a role that bypasses row level security (chapter 8)
Application, page, region, item, buttonThe same, stored in meta.*
Page DesignerBuilder page designer (component tree, layout with drag and drop and a gallery, property editor)
Shared componentsNavigation menu, lists, authorization schemes, lists of values, application items, application processes, build options, supporting objects
:P1_ITEM, :APP_USER, :REQUEST, &ITEM.The same syntax
v('P1_ITEM')meta.v('P1_ITEM')
apex_page.get_url / apex_util.prepare_urlmeta.page_url(page, items)
APEX_ACL / apex_acl.has_user_rolemeta.has_role('role')
APEX_SESSION.SET_TENANT_ID, APP_TENANT_ID; multi-tenant workflows and tasksmeta.set_tenant(tenant), meta.tenant_id(); workflows, tasks and their lists follow the session's tenant (chapter 6)
APEX_DEBUG (message, error, warn, info, trace), debug levels, View Debugmeta.debug(level, text), meta.debug_enabled(level); the app's debug level; Activity → Debug messages (chapter 6)
Instance administration: install/upgrade logWorkspace utilities → Installation (administrators)
APEX_WEB_SERVICE.make_rest_request, g_status_codemeta.web_request(url, method, body, headers, credential) or meta.web_request_source(source, params), then meta.web_response(id). Asynchronous: the server makes the request after the page process that queued it, or after the commit (chapter 9)
Workspace → Generative AI services; Generate Text with AI process and dynamic action; APEX_AI.generateWorkspace utilities → AI services (Claude, OpenAI, Gemini or an OpenAI-compatible service such as Ollama; administrators); the ai_generate process and dynamic action, with structured outputs into items (chapter 6); meta.ai_generate(service, prompt, system, schema) then meta.ai_result(id) (chapter 9)
AI Assistant region; AI agents with tools; AI interactive reports (natural language to interactive report)The ai_assistant region: a chat with context queries (RAG over your queries) and tools (SQL as the app role with bound arguments, REST data sources) (chapter 4); "ai_filter" on a report: Ask in your own words, the request becomes the report's settings as editable chips, with or without an AI service (chapter 4)
App Builder / SQL Workshop AI Assistant (create pages, generate and explain SQL); describing tables for AIThe App Builder's AI service: Create pages with AI (proposals you confirm), SQL Workshop → AI (SQL from a question, shown not run; explain a query or error), Describe tables (meta.ai_table_note, optionally COMMENT ON) (chapter 3)
Blueprints (spec-driven development)Create → From a blueprint: a JSON blueprint (tables, pages, menu, sample data), optionally drafted by AI, reviewed, then created in one transaction (chapter 3)
APEX_DATA_PARSER.parse, get_columnsmeta.parse_data(blob, …) (rows with cols and data), meta.parse_data_columns(blob, …); CSV/TSV and JSON, not Excel or XML (chapter 9)
Team Development (issues, labels, milestones, templates, feedback)Builder → Team Development (/builder/team): issues per workspace with labels in groups, milestones, assignees, application and page links, Markdown comments with @mentions shown in the builder, history, saved views and a board; a set-up wizard with sample labels, templates and milestones; feedback and developer comments become issues. No e-mail and no GitHub synchronisation (chapter 3)
Workspace users (APEX accounts), Application Access Controlmeta.account (Builder → Users), meta.app_access (Access control)
Page access protection "Arguments must have checksum"protection = 'checksum' (the default)
Automatic row processing (DML)Process type form_dml
Interactive grid DMLProcess type grid_dml
Interactive grid: aggregates, frozen columns, column reorder/resize/hide, saved reports, row actions menu, copy/pasteGrid aggregates, layout/frozen, Actions → Columns (or drag), saved grid reports, row_actions; copy/paste of cell ranges in the browser (chapter 4)
Report link columns (a column of type Link, several per report); Inline Dialog opened with #static_id(sprint 238) Report and classic report link_columns (label, page, items, style, when) and row_actions (chapter 4); a link to #<static id>, a redirect button's target_region, a process's or branch's open_region (chapter 4)
Master-detail (a detail region with a master region)Master grid select_row (column → item), detail master (item, and the column new rows get)
PL/SQL processProcess type sql calling PL/pgSQL (select my_fn(:P1_X))
apex_error.add_error / raising errorsraise exception '…' using column = 'col'
Before-header processesProcess point = 'load'
Page computations (static, item, SQL query, SQL expression, PL/SQL function body)Computations before_header / after_submit; function bodies are PL/pgSQL (chapter 6)
Branches (page or URL, When button pressed, server-side condition), before header and after processingBranches with when_button and a condition; URLs stay inside the application (chapter 6)
Validation types (Rows returned, Expression, Function Body returning Boolean / Error Text, Item is NOT NULL / numeric / a valid date …, Item = Value, Item in Value, character checks, Regular Expression), Always Execute, Display LocationThe same types as type (exists, sql, function_body, function_error, not_null, numeric, valid_date, equals, in_list, chars_only, regex …), always_execute, display_location (chapter 6). Interactive grid column validations aren't there yet: use a validation on the grid's process or a check constraint
Dynamic action events (Double Click, Key Down / Press, Mouse Enter / Leave, Select, Resize, Scroll, Page Unload, Before Refresh, Facets Change), conditions (greater / less than, not in list) and actions (Cancel Event, Set Style, Collapse / Expand Tree, Show AI Assistant, Trigger Geocoding, Invoke Interactive Report Dialog)The same events, conditions and actions (chapter 7). JavaScript expression conditions: use a registered function
Component events: Row Initialization and Save [Interactive Grid], Date Select and View Change [Calendar], Map Object Clicked and Map Changed, Selection Change [Tree]grid_row_init, grid_save, calendar_date_select, calendar_view_change, map_object_click, map_change, tree_selection_change, triggered by the region (chapter 7)
Workflow Diagram regionworkflow_diagram with {"instance_item": …} (chapter 6)
Map layers Points, Lines, Polygons, Heat Map, Extruded Polygons"layer": markers, lines, polygons, heat, extruded (drawn flat, shaded by height), with fill and line colours, width and opacity per layer or per row (chapter 4)
Items Image Upload, Text Field with autocomplete, Percent Graph, Display Mapimage_upload, autocomplete, percent_graph, display_map (chapter 5)
Process types Close Dialog, Clear Session State, Reset Pagination, User Preferences, Server Side Geocoding, Print Report, Human Task – Create / – Manage, Form – InitializationThe same as type (chapter 6), settings in the attributes
Server-side Condition (Rows returned, Expression, Function Body, Request = / != / is contained in, Item is NULL / NOT NULL / zero / = Value / in colon list, Current page in, Current page is a modal dialog, User is authenticated / public user, Current language in, Always / Never …)The same list as condition_type: exists, sql, function_body, request_in / request_not_in, item_null / item_not_null / item_zero / item_equals / item_in_list, page_in, page_is_dialog, user_signed_in / user_public, language_in, always / never (chapter 6). APEX's colon lists stay colon lists; Request is contained in takes commas
Build options (include / exclude)Build options; !NAME for APEX's "exclude when the option is included" (chapter 6)
Menu button, button badgeButton action menu; badge / badge_query
Dynamic actions Set Focus, Add / Remove Class, Show Success / Error Message, Clear Errorsset_focus, add_class / remove_class, show_success / show_error, clear_errors
Application computation / process on new sessionApplication process (after_login, before_page)
VPDPostgreSQL row level security
APEX collectionsTemporary or unlogged tables, or jsonb
File Browse item, APEX_APPLICATION_TEMP_FILESItem type file; view meta.temp_files (chapter 16)
Rich Text Editor, Markdown Editor, Star Rating, Combobox, QR CodeItem types richtext (sanitised HTML), markdown, rating, combobox (colon-separated), qrcode; plus daterange (from:to) and {"reveal": true} on password items (chapter 5)
Data Generator (sample data for development, 26.1)SQL Workshop → Sample Data: generators proposed per column, foreign keys to existing parent rows, a seed, preview, insert in one transaction (parents first), SQL/CSV download, saved definitions (chapter 16)
Data Workshop (load and unload: CSV, Excel, JSON, XML) / Data Load Definition, Execute Data Load processSQL Workshop → Load Data and Unload Data (CSV, JSON, Excel, XML; chapter 16); Shared Components → Data load definitions; process type data_load with "definition" (chapter 16)
SQL Workshop → Utilities → Generate DDL, Schema ComparisonSQL Workshop → DDL and Compare: a schema's DDL in an order that runs; two schemas compared by their DDL with a change script; also pgkiln ddl and pgkiln compare (chapter 3)
SQL Workshop → SQL Scripts, Quick SQL, Query BuilderThe same names in the SQL Workshop: saved scripts with a result per statement and a run history, shorthand → PostgreSQL DDL, a SELECT built on a canvas of tables, joined by foreign keys or columns you connect, with column functions and grouping (chapter 3)
Interactive report Download → PDF, printingActions → Download PDF, Print (chapter 16)
Pagination Row Ranges X to Y, Maximum Row Count, region Lazy Loading, Server Cache"pagination": "range", max_rows, "lazy": true, "cache": {"scope", "seconds"} (large tables)
APEX_UTIL.CHANGE_CURRENT_USER_PW, RESET_PASSWORD, EXPIRE_END_USER_ACCOUNTMy account page; meta.set_password(), meta.expire_password() (chapter 8)
Navigation menu badges, a notification bell in the header, badges refreshed with dynamic actions and JavaScriptA list entry's badge or badge_query (also in the navigation bar), Settings → User Interface → Notification bell with meta.notify(user, title, body, page, items) or the process type send_notification, Live badges (seconds) and the dynamic action event timer (chapter 4)
Progressive Web App push notifications: APEX_PWA.SEND_PUSH_NOTIFICATION, HAS_PUSH_SUBSCRIPTION, Send Push Notification process, the subscription settings pagemeta.send_push(user, title, body, page, items), meta.has_push_subscription(user), process type send_push, My account → Notifications and the dynamic action push_subscribe (chapter 17)
APEX_MAIL, Send E-Mail process, e-mail templatesmeta.send_mail, meta.send_mail_template, meta.add_mail_attachment, the send_email process and Shared Components → E-mail templates (#NAME# placeholders) (chapter 6). Instead of the instance's SMTP settings: mail services with SMTP (password or OAuth2), Microsoft Graph, Amazon SES, Resend, Postmark, SendGrid or Mailgun. APEX_MAIL.PUSH_QUEUE is not needed: mail goes out right after the commit
APEX_PRINT.GENERATE_DOCUMENT for a mail attachment(sprint 237) meta.document_pdf(template, items) with meta.add_mail_attachment, or {"document": …} in a send_email process's attachments (chapter 6): the PDF is drawn on the server, no jsPDF in the browser and no hidden file item
APEX_PRINT.GENERATE_DOCUMENT into a BLOB(sprint 245) meta.document_temp_file(template, items, filename): a temporary file the server draws when the process ends; the next process reads it from meta.temp_files (chapter 16)
APEX_APP_SETTING, APEX_UTIL.GET/SET/REMOVE_PREFERENCE, Maintain session state: Per UserShared Components → Application settings and meta.get_app_setting/meta.set_app_setting; meta.get_preference/set_preference/remove_preference; {"persist": "user"} on an item (chapter 6)
APEX_DATA_EXPORT.EXPORTmeta.data_export(query, format, options) (CSV, JSON, XML, HTML) and the download process's {"export": "xlsx"} (also PDF) (chapter 6)
APEX_LANG.LANG, dynamic translationsShared Components → Dynamic translations and meta.lang(text) (chapter 14)
Display Image, Geocoded Address itemsItem types image and address (geocoder: GEOCODER_URL) (chapter 5)
(sprint 241) APEX_CUSTOM_AUTH.SET_USER in a custom scheme's post-authentication procedure; an item's Value Placeholder; &ITEM. in item labels; a page template without navigation that stays an application pagemeta.set_auth_user(name) in the post-authentication code (chapter 8); the item's placeholder (the APEX importer carries p_placeholder over) and labels with substitutions (chapter 5); page template no_navigation (chapter 4)
Shuttle, Select One, Select Many (24.2) itemsItem types shuttle (ordered, colon-separated), select_one and select_many (a search field over the list of values; chips): plain selects without JavaScript (chapter 5)
Classic Report region (report templates, pagination types)Region type classic_report: report_template standard, value_pairs, badges or media_list; pagination total, range or none (chapter 4)
Breadcrumb region (Breadcrumb Bar), Help Text region and page helpRegion types breadcrumb (from each page's Breadcrumb parent; no separate breadcrumb shared component) and help_text; the page's Help text (Markdown) (chapter 4)
The page template's Slot list: Banner, After Logo, Before / After Navigation Bar, Top Navigation, Breadcrumb Bar, Full Width Content, Body, Footer, Dialogs, Drawers and PopupsA region's position (display positions); the importer maps the display points AFTER_LOGO, BEFORE_NAVIGATION_BAR, AFTER_NAVIGATION_BAR, REGION_POSITION_01 (Breadcrumb Bar), REGION_POSITION_04 (Dialogs, Drawers and Popups) and REGION_POSITION_05 (Footer)
Translated applications (XLIFF), APEX_LANG.MESSAGE, &APP_TEXT$NAME.Translations in the app (XLIFF/CSV import and export), meta.message(), &APP_TEXT$NAME. (chapter 14)
Application date format maskSettings → Globalization → Date format (Oracle-style masks)
Number format masks (FML999G999G990D00) on columns and items{"formats": {...}} on report, grid and cards columns, {"format_mask": "..."} on charts and number/display items (chapter 14)
Automatic Time ZoneSettings → Globalization → Time zone and Automatic time zone; My account → Time zone (chapter 14)
Universal Theme's default style (26.1: Iris)Base style Iris (the default for new applications), Lavender or Standard (chapter 14)
Theme styles, Enable End Users to Choose Theme StyleTheme style (automatic/light/dark) and Users may choose light or dark; Theme Roller style variants with Users may choose a style (chapter 14)
Universal Theme 26.2: Pillar Light / Pillar Dark, Theme Roller's Header Pillar Strip, u-color-*-subtleTheme Roller → Navigation appearance and Header strip colour (per application or style), the same utility classes (chapter 14)
Template Options (regions, buttons)Template options in the Page Designer: CSS classes from a fixed list (chapter 4)
Sub regions (Parent Region), Tabs Container, Collapsible, the gallery's Flex ContainerA region's Parent region (one level deep), the templates tabs_container, collapsible and flex_container; the Page Designer's Sub regions slot, Create Sub Region and Containers in the gallery (chapter 4)
A region's Layout (Start New Row, Column, Row and Column CSS Classes, Column Attributes), Appearance (CSS Classes, Icon, Render Components), Accessibility (landmark), Advanced (HTML DOM ID, Custom Attributes, Region Display Selector, Exclude Title from Translation), Header and Footer, Read Only, Customization, Comments, Audit InformationThe same properties in the same groups of the property editor (sprint 230; chapter 4). The HTML DOM ID goes on the region's content: its element keeps R<id>. Custom attributes are limited to data-*, aria-*, title, lang, dir, tabindex and translate
ORDSNot needed to serve apps; REST APIs with PostgREST, see below
Export f123.sql / APEXlangmeta.export_app('alias') (JSON); an APEX f123.sql imports with pgkiln import-apex or Import → From Oracle APEX (below)

Importing an APEX application ​

(Sprint 182.) An APEX application export in the SQL format (f100.sql, or a split export as a directory or .zip) becomes a pgkiln application in one step:

sh
pgkiln import-apex f100.sql --dry-run            # the report only
pgkiln import-apex f100.sql --check --schema sales   # the report and the tables, columns … the database lacks
pgkiln import-apex f100.sql --alias sales --schema sales
pgkiln import-apex f100.sql --out apps/sales     # the application files, to edit, then: pgkiln import apps/sales

or in the builder: App Builder → Import → From Oracle APEX (upload, read the report, choose the alias and the schema, Import). The file is read as text and never run: the importer parses the wwv_flow_imp… calls (named arguments, q'[…]' quotes, wwv_flow_string.join lines, unistr, wwv_flow_imp.id ids) and builds the same document meta.export_app() writes, which meta.import_app() imports like any export. The tables, views and packages of the parsing schema are not in an application export: create them in PostgreSQL first, with ora2pg (below; --schema names the schema unqualified tables are in; the default is the parsing schema in lower case). (sprint 186) Without --db-role the application gets the role app_<alias>, with rights on that schema when it exists (the builder's import and --schema), else without rights yet: grant it what the pages need, or name a role of your own with --db-role.

The import report lists every component as mapped, mapped with notes or not mapped, with its APEX type, and marks what needs porting. PL/SQL is carried over as it is (into the PL/pgSQL or SQL field of the pgkiln component). Nothing unknown fails the import: it is in the report.

Oracle SQL is rewritten where the meaning stays the same (sprint 187): in region and list of values queries, validations, conditions, computations, authorization schemes and Set Value actions, outside string literals, q'[…]' quotes, quoted names and comments. The report says what was rewritten for each component.

OracleBecomes
nvl(a, b)coalesce(a, b)
nvl2(a, b, c)(case when a is not null then b else c end)
decode(e, s1, r1, …, default)(case when e is not distinct from s1 then r1 … else default end): like DECODE, two nulls are equal
sysdate, systimestamplocaltimestamp(0), current_timestamp
select … from dualselect …
orders_seq.nextval, .currvalnextval('orders_seq'), currval('orders_seq')
v('P1_X'), nv('P1_X'):P1_X
… minus select …… except select …
"ORDER_TOTAL", "OEHR_ORDERS" (quoted, upper case)order_total, oehr_orders: the same name in Oracle as unquoted, and lower case as ora2pg makes it; a PostgreSQL key word stays quoted ("ORDER" → "order") (sprint 192)
from orders (no schema)from sales.orders: the --schema (sprint 192). An application's role has no search path of its own, and in APEX an unqualified name is the parsing schema's. (sprint 217) APEX's views pgkiln has become apex.apex_… (chapter 9); the others are left as they are
median(x)percentile_cont(0.5) within group (order by x) (sprint 217; not as a window function)
listagg(x, ', ') within group (order by y)string_agg((x)::text, ', ' order by y) (sprint 217; not with on overflow or over)
sysdate - 1, sysdate + 1/24, sysdate - (1/24/60/60 * :P1_SECONDS)localtimestamp(0) - (1.0) * interval '1 day' …: a number of days, as decimals (Oracle's 1/24 is an hour, not 0) (sprint 217; only a number or numbers, binds and arithmetic in parentheses: sysdate - hire_date is days between two dates and stays)
instr(a, b), instr(a, b, 1)strpos((a)::text, (b)::text): 0 when not found, as instr (sprint 217; another start position or occurrence stays)
apex_lang.message(…), apex_app_setting.get_value(…)meta.message(…), meta.get_app_setting(…): the same parameters (sprint 217)

What changes the meaning or the shape of a query stays as it is and is named in the report as needs porting: rownum, (+) outer joins, connect by, listagg with on overflow or over, instr from another position, to_number without a format, substr from the end, and calls to APEX and Oracle packages. Port them with the table below; the Advisor then finds what doesn't run yet.

Team Development issues for the hand work (sprint 187): the import makes one open issue in the workspace's Team Development for each component that was not mapped or still needs porting, linked to the application and its page and labelled APEX import, with the APEX type, what it became and the report's notes. The report becomes a list to work through and close. Untick Make a Team Development issue for each component that needs hand work on the import form, or pass pgkiln import-apex --no-issues, to leave them out. At most 300 are made per import; one more issue lists the rest.

APEX 26.2 exports (sprint 190) write a component's settings as p_attributes=>wwv_flow_t_plugin_attributes(…) key/value pairs instead of p_attribute_01 …, leave out p_list_id and p_region_id on list entries and region columns (they belong to the list or region written before them), and write classic reports as create_report_region. The importer reads both forms; (sprint 192) a form item without p_source_type (26.2's default, a column of the form's region) is a column of the form. It is tested in CI on a real 26.2.1 export, the sample application Demonstration - HR (46 pages, test/fixtures/apex/f77536.sql): every page but the login page is imported and opens ((229) the Global Page as page 0, which is never opened by itself); what's left is the application's own PL/SQL and APEX's built-in administration pages.

What maps:

APEXpgkiln
Application: name, alias, primary language, date format, home page, versionThe same; authentication becomes the user directory, themes and templates pgkiln's theme
Pages: number, name, title, alias, normal or modal (non-modal: modal), public, help, authorizationThe same; (193) the alias in lower case with hyphens (LEAVE_REQUESTS → leave-requests), or one from the name when pgkiln can't use it (page alias). (229) The Global Page is page 0, pgkiln's Global Page, with its components (always a normal page). The login page (with apex_authentication.login, or (209) APEX 26.2's Invoke API process of APEX_AUTHENTICATION.LOGIN) is not imported; the login page's components go with it, under one report entry
Regions: Static Content, Classic Report (also create_report_region), Interactive Report, Form, Interactive Grid, Breadcrumb, Help Textstatic, classic_report, report, form (table, key column and item), grid (table, key, columns), breadcrumb, help_text; a table source becomes select … from schema.table
(sprint 190) Chart (JET), Cards, Calendar, Faceted Search, Listchart: the kind from the chart type (bar → column, horizontal → bar, stacked → stacked, dial → gauge …) and a SELECT from the series: label column, value column or aggregate (count, sum, avg, min, max) on the series' table, query or the region's source; series with another source are left out. cards: the region's query with the card's title, body and badge columns as title, body, badge. calendar: start date, end date and display columns as start_date, end_date, title. facets: its facet items (checkbox, range with the STATIC2 ranges, star rating, search) become facets[], linked to the report it filters (a classic report becomes an interactive report). list: the shared list and its entries
Page items: text (e-mail, phone, URL), text area, number, date picker, select list, radio group, checkbox(es), switch, hidden, display only, password, popup LOV, shuttle, file, rich text, Markdown, star rating, colour, combobox, Select One / Many, QR code, image upload, display image, percent graph, address, display mapThe pgkiln item type of the same name; form columns, primary key, required, help, lists of values (shared, SQL, STATIC/STATIC2), static defaults. A SQL or PL/SQL default or source becomes a before header computation. Plug-in items become text fields
(sprint 195) Sub regions (p_parent_plug_id)The region's parent. pgkiln nests one level deep, so a region deeper down becomes a sub region of its top-most ancestor (with a note). A parent with Universal Theme's tabs (t-TabsRegion… template options) becomes a tabs_container; a region with is-collapsed / is-expanded a collapsible
(sprint 230) p_region_css_classes, p_icon_css_classes, p_plug_new_grid_row, p_plug_grid_column, p_plug_grid_row_css_classes, p_plug_grid_column_css_classes, p_plug_grid_column_attributes, p_region_attributes, p_plug_item_display_point, p_landmark_type, p_landmark_label, p_plug_header, p_plug_footer, p_plug_commentThe region's properties. A region narrower than 12 columns starts a new row unless p_plug_new_grid_row => false (APEX's default). CSS classes with APEX placeholders, icons pgkiln doesn't know and attributes it refuses (event handlers, style) are left out with a note
Buttons: submit, redirect to a page of the application (with items), defined by dynamic actionsubmit, redirect (target page and items), da; position as the slot
Server-side conditionsThe same catalogue: rows returned, expression, function body, request =/in, item null / not null / zero / = / in list, current page, public user, language, never
Computations: static, item, query, SQL / PL/SQL expression, function bodystatic, item, sql_query, sql_expression, function_body
Branches to a page of the application, function returning a URLpage with items, function
Dynamic actions: change, click, page load, Dialog Closed, focus, key and mouse events, after refresh, before submit, custom; Show, Hide, Enable, Disable, Set Value, Refresh, Execute Server-side Code, Submit, Close / Cancel Dialog, Alert, Confirm, Set Focus, Add / Remove Class, Clear, Cancel EventOne pgkiln row per action with the event's trigger and client-side condition; false actions with the opposite condition
Shared lists of values (SQL, table, static), authorization schemes (exists, not exists, is in group / role)lov, authz_scheme (sql or role); a scheme that isn't mapped is not created, so the components that name it are denied (fail closed) until you add it
Navigation menu, listsThe navigation menu (entries to pages of the application); (sprint 190) the lists that list regions show, with their entries (pages, items, https links)
(sprint 209) Interactive report columns (create_worksheet_column) and the default report (create_worksheet_rpt)The report's headings (labels that differ from pgkiln's own), formats (format masks; APEX's SINCE, PCT_GRAPH, IMAGE and DOWNLOAD are left out with a note), hidden (Hidden columns, and the columns the default report doesn't show: APEX users could add those under Actions → Columns), empty (the No data found message), the detail link as link with icon (f?p=…:3:…:P3_ID:\#ID#\ → page 3, P3_ID = #id#; else a column link), and the default report's sort as the query's order by (when it has none). (sprint 211) The other saved reports become saved reports, below
(sprint 209) Classic report columns (create_report_columns)headings, formats, hidden (Hidden Column), and the first column link as link (with icon when its text is an icon)
(sprint 209) Interactive grid columns (create_region_column), the grid (create_interactive_grid) and its default view (create_ig_report_column)headings, formats, hidden (Hidden columns), readonly (Display Only, Query Only, read only Always), per column in columns: required, lov (a shared list of values, a SQL query or STATIC:), default (static, or an item as &ITEM.) and default_sql (SQL query); the default view as layout (order, hidden, widths, frozen columns); the edit operations as allow. A column's display value of a list of values (LOV_ESCAPE_SC) is the column itself: join the lookup table to show the name
(sprint 209) Build options; a component's build option (p_required_patch)build_options (the name in capitals: Feature: About Page → FEATURE_ABOUT_PAGE), and build_option on pages, regions, items, buttons, processes, computations, validations, branches, dynamic actions and list and navigation entries; APEX's negative id (Exclude) becomes !NAME
(sprint 209) Application itemsapp_items (name and comment); Global scope becomes the application's own item
(sprint 209) Application processes (PL/SQL)app_processes: On New Session and After Authentication → after_login, On Demand → ajax, the other points → before_page (with a note); the code as for a PL/SQL page process. pgkiln's application processes have no condition: one with a condition is noted
(sprint 209) Application computationsapp_computations with the page computation types; After Authentication / On New Session → after_authentication, After Submit → after_submit, the rest → before_header; Never is not imported
(sprint 209) Application settingsapp_settings: value, valid values (a value outside them is left empty), required, keep on upgrade, comment
(sprint 211) Saved interactive reports (create_worksheet_rpt other than the default, create_worksheet_condition, create_worksheet_computation)Saved reports of the region: public reports (APEX's alternative reports) belong to the developer who imports the application (pgkiln import-apex: the operating system user), private ones to their APEX user in lower case (they see them once they sign in). Carried over: the columns it shows (others hidden, its column order), the first sort column, the control break and its aggregates, rows per page, filters and highlights (=, !=, <, <=, >, >=, contains, does not contain, is null, is not null, in, not in, between, like '%x%', is in the last 7 / 30 days, is in the next 7 days; a highlight colour becomes the nearest of yellow, green, red, blue and grey), the search and computed columns (APEX's column letters become the column names). Other operators (regexp_like, is in the last 3 hours …), chart, group by and pivot views, and a private report whose user name pgkiln cannot use are noted
(sprint 211) A report column's list of values (Display as: Display Text (based on LOV) in interactive and classic reports: a shared list, an inline STATIC: list or a query)The column shows the display value: the region's query becomes a query of its columns (in the query's order) with that column looked up in the list ((select d from (…) l(d, r) where l.r::text = q."col"::text limit 1)). A column a link passes on (#col#) keeps its value
(sprint 211) Interactive grid column validations (create_page_validation with p_tabular_form_region_id / p_associated_column)The grid column's validation (an SQL expression on :COLUMN, checked for each added or changed row) and validation_message (#COLUMN_HEADER# and #LABEL# become the heading): not null, numeric, alphanumeric, no spaces, = / != / in / not in a value, regular expression, SQL expression, exists / not exists. Several on one column are joined with and (the first one's message). PL/SQL function bodies are left to port; the validation's condition is noted (pgkiln checks every save)
(sprint 211) Breadcrumbs (create_menu, create_menu_option)Each entry's parent entry's page becomes its page's breadcrumb parent; the trail shows the pages' names (an entry's own label, when it differs, is noted). An entry that links outside the application, a page in two breadcrumbs (the first parent stays) and a parent that would make a cycle are noted
(sprint 211) Chart axes (create_jet_chart_axis)The value axis' number format (decimal with its decimal places, currency) becomes the chart's format_mask (FM999G999G999G990D00, FML999G999G999G990D00); a dial gauge's range (p_value_min, p_value_max, or the value axis' minimum and maximum) its gauge min and max. pgkiln draws its own axes: titles, a second value axis (y2), log scales, fixed ranges, hidden axes and scaling are noted
(sprint 211) Access control roles (create_acl_role)pgkiln's application roles are names: an ACL role becomes the role named by its static id in lower case (ADMINISTRATOR → administrator), and Is In Role or Group authorization schemes that name it (by name or static id) check that role. Give it to users under Access control (APEX's user role assignments are data, not part of the export). The application setting ACCESS_CONTROL_SCOPE = ALL_USERS becomes access control any user; ACL_ONLY keeps assigned
(sprint 211) Dynamic content regions (Dynamic Content, NATIVE_DYNAMIC_CONTENT, and PL/SQL Dynamic Content, NATIVE_PLSQL)A dynamic region when the PL/SQL is SQL in disguise: a function body that is one return expr; becomes select expr, a block of only htp.p(expr); / htp.prn(expr); calls select (expr) || …. Escape values with meta.html_escape(); anything else (variables, loops, cursors) stays a static region with the source, to port

Validation types (CD-1):

APEX p_validation_typepgkiln typeNotes
ITEM_NOT_NULL, ITEM_NOT_NULL_OR_ZERO, ITEM_NOT_ZERO, ITEM_CONTAINS_NO_SPACES, ITEM_IS_ALPHANUMERIC, ITEM_IS_NUMERIC, ITEM_IS_DATE, ITEM_IS_TIMESTAMPnot_null, not_null_or_zero, not_zero, no_spaces, alphanumeric, numeric, valid_date, valid_timestamp
ITEM_IN_VALIDATION_EQ_STRING2, …_NOT_EQ_STRING2, …_IN_STRING2, …_NOT_IN_STRING2equals, not_equals, in_list, not_in_listColon lists stay colon lists
ITEM_IN_VALIDATION_CONTAINS_ONLY_CHAR_IN_STRING2, …_AT_LEAST_ONE_CHAR_…, …_NO_CHAR_…chars_only, chars_any, chars_none
REGULAR_EXPRESSIONregexChecked by PostgreSQL (POSIX): check Oracle-only syntax
EXISTS, NOT_EXISTS, SQL_EXPRESSION, EXPRESSION (SQL)exists, not_exists, sqlOracle SQL is named in the report
EXPRESSION (PL/SQL), PLSQL_EXPRESSIONsqlNeeds porting
FUNC_BODY_RETURNING_BOOLEAN, FUNC_BODY_RETURNING_ERR_TEXTfunction_body, function_errorNeeds porting
PLSQL_ERRORfunction_error(sprint 227) Needs porting: the block runs inside begin … return null; exception when others then return '<message>'; end, so an exception fails the validation with its message (#SQLERRM# / #SQLERRM_TEXT# become the error's text; no message: the error's text)
Plug-in validations, interactive grid column validationsnot mappedUse function_body, or a grid column's validation

The error message's #LABEL# becomes the item's label; Always Execute, When Button Pressed, the server-side condition and the display location (Inline with Field and in Notification, Inline with Field, Inline in Notification; On Error Page becomes a notification) carry over.

Process types (CD-4):

APEX p_process_typepgkiln typeNotes
NATIVE_FORM_INIT, NATIVE_FORM_DMLform_init, form_dmlWith the form region. form_dml decides by the button name (CREATE, SAVE, DELETE …): the report says when a button's Database Action doesn't match its name
NATIVE_IG_DMLgrid_dmlWith the grid region
NATIVE_PLSQLsql(sprint 209) PL/SQL that is SQL in disguise becomes that SQL (below); other PL/SQL as it is: needs porting
NATIVE_SESSION_STATE (clear the current page, pages, items, all)clear_session_state{"pages": …}, {"items": …}, {"all": true}
NATIVE_CLOSE_WINDOWclose_dialogItems to return as {"items": …}
NATIVE_RESET_PAGINATIONreset_pagination
NATIVE_SEND_EMAILsend_emailFrom, to, cc, bcc, reply to, subject, plain and HTML body; attachments and e-mail templates are not carried over; the application needs a mail service
NATIVE_INVOKE_API on a PL/SQL packagesql: call pkg.proc(p_a => :P3_ID, …)Create the function or procedure in PostgreSQL (a schema for the package)
NATIVE_INVOKE_API on a REST data sourceinvoke_api with source and paramsCreate the REST data source under that name
NATIVE_EXECUTION_CHAINchainChild processes keep their chain
NATIVE_FORM_FETCH, NATIVE_FORM_PROCESS (legacy forms), NATIVE_WEB_SERVICE, NATIVE_USER_PREFERENCES, NATIVE_PRINT_REPORT, NATIVE_GEOCODING, NATIVE_WORKFLOW, NATIVE_HUMAN_TASK_*, plug-insnot mappedThe report says which pgkiln type to set up by hand

PL/SQL that is SQL (sprint 209). A PL/SQL process (on a page or of the application) whose body is only SQL, in a begin … end; block or not, becomes a pgkiln sql process that runs, rewritten like other Oracle SQL:

PL/SQLBecomes
begin update …; delete …; end; (any insert, update, delete, merge)the statements
:P3_A := upper(:P3_B); :P3_C := nvl(:P3_D, 0); (after any of those statements)select upper(:P3_B) as p3_a, coalesce(:P3_D, 0) as p3_c: a column named like an item sets it. Not when an expression reads an item assigned just before it
select ename, sal into :P3_ENAME, :P3_SAL from …;select ename as p3_ename, sal as p3_sal from …
insert … returning id into :P3_ID;insert … returning id as p3_id

Everything else (declare, variables, if, loops, exceptions, package calls) stays as it is and needs porting. Until it is ported such a process fails where it runs: on a submit the submit is rolled back with the error; while the page is shown the error shows at the top and the rest of the page still works.

Not imported yet: interactive grid saved reports other than the default view, interactive report chart, group by and pivot views, maps and trees, dynamic content whose PL/SQL is more than a return or htp.p calls, lists other than the navigation menu and the lists regions show, users' ACL role assignments (data, not in the export), credentials, plug-in settings, shared component types beyond those above, translations, page JavaScript and CSS, plug-ins, and the APEXlang (.apx) and YAML exports.

From Oracle to pgkiln ​

(Sprint 192.) An APEX export has the pages, not the database: its tables, views, sequences, packages and data stay in Oracle. ora2pg moves them to PostgreSQL; pgkiln checks the result against the application and imports it on top. The recipe below is what scripts/oracle-e2e.sh runs (manually, and weekly in .github/workflows/oracle-e2e.yml) with Oracle Database Free, ora2pg 25.0 and APEX's sample application Demonstration - HR (test/fixtures/apex/f77536.sql, its OEHR tables in test/fixtures/apex/oehr-oracle.sql): afterwards every OEHR page shows the rows that were in Oracle.

1. ora2pg: the schema. An ora2pg.conf with the Oracle connection, the schema and the PostgreSQL schema to create (ora2pg needs Perl's DBD::Oracle and the Instant Client: the Docker image georgmoser/ora2pg has both):

ORACLE_HOME        /usr/lib/oracle/19.26/client64
ORACLE_DSN         dbi:Oracle:host=oracle.example.com;service_name=ORCLPDB1;port=1521
ORACLE_USER        sales
ORACLE_PWD         …
SCHEMA             SALES           # the APEX application's parsing schema
EXPORT_SCHEMA      1               # into a PostgreSQL schema …
PG_SCHEMA          sales           # … of this name (pgkiln import-apex --schema sales)
PRESERVE_CASE      0               # the default: EMP becomes emp, as pgkiln's import expects
PACKAGE_AS_SCHEMA  1               # the default: package PKG's function F becomes pkg.f (0: pkg_f)
FILE_PER_FKEYS     1               # foreign keys in a file of their own, loaded after the data
FORCE_OWNER        pgkiln          # the PostgreSQL role that owns what is created
PG_DSN             dbi:Pg:dbname=pgkiln;host=localhost;port=5432   # for COPY straight into PostgreSQL
PG_USER            pgkiln
PG_PWD             …
sh
for t in TABLE SEQUENCE VIEW; do ora2pg -c ora2pg.conf -t $t -o ${t,,}.sql && psql -f ${t,,}.sql; done
ora2pg -c ora2pg.conf -t COPY            # the data, straight into PostgreSQL (PG_DSN)
psql -f FKEYS_table.sql                  # then the foreign keys
ora2pg -c ora2pg.conf -t PACKAGE -o package.sql   # also PROCEDURE, FUNCTION, TRIGGER: a first pass, to review

The data export reads v$database: the Oracle user needs grant select on v_$database. Use COPY rather than INSERT for the data: ora2pg 25.0's INSERT export writes INTERVAL values without quotes. NUMBER columns become smallint, integer, bigint or numeric by their precision (PG_INTEGER_TYPE, DEFAULT_NUMERIC); DATE becomes timestamp(0). Converted PL/SQL is a first pass: read it before you run it.

2. pgkiln import-apex --check. Before the import, with the database ora2pg filled:

sh
pgkiln import-apex f100.sql --check --schema sales

prints the import report and then every database object the application uses that the schema doesn't have: tables and views (region sources, table-based regions, forms, grids, lists of values, chart series, cards, calendars, DML in PL/SQL), columns where the importer knows them (form items, grid columns, lists of values on a table, chart, card, calendar and facet columns of a query on one table), sequences (seq.nextval) and PL/SQL routines (Invoke API processes, pkg.proc(…) calls). Oracle's upper-case names are looked up in lower case. It only reads the catalogue (pg_catalog): nothing of the export runs. It imports nothing and exits with 1 when something is missing (0 when nothing is), so a migration script can stop there; --json gives the report with check.missing. APEX views (apex_applications, apex_collections …) are listed apart: ora2pg doesn't move them. (sprint 217) Those pgkiln has in schema apex (chapter 9: the activity log, access control, feedback, automations, pages, build options …) are not missing: the importer qualifies them. Rebuild what uses the others (apex_collections, apex_workspace_apex_users …) on your own tables or pgkiln's.

A PL/SQL routine the application calls that already exists in PostgreSQL is named with the function found: package SALES_PKG's RECALCULATE as sales_pkg.recalculate (PACKAGE_AS_SCHEMA 1) or as sales.sales_pkg_recalculate (PACKAGE_AS_SCHEMA 0), with its arguments, so the hand work is to check ora2pg's conversion, not to write it.

The builder's Import → From Oracle APEX shows the same check as Database objects above the report, for the schema in the form (with the workspace's developer login). The import itself (command line and builder) checks too: a component whose objects are missing gets a note "missing in PostgreSQL: …", and its Team Development issue lists them.

3. The import, with the schema ora2pg filled; the application's role gets the rights on it (sprint 186):

sh
pgkiln import-apex f100.sql --schema sales --alias sales

4. Afterwards: open the Advisor (or pgkiln advise sales): it runs every query of the application as its role and lists what fails, among them the PL/SQL left to port and the APEX views. Work through the Team Development issues labelled APEX import, and run pgkiln import-apex --check again after each ora2pg run.

What the recipe gives (sprint 209: scripts/oracle-e2e.sh locally and the workflow on GitHub, Oracle Database Free 23 and ora2pg 25.0). ora2pg moves the 12 OEHR tables, their sequence and view, the rows and the foreign keys; --check then finds no table, column, sequence or routine of the application missing, only APEX's views (used by the administration pages). After the import all 44 imported pages open as a user, and the OEHR pages show Oracle's rows:

PageShows
2 Dashboardfour charts: order modes, product status, orders per sales rep and per customer
3 Customersthe customers in a faceted interactive report
5 Order Search, 7 Orders Calendarthe orders as cards, and on a calendar
6 Ordersthe orders and the order items in two interactive grids
8 Employeesthe employees in a faceted report
10, 12, 14, 16, 18, 20regions, countries, warehouses, products, jobs and departments in interactive reports, with APEX's column headings, hidden key columns, the edit link to the form page and the default report's sort
4, 9, 11, 13, 15, 17, 19, 21the form pages, empty for a new row or filled from the edit link

The pages left with an error are APEX's own administration pages (access control, activity, feedback, theme styles, settings). (sprint 217) They read APEX's views, which pgkiln now has in schema apex (chapter 9): 12 of the 23 show their data (Appearance, Page Performance, Page Views, Automations Log and its messages, Manage User Access, Add Multiple Users, Manage Feedback, About, Help). The other 11 still need hand work: apex_collections (pgkiln has no collections), apex_util and owa_util calls, connect by and Oracle's implicit conversions (a number compared with text); rebuild them with pgkiln's own (Activity, Access control, Feedback) or leave them out.

Users per application ​

How APEX does it. An APEX instance has workspaces. Workspace users come in four kinds: end users, developers, workspace administrators and instance administrators. With the Oracle APEX Accounts authentication scheme, an application signs users in against the workspace's accounts, so every application in a workspace shares the same set of users. You can restrict access per application in two ways:

  • Application Access Control (a shared component) defines roles such as Reader, Contributor and Administrator per application and assigns users to them. It generates authorization schemes and can require that a user has a role to use the application at all.
  • Authorization schemes on pages and components.

Many organisations don't use APEX accounts at all. They choose another authentication scheme (LDAP, social sign-in / OpenID Connect, SAML, database accounts or custom PL/SQL) and map the identity provider's groups to APEX roles. Applications in the same workspace can also share a session, so signing in to one signs you in to the others.

How pgkiln does it. The same model: a user directory with one account per person (Builder → Users), and per application an Access control setting (only listed accounts, or any active account) plus role assignments per account. Roles feed authorization schemes and meta.has_role(). See chapter 8.

Instead of (or next to) passwords, applications can use single sign-on with OpenID Connect, APEX's "Social Sign-In" scheme, with identity-provider groups mapped to application roles. Signing in to a second app is then silent via the identity provider's session. See chapter 8. SAML 2.0 providers and LDAP / Active Directory passwords work the same way (groups → roles), and Keep me signed in matches APEX's persistent authentication. Unlike APEX, the user directory's accounts can have two-factor sign-in (an authenticator app), per application and per role. Database accounts sign in with PostgreSQL login roles, and custom authentication calls your own PL/pgSQL function (APEX: a custom PL/SQL scheme), see chapter 8. The login page (APEX: page 9999 with the Login region template) is a page you design in the Page Designer around a Login region, and Forgot password? is built in (APEX apps build their own), see chapter 8.

ORDS and PostgREST ​

In the Oracle world, ORDS (Oracle REST Data Services) plays two roles:

  1. The web listener for APEX itself: every APEX page request goes through ORDS's PL/SQL gateway.
  2. REST APIs: RESTful services defined in APEX/ORDS, AutoREST for tables and views, and REST-enabled SQL.

In pgkiln, role 1 doesn't exist. The pgkiln server is the web tier, talking to PostgreSQL directly. You don't need ORDS or any replacement to run applications.

For role 2, REST APIs, PostgREST is the natural choice. It turns a PostgreSQL schema into a REST API: tables and views become resources, functions become RPC endpoints, and it authenticates with JWTs whose role claim selects the database role, so grants and row level security apply, just as in pgkiln. That makes it a good partner rather than a replacement:

ORDS featurePostgreSQL option
AutoREST for tables and viewsPostgREST (automatic for an exposed schema)
Hand-written handlers (GET/POST with SQL or PL/SQL)REST modules in the builder: method, path with parameters and SQL, served by pgkiln (chapter 13); or PostgREST RPC: create function api.do_something(...) → POST /rpc/do_something
OAuth2 client credentials (oauth.create_client, /oauth/token)OAuth clients: meta.oauth_create_client() or Builder → REST API → OAuth clients, and POST /oauth/token on pgkiln (chapter 13). Or tokens from your identity provider
REST-enabled SQLNot provided by PostgREST (and rarely desirable)
OpenAPI/SwaggerGenerated for every REST module (…/openapi.json) and built into PostgREST

pgkiln integrates with it: meta.app_user() and meta.has_role() understand PostgREST's JWT claims, so one set of RLS policies protects the UI and the API, and each app has an API role, tokens and an endpoint overview under Builder → REST API. The recommended setup is a dedicated api schema with views and functions (not your base tables). See chapter 13.

Porting PL/SQL to PL/pgSQL ​

PL/SQLPL/pgSQL
create or replace procedure p (a in number) is begin … end;create or replace procedure p(a numeric) language plpgsql as $$ begin … end $$;
functions returning valuescreate function f(...) returns numeric language plpgsql as $$ … $$;
varchar2, number, date (with time)text, numeric / int, timestamp (or date for dates only)
nvl(a, b), decode(…)coalesce(a, b), case … end
sysdate, systimestampnow(), current_date
raise_application_error(-20001, 'msg')raise exception 'msg'; (add using column = 'col' to target a field)
sql%rowcount, %notfoundget diagnostics n = row_count;, if not found then
select … into v from dualselect … into v; (no dual)
sequences seq.nextvalnextval('seq'), or generated always as identity columns
packagesschemas + functions (package state → tables or session settings)
autonomous transactionsnot supported; use a separate connection or dblink if you really need it
v('APP_USER'), :APP_USERmeta.app_user(), :APP_USER
empty string is NULLPostgres distinguishes them, but pgkiln stores empty items as NULL, as APEX does
'a' || null is 'a''a' || null is NULL: use concat(a, b) or concat_ws(sep, …), which skip NULLs, or coalesce(b, '')

Tips:

  • Cast bind variables where Postgres can't infer the type: :P1_ID::int, :P1_DATE::date.
  • Use returning to get generated keys: insert … returning id inside a function, or return a column named like the item (as p3_id) from a process.
  • Triggers are create trigger … execute function f(), with new/old records like Oracle's :new/:old.
  • Row level security replaces most VPD policies, with simpler syntax.

Things that behave differently ​

  • No PL/SQL in the page: logic runs as SQL. Put anything procedural in a PL/pgSQL function and call it.
  • Everything is one transaction per submit: validations and all processes commit or roll back together.
  • Errors are hidden by default: unexpected errors show a reference number unless the app is in debug mode.
  • Hidden items aren't in the page: a hidden item is value protected and its value stays on the server (APEX renders it with a checksum). For APEX's Value Protected = No, give it {"value_protected": false}: a hidden input that dynamic actions and JavaScript set (Hidden items).
  • Dates: date items, date ranges, grid date cells and facet ranges are text in the application's date format (else ISO, 2026-10-01) with pgkiln's date picker; format masks apply to report, grid and cards columns and to number and display items (number formats).
  • Modal pages open over the calling page, and close and refresh it after a successful submit, like an APEX "Close Dialog" process plus "Dialog Closed" refresh.

Released under the Apache-2.0 license. Not affiliated with Oracle; Oracle and APEX are trademarks of Oracle.