Link to home
Start Free TrialLog in
Avatar of dblerner
dblerner

asked on

Crystal Reports with Oracle PL/SQL Command Source

I am attempting to get  Crystal Reports to use an Oracle stored procedure as the command source. I have followed the instruction to use a PL/SQL package to set up a Ref Cursor type
and have populated a table with data. When I execute an anonymous block in SQL Developer, it executes successfully and retrieves the data in the table. However, when I place the anonymous block as the command source in Crystal Reports, I get a ORA-0922 error.

Here is the anonymous block:

SET SERVEROUTPUT ON
DECLARE
  CensusRollup_Cursor CensusRollup.CensusRollup_Type;
  resultset CensusRollup_Cursor%rowtype;
BEGIN
  PC_CensusRU_Excel_Test (CensusRollup_Cursor);
  Fetch CensusRollup_Cursor into resultset;
  While CensusRollup_Cursor%found Loop
    DBMS_OUTPUT.Put_Line(resultset.DummyColumn);
    Fetch CensusRollup_Cursor into resultset;
  End Loop;
END;

Do I need to access some settings in Crystal Report for this to work?

I am using an Oracle 10g database, Crystal Reports 12, and a JDBC connection to access the database.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dblerner
dblerner

ASKER

Thank you for the instructions. I was trying to paste the anonymous block in the command source field. Instead, Crystal Reports lets you choose which stored procedure to use as the command source.