I am not experienced with db but I am trying to get the column names from the result of a stored procedure.
The code must be generic because the stored procedure is not known.
The first step is to make it work for procedures with no input parametes (only the io_cursor)
My code until now:
procedure fakeProc (
io_cursor in out t_ref_cursor
)
And the code that I am using:
PROCEDURE get_SQL_Fields (
out_result out varchar2)
as
/**/
v_cur NUMBER := NULL;
v_count NUMBER := NULL;
v_tab_desc DBMS_SQL.DESC_TAB;
sqlstr VARCHAR2(100);
BEGIN
v_cur := DBMS_SQL.OPEN_CURSOR;
--Here i get errors
sqlstr :='begin '|| fakeproc()||';end;';
DBMS_SQL.PARSE(v_cur, sqlstr, DBMS_SQL.NATIVE);
DBMS_SQL.DESCRIBE_COLUMNS(v_cur, v_count, v_tab_desc);
FOR i IN 1..v_count LOOP
out_result := out_result||v_tab_desc(i).COL_NAME||',';
END LOOP;
end if;
END get_SQL_Fields;
So my problem for now is to build this sqlstr ;
THe error that I get is :Error: PLS-00306: wrong number or types of arguments in call to 'FAKEPROC'
Line: 654
Text: sqlstr :='begin '|| fakeproc()||';end;';
Error: PL/SQL: Statement ignored Line: 654 Text: sqlstr :='begin '|| fakeproc()||';end;';