In Crystal reports, how can you pass in a ref cursor parameter? I don't know Crystal Reports, but in PL/SQL it would be thus to call your procedure as is:
Main Topics
Browse All TopicsI am trying to build a stored procedure where the output will become the datasource for Crystal Reports. I was trying to follow guidance provided in the article "Using Ref Cursors To Return Recordsets" http://www.oracle-base.com
Per the instructions I skipped step one (create the package) since I am using Oracle 10gR2. I used sys_refcursor, which is supposedly already defined.
I get a clean compile, but when I try to call the procedure (through TOAD) I get the error "ORA-06553: PLS-306: wrong number or types of arguments in call to 'RPT730'". I don't know if it makes a difference, but testapp730 in the FROM-clause is a view, not a table.
Any suggestions would be appreciate.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The cursor is not an input, it is the output of the procedure that gets passed to Crystal. It is the
datasource that Crystal will use to generate the report. That's why I'm not sure how to pass anything for that variable to the procedure.
I don't think that Crystal will accept a function as a datasource. It will accept a stored procedure.
I get data back if I execute the function in sqlplus. That helps a little since I can use the same basic code between the begin-end, although I have to change the variable section some. Also, I can't use the function as a datasource to Crystal Reports, so I still have to be able to test the stored procedure.
Thanks for you help. You did explain what I needed to do with the OUT variable of sys_refcursor!!!
Business Accounts
Answer for Membership
by: mrjoltcolaPosted on 2009-07-27 at 11:51:37ID: 24954657
>>CALL TESTAPP.RPT730('fyap', '2009', '10', '', '', 0);
There is no ref cursor passed into your procedure. The procedure expects its last argument to have one.
I prefer to return ref cursors from a function like so:
CREATE OR REPLACE FUNCTION getall RETURN SYS_REFCURSOR
IS
result SYS_REFCURSOR;
BEGIN
open result for select * from t;
return result;
END;
/
That way you can either use it in a SQL statement:
select getall from dual;
Or use it in a PL/SQL block as the target of an assign. It is more clear to me that way.
c1 := getall();