Alexander Danmayer
Member
We have a problem concerning the usage of dynamically created cursors within a package.
Within the package we parse a dynamic SQL Cursor, the function looks like this
function GetDynCursor(SelectStr in varchar2, DynaCursor in out number) return number
is
begin
DynaCursor:= dbms_sql.open_cursor; -- opening and creating Cursor
DBMS_SQL.PARSE(DynaCursor, SelectStr ,DBMS_SQL.NATIVE); -- Parsing dynamic select string
return 1; -- Means ok
exception
when others then
dbms_output.put_line(sqlcode);
dbms_output.put_line(sqlerrm);
return -3; -- Error occured
end;
This works fine if we use it within PL/SQL and the DBMS_SQL.FETCH_ROWS (Cursor) function.
I want to know, if it is possible to transfer this Cursor-Pointer to the component TOracleDataSet in order to retrieve the rows.
Maybe there also another solution. The goal is to create a dynamic cursor within a PL/SQL-Package and then give this cursor to the TOracleDataSet component and show it in a DBGrid.
Within the package we parse a dynamic SQL Cursor, the function looks like this
function GetDynCursor(SelectStr in varchar2, DynaCursor in out number) return number
is
begin
DynaCursor:= dbms_sql.open_cursor; -- opening and creating Cursor
DBMS_SQL.PARSE(DynaCursor, SelectStr ,DBMS_SQL.NATIVE); -- Parsing dynamic select string
return 1; -- Means ok
exception
when others then
dbms_output.put_line(sqlcode);
dbms_output.put_line(sqlerrm);
return -3; -- Error occured
end;
This works fine if we use it within PL/SQL and the DBMS_SQL.FETCH_ROWS (Cursor) function.
I want to know, if it is possible to transfer this Cursor-Pointer to the component TOracleDataSet in order to retrieve the rows.
Maybe there also another solution. The goal is to create a dynamic cursor within a PL/SQL-Package and then give this cursor to the TOracleDataSet component and show it in a DBGrid.