Oracle PL/SQL: SYS_RefCursor to JSON

The procedure below receives a SYS_RefCursor as a parameter and constructs a simple JSON in Oracle 11g:    procedure get_json_fnc(P_RS_i Sys_Refcursor) is         P_RS SYS_REFCURSOR;        L_COLS NUMBER;        L_DESC DBMS_SQL.DESC_TAB;        L_CURS INTEGER;       …

Continue ReadingOracle PL/SQL: SYS_RefCursor to JSON

Oracle PL/SQL: Autonomous Transaction for logging

Here is an example how to use autonomous_transaction for logging purposes.In case of rollback only the main transaction is affected.declare    l_categories_count      varchar2(100);    process_error            Exception;        procedure log(p_message varchar2) is        …

Continue ReadingOracle PL/SQL: Autonomous Transaction for logging

Oracle PL/SQL: Custom Exceptions

Here is a piece of code, which shows the structure of user defined exception:declare      exc_invalid_request_id     EXCEPTION;...      IF l_accepted_request > 0      THEN         RAISE exc_invalid_request;      END IF;...   EXCEPTION      WHEN exc_invalid_request      THEN

Continue ReadingOracle PL/SQL: Custom Exceptions