I'm trying to develop a stored procedure for a Crystal reports.
Here's the stored procedure. The SP uses the following package for
the REF CURSOR.
CREATE OR REPLACE PACKAGE J1R_TYPES AS
TYPE ReturnCursorType IS REF CURSOR;
END J1R_TYPES;
CREATE OR REPLACE PROCEDURE custom_report(
STARTDATE_STR_IN IN VARCHAR2 DEFAULT '01/01/2000',
STOPDATE_STR_IN IN VARCHAR2 DEFAULT '01/01/2000',
RC1 OUT J1R_TYPES.ReturnCursorType)
AS
startdate DATE;
stopdate DATE;
startdate_str VARCHAR2(10);
stopdate_str VARCHAR2(10);
SQLtext VARCHAR2(2000);
BEGIN
startdate_str := STARTDATE_STR_IN;
stopdate_str := STOPDATE_STR_IN;
startdate := TO_DATE(startdate_str, 'mm/dd/yyyy');
stopdate := TO_DATE(stopdate_str, 'mm/dd/yyyy');
SQLtext := 'select max(query_original) as query, count(q.query_pk) as
query_count, ';
SQLtext := SQLtext || 'max(url) as url, count(url) as url_count from
query q, match m, pick p, document d ';
SQLtext := SQLtext || 'where q.query_pk = m.query_pk and m.match_pk =
p.match_pk ';
SQLtext := SQLtext || 'and p.document_pk = d.document_pk and
q.query_pk <> 0 and q.create_date >= startdate ';
SQLtext := SQLtext || 'and q.create_date <= stopdate group by
query_original, url ';
OPEN RC1 FOR SQLtext;
END custom_report;
Whenever I try to run the report in Crystal, I keep getting an invalid
column commance at the 'OPEN RC1 FOR SQLTEXT' line. Can anyone tell
me how I can run the stored procedure in SqlPlus? I executed the SQL
command and I'm sure the column names are correct. Any help is
greatly appreciated. Thanks.
Sam 1 6081 sv*****@hotmail.com (sam) wrote in message news:<ce**************************@posting.google. com>... I'm trying to develop a stored procedure for a Crystal reports. Here's the stored procedure. The SP uses the following package for the REF CURSOR.
CREATE OR REPLACE PACKAGE J1R_TYPES AS TYPE ReturnCursorType IS REF CURSOR; END J1R_TYPES;
CREATE OR REPLACE PROCEDURE custom_report( STARTDATE_STR_IN IN VARCHAR2 DEFAULT '01/01/2000', STOPDATE_STR_IN IN VARCHAR2 DEFAULT '01/01/2000', RC1 OUT J1R_TYPES.ReturnCursorType)
AS
startdate DATE; stopdate DATE; startdate_str VARCHAR2(10); stopdate_str VARCHAR2(10); SQLtext VARCHAR2(2000);
BEGIN
startdate_str := STARTDATE_STR_IN; stopdate_str := STOPDATE_STR_IN;
startdate := TO_DATE(startdate_str, 'mm/dd/yyyy'); stopdate := TO_DATE(stopdate_str, 'mm/dd/yyyy');
SQLtext := 'select max(query_original) as query, count(q.query_pk) as query_count, '; SQLtext := SQLtext || 'max(url) as url, count(url) as url_count from query q, match m, pick p, document d '; SQLtext := SQLtext || 'where q.query_pk = m.query_pk and m.match_pk = p.match_pk '; SQLtext := SQLtext || 'and p.document_pk = d.document_pk and q.query_pk <> 0 and q.create_date >= startdate '; SQLtext := SQLtext || 'and q.create_date <= stopdate group by query_original, url ';
OPEN RC1 FOR SQLtext;
END custom_report;
Whenever I try to run the report in Crystal, I keep getting an invalid column commance at the 'OPEN RC1 FOR SQLTEXT' line. Can anyone tell me how I can run the stored procedure in SqlPlus? I executed the SQL command and I'm sure the column names are correct. Any help is greatly appreciated. Thanks.
variable cur refcursor;
begin
your procedure(p1,p2, :cur);
end;
/
print :cur
Sybrand Bakker
Senior Oracle DBA
Sam This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Trosen |
last post by:
Hi Everyone,
I hope someone can help, I'm pretty new to pro*c programming.
I have the following application setup:
a pro*c program calls a stored procedure and recieves a cursor back:
the...
|
by: dinesh prasad |
last post by:
I'm trying to use a servlet to process a form, then send that data to
an SQL server stored procedure. I'm using the WebLogic 8 App. server.
I am able to retrieve database information, so I know my...
|
by: Jarrod Morrison |
last post by:
Hi all
Im relatively new to using stored procedures and im not sure if it is
possible to do what I am trying to do so any help here is greatly
appreciated. I am using the variable @MachineName...
|
by: marc |
last post by:
I've been developing a stored procedure that uses a user defined
function in the query portion of the procedure. However, since the end
product needs to allow for dynamic table names, the UDF will...
|
by: Rhino |
last post by:
I've spent the last couple of hours trying to figure out how to debug a Java
stored procedure and am just going in circles. The last straw came when I
got "Cannot open input stream for default"...
|
by: Daniel Manes |
last post by:
I've been trying to copy tables from a linked server to a SQL Server
Express database. Express seems to have no direct/automatic way to do
it, so I've been looking into doing this by hand (i.e.,...
|
by: nishi57 |
last post by:
I hope I can get some help regarding this issue, which has been going
on for a while. I have a desktop user who is having problem running
"Stored Procedures". The DB2 Connect application works fine...
|
by: SOI_0152 |
last post by:
Hi all!
Happy New Year 2008. Il hope it will bring you love and happyness
I'm new on this forum.
I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c.
Everything works...
|
by: sam |
last post by:
I'm trying to develop a stored procedure for a Crystal reports.
Here's the stored procedure. The SP uses the following package for
the REF CURSOR.
CREATE OR REPLACE PACKAGE J1R_TYPES AS
TYPE...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| | |