I have created a PL/SQL procedure like here: https://dba.stackexchange.com/questions/45016/dynamic-oracle-pivot-in-clause
Now I want to use the procedure as the Source for a Report. I am using Oracle Apex 4.0.
When I write it like this:
Declare
x refcursor;
begin
dynamic_pivot(x);
end;
The following error occurs:
ORA-20001: Query must begin with SELECT or WITH
However, it is possible to use a Procedure as the source as described here: Calling procedure in oracle apex
dynamic_pivot
into a function that returns a VARCHAR2, not a ref cursor. – Jeffrey Kemp