Top
Symfoware Server V12.1.0 Application Development Guide
FUJITSU Software

B.5.3 Receiving a Return Value from a Procedure (PL/SQL) Block (For GET_LINE)

Oracle database

set serveroutput on;

DECLARE
    v_buff1       VARCHAR2(100);
    v_buff2       VARCHAR2(1000);
    v_num        INTEGER;
BEGIN

    v_buff2 := '';
    LOOP
        DBMS_OUTPUT.GET_LINE(v_buff1, v_num); ...(6)
        EXIT WHEN v_num = 1;
        v_buff2 := v_buff2 || v_buff1;
    END LOOP;

    DBMS_OUTPUT.PUT_LINE(v_buff2);
END;
/

* Only the process to obtain a value is stated

Symfoware Server

DO $$
DECLARE
    v_buff1       VARCHAR(100);
    v_buff2       VARCHAR(1000);
    v_num        INTEGER;
BEGIN
    PERFORM DBMS_OUTPUT.SERVEROUTPUT(TRUE);
    v_buff2 := '';
    LOOP
        SELECT line, status INTO v_buff1, v_num FROM DBMS_OUTPUT.GET_LINE(); ...(6)
        EXIT WHEN v_num = 1;
        v_buff2 := v_buff2 || v_buff1;
    END LOOP;

    PERFORM DBMS_OUTPUT.PUT_LINE(v_buff2);
END;
$$
;

* Only the process to obtain a value is stated


(6) GET_LINE
Specification format for Oracle database

DBMS_OUTPUT.GET_LINE(firstArg, secondArg)

Specification differences
Oracle database

Obtained values are received with variables specified for arguments.

Symfoware Server

Since obtained values are the search results for DBMS_OUTPUT.GET_LINES, they are received with variables specified for the INTO clause of the SELECT statement.

Conversion procedure

Convert using the following procedure:

  1. Locate the places where the keyword "DBMS_OUTPUT.GET_LINE" is used in the stored procedure.

  2. Replace the DBMS_OUTPUT.GET_LINE location called with a SELECT INTO statement.

    • Use the literal "line, status" in the select list.

    • Specify firstArg (v_buff1 in the example) and secondArg (v_num in the example) configured in DBMS_OUTPUT.GET_LINE, in the INTO clause.

    • Use DBMS_OUTPUT.GET_LINE in the FROM clause. Although arguments are not specified, parenthesis must be specified.