Is it possible to build up sql dynamically and somehow execute/open a cursor based on this dynamic sql in such a way so as to return the resultset successfully to Crystal report. I've attached my procedure and when I try to call this from crystal I get error message 0ra-01001

many thanks

AS

v_cursorid INTEGER;
v_selectStmt Varchar2(32767);
v_whereclause Varchar2(32767);
v_Dummy INTEGER;

BEGIN

v_selectStmt := 'SELECT FUNDCODE
,FUNDCLASS
,SETTLEMENTDATE
,sum(NETAMOUNT)
FROM IFASTTRANSACTION
WHERE env = PprmEnv
and tradedate = PprmStartDate';

if SPprmFund is not null then
v_selectStmt := v_selectStmt || ' and FUNDCODE = PprmFund ';
end if;

v_selectStmt := v_selectStmt || ' GROUP BY FUNDCODE
,FUNDCLASS
,SETTLEMENTDATE';
v_cursorid := dbms_sql.open_cursor;

dbms_sql.parse(v_cursorid,v_selectStmt,dbms_sql.v7 );

--bind the variables within the dynamic SQL
dbms_sql.bind_variable(v_cursorid,'PprmStartDate',SPprmStartDate);
dbms_sql.bind_variable(v_cursorid,'PprmEnv',SPprmEnv);

if SPprmFund is not null then
dbms_sql.bind_variable(v_cursorid,'PprmFund',SPprmFund);
end if;

v_Dummy := dbms_sql.execute(v_cursorid); --execute