Here's the command to get the DDL or the procedure and make it pretty:
EXEC DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM , 'PRETTY' , TRUE);
SELECT DBMS_METADATA.GET_DDL('PROCEDURE', UPPER('LOOPPROC'), 'MYSCHEMA') FROM DUAL;
This is the output which is exactly like the input and the same as if PRETTY was set to FALSE above.
CREATE OR REPLACE EDITIONABLE PROCEDURE "MYLANID"."LOOPPROC" (inval NUMBER)
IS
tmpvar NUMBER;
tmpvar2 NUMBER;
total NUMBER;
BEGIN
tmpvar := 0;
tmpvar2 := 0;
total := 0;
FOR lcv IN 1 .. inval
LOOP
total := 2 * total + 1 - tmpvar2;
tmpvar2 := tmpvar;
tmpvar := total;
END LOOP;
IF inval = 1 THEN
DBMS_OUTPUT.put_line ('IN IF TRUE branch, inval = ' || inval);
DBMS_OUTPUT.put_line ('IN IF TRUE branch, inval is still = ' || inval);
ELSE
DBMS_OUTPUT.put_line ('IN ELSE, inval = ' || inval);
END IF;
DBMS_OUTPUT.put_line ('TOTAL IS: ' || total);
END loopproc;
Note how the IF - THE - ELSE clause is indented like the Snake River.
Is there a way to get the procedure to indent more conventionally?