Solved

Stored Procedure in Crystal Reports

Posted on 2004-09-05
7
602 Views
Last Modified: 2008-02-01
Hi,

I'm trying to use stored procedure in Crystal Reports.
The stored procedure is:

create or replace procedure test (param in out varchar) is
cc varchar2(30);
begin
select name  into cc from my_content where id = 'c_101' and locale='en';
param := cc;
end;

after selecting it in CR data explorer I get error: "Error opening file. There are no fields in file: "ROZANA.Proc(Test)"."

Thanks!
0
Comment
Question by:RozanaZ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 13

Accepted Solution

by:
vidru earned 500 total points
ID: 11984694
Looks like Oracle (which I don't use).  However, this document has all the information you need on how to construct your Oracle stored procedure to work with Crystal:
http://support.businessobjects.com/communityCS/TechnicalPapers/scr_oracle_stored_procedures.pdf.asp

-dave
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 11985163
Hey vidru:)

If you're only pulling in a single value, you can just use a SQL Expression such as:

(select name from my_content where id = 'c_101' and locale='en').

If this proc is intended to return a list of values, then you'd probably be better off just using a view or pulling straight from the table.  I don't think we have the whole picture.  What are you trying to accomplish and does this proc interact with anything else?
0
 
LVL 42

Expert Comment

by:frodoman
ID: 11985765
Have you tested your SP outside of Crystal?  If this is Oracle, then you'll get an exception if there isn't exactly one record matcing your selection criteria so that could be your problem.  

frodoman
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:DarrenZai
ID: 11986855
You seem to be trying to specify the return variable rather than just using the result of the query.
I don't think CR handles this.
What the error is saying is that as far as CR is concerned there is no fields returned, no result set.
You shouldn't need to declare the result variables at the beginning, so you shouldn't need to use 'select into' in this way.
You should just be able to go

select name from my_content ...

and then the result set will contain a field called 'name'

If you want the result field to be called param then you can try

select name as param from my_content

and then the result set will contain a field called 'param'

Darren
0
 
LVL 8

Author Comment

by:RozanaZ
ID: 11987256
Hi,

Thank you for answers,
all I want to do is to check how does CR work with stored procedures,
so I need a simple stored procedure to interact with CR.

I do not understand the meaning of error message: "There are no fields in file: "ROZANA.Proc(Test)"."
What fields should I define?
0
 
LVL 3

Expert Comment

by:DarrenZai
ID: 11987279
You shouldn't need to specifically define any fields, they are usually the fields specified in your select statement.

eg

select name1, name2,name3 from my_details where id = 'c_101'

would return a record with 3 fields to CR and that should work fine.

Your SQL is selecting into another variable and I don't think CR is recognising the result from this stored proc.

Is there any particular reason why you need to select in this fashion?

Darren

0
 
LVL 8

Author Comment

by:RozanaZ
ID: 11987349
Thank you all!

Vidru, link you provided solves everything! Thank you!

0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question