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
DBMS_OUTPUT.GET_LINE(firstArg, secondArg)
Obtained values are received with variables specified for arguments.
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.
Convert using the following procedure:
Locate the places where the keyword "DBMS_OUTPUT.GET_LINE" is used in the stored procedure.
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.