Previous
Previous
 
Next
Next


PRINT_LOV_AS_JSON Procedure

This procedure outputs a JSON response based on the result of a two column LOV in the format:

[{"d:"display","r":"return"},{"d":....,"r":....},....]

Note:

The HTTP header is initialized with MIME type "application/json" as well.

Syntax

APEX_PLUGIN_UTIL.PRINT_LOV_AS_JSON (
    p_sql_statement       IN VARCHAR2,
    p_component_name      IN VARCHAR2,
    p_escape              IN BOOLEAN);

Parameters

Table: PRINT_LOV_AS_JSON Parameters describes the parameters available in the PRINT_LOV_AS_JSON procedure.

PRINT_LOV_AS_JSON Parameters

Parameter Description

p_sql_statement

A SQL statement which returns two columns from the SELECT.

p_component_name

The name of the page item or report column that is used in case an error is displayed.

p_escape

If set to TRUE the value of the display column will be escaped, otherwise it will be output as is.


Example

This example shows how to use the procedure in an AJAX callback function of an item type plug-in. The following call writes the LOV result as a JSON array to the HTTP output.

apex_plugin_util.print_lov_as_json (
    p_sql_statement  => p_item.lov_definition,
    p_component_name => p_item.name,
    p_escape         => true );