Chcete použít funkci SQLERRM.
Zde je váš kód:
CREATE OR REPLACE PROCEDURE "demo"."run_demo"(v_sql IN VARCHAR2, return_code OUT number, return_message out varchar2)
AS
i number;
BEGIN
return_code := 0;
execute immediate v_sql;
i := sql%rowcount;
IF (i<1)
THEN return_code := 1;
END IF;
EXCEPTION
WHEN OTHERS THEN
return_message := SQLERRM;
return_code := SQLCODE;
END;