18.3.1 Managing Duality Views

Create Duality View objects to retrieve data sourced from a Duality View in a local or a remote database. Duality Views are only available in Oracle Database 23ai or later.

18.3.1.1 About Duality Views

Learn about Duality Views in Oracle APEX.

Note:

Duality Views are only available in Oracle Database 23ai or later.

Duality views combine the advantages of using JSON documents with those of the relational model, while avoiding the limitations of each.

Tip:

To learn more about JSON-Relational Duality Views, see Overview of JSON-Relational Duality Views in JSON-Relational Duality Developer's Guide.

In Oracle APEX, a Duality View Source consists of information about the owner and name of the Duality View object in the Oracle Database and a Data Profile.

The Data Profile maps JSON attributes to columns with data types which APEX components can consume. You can define a duality view using the a local database or using REST Enabled SQL reference. After selecting a duality view, Oracle APEX rerieves a JSON schema from the database and builds a data profile.

Once created, the Duality View is available to page components, such as reports, charts, forms, and so on, and shared components, such as list of values and automations. Developers can also use the APEX_EXEC package to access the Duality View programmatically.

See Also:

APEX_EXEC in Oracle APEX API Reference

18.3.1.2 Creating a Duality View Source

Create a Duality View Source from Shared Components.

Duality Views require Oracle Database Duality Views require Oracle Database 23ai or later. This topic also assumes you have created a Duality View and an application.

To create a Duality Views Source:

  1. Navigate to the Duality Views page:
    1. On the Workspace home page, click App Builder.
    2. Select an application.
    3. On the Application home page, click Shared Components in the center of the page.
    4. Under Data Sources, select Duality Views.
  2. On the Duality Views page, click Create.
  3. On General, specify:
    1. Name - Enter a name for the new Duality View.
    2. Location - Specify whether data is to be sourced, that is from a Local Database or from a REST Enabled SQL Service. This example assumes you are using a local database.
    3. Owner - Select the owner of the Table or View.
    4. Duality View - Select a duality view to use.
    5. Click Next.

    Oracle APEX displays a Data Profile for the new duality view.

  4. Data Profile - Toggle the checkboxes in the Primary Key column to denote columns which identify rows.
  5. Click Create.

    The following message appears:

    Duality View created.

    The duality view appears on the Duality Views page.

18.3.1.3 Editing and Deleting a Duality View Source

Edit or delete a Duality View Source on the Edit Duality page.

To edit or delete a Duality Views Source:

  1. Navigate to the Duality Views page:
    1. On the Workspace home page, click App Builder.
    2. Select an application.
    3. On the Application home page, click Shared Components in the center of the page.
    4. Under Data Sources, select Duality Views.
  2. On the Duality Views page, click the duality view Name.

    The Edit Duality View page appears. Use this page to edit the Duality View Source or delete it.

  3. To delete the Duality View, click Delete. When prompted, confirm your request and click Delete again.
  4. Under Identification:
    1. Name - Enter a name for the new Duality View.
    2. Static ID - Enter a Static ID of the Duality View. The static ID is used to programmatically access the Duality View in PL/SQL code.
  5. Under Source:
    1. Location - Specify whether the data is sourced from a Local Database or from a REST Enabled SQL Service.
    2. Owner - Select the owner of the Table or View.
    3. Duality View - Select the Duality View to use.
  6. Under Data Profile:
    1. Click Edit Data Profile to change how the Data Source format is being parsed and converted to rows and columns.
    2. Under Settings:
      • Name - Enter a name for the data profile.
      • Format - Choose the data format.
      • Row Selector - For a data profile returning a table, enter the expression to select the collection of rows within the Data Source.

        To learn more and view examples, see item Help.

    3. Under Columns - Determines how one row is parsed and converted to multiple columns. Use the Edit icon or the available buttons to edit or add the columns.
    4. Rediscovery:
      • Click Rediscover Data Profile to refresh the Data Profile.
      • JSON Schema - Provide a JSON Schema file fromwhich to generate the Data Profile. If no JSON Schema is provided, Oracle APEX generates the data profile by sampling existing data in the table. To learn more, see item Help.
    5. Under Advanced:
      • Use Raw Selectors - If enabled, Oracle APEX will not sanitize row and column selectors when generating the SQL query for JSON parsing. All selectors will be used exactly as specified.
      • Profile Comment - Enter any developer comments or notes.
    6. Click Apply Changes to save your changes.
  7. Advanced - In Comments, enter any developer comments or notes.
  8. Click Apply Changes to save your changes.

18.3.1.4 Copying or Subscribing to a Duality View

Copy a Duality View from the current application or from another application. When copying a Duality View from another application, you can also subscribe to it.

To copy a Duality View:

  1. Navigate to the Duality Views page:
    1. On the Workspace home page, click App Builder.
    2. Select an application.
    3. On the Application home page, click Shared Components in the center of the page.
    4. Under Data Sources, select Duality Views.
  2. On the Duality Views page, click Copy.
  3. Copy From - Choose where to copy the Duality View from. Options include:
    • This Application
    • Other Application
  4. To copy from the current application:
    1. Copy From - Select This Application.
    2. Copy Duality View - Select the Duality View to copy.
    3. New Duality View Name - Enter the name of the Duality View you would like to create..
    4. Click Copy.
  5. To copy from another application:
    1. Copy From - Select Other Application.
    2. Application - Select the application from which you want to copy.
    3. Copy Duality View - Select the Duality View to copy.
    4. Subscribe - Enable Subscribe to subscribe to the Duality View.
    5. New Duality View Name - Enter the name of the Duality View you would like to create..
    6. Click Copy.

18.3.1.5 Viewing Duality Views Utilization

View the Duality Views Utilization report.

To view Duality Views Utilization report:

  1. Navigate to the Duality Views page:
    1. On the Workspace home page, click App Builder.
    2. Select an application.
    3. On the Application home page, click Shared Components in the center of the page.
    4. Under Data Sources, select Duality Views.
  2. On the Duality Views page, click Utilization.
    The Utilization page displays where a Duality Views are used within the current application.

18.3.1.6 Viewing Duality Views History

View the Duality Views History report.

To view Duality Views History report:

  1. Navigate to the Duality Views page:
    1. On the Workspace home page, click App Builder.
    2. Select an application.
    3. On the Application home page, click Shared Components in the center of the page.
    4. Under Data Sources, select Duality Views.
  2. On the Duality Views page, click History.
    The History page displays recent modifications made to Duality Views in the current application.