View Full Version : Procedure, package and ref cursors question
sahcutie
10-17-2005, 01:00 PM
Is it possible to have a procedure that returns a ref cursor without
the the procedure being in a package? If it is, how should it be
passed in the parameters and also be declared?
DA Morgan
10-17-2005, 04:17 PM
sahcutie wrote: Is it possible to have a procedure that returns a ref cursor without the the procedure being in a package? If it is, how should it be passed in the parameters and also be declared?
Yes. A procedure or function being in a package is irrelevant to the
parameters it can accept and/or return.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
sahcutie
10-18-2005, 06:00 AM
So in the procedure below, what is wrong with the ref cursor or how do
I get the cursor to be an out cursor?
PROCEDURE "WEBSERVICE".VENDORIDANDADDINFO
(
"LASTNAME" IN VARCHAR2, VendorCursor OUT REF CURSOR) IS
TYPE ref_info IS REF CURSOR RETURN VendorRecord;
C_Vendor ref_info;
TYPE vend_rec IS RECORD
(
VenNum VARCHAR2(10),
VenAdd1 VARCHAR2(35),
VenAdd2 VARCHAR2(35),
VenCity VARCHAR2(30),
VenState VARCHAR2(6),
VenPostal VARCHAR2(12),
VenCountry VARCHAR2(3)
);
VendorRecord vend_rec;
BEGIN -- executable part starts here
OPEN C_Vendor FOR select a.VENDOR_ID, c.ADDRESS1, c.ADDRESS2,
DA Morgan
10-18-2005, 08:07 AM
sahcutie wrote: So in the procedure below, what is wrong with the ref cursor or how do I get the cursor to be an out cursor? PROCEDURE "WEBSERVICE".VENDORIDANDADDINFO ( "LASTNAME" IN VARCHAR2, VendorCursor OUT REF CURSOR) IS TYPE ref_info IS REF CURSOR RETURN VendorRecord; C_Vendor ref_info; TYPE vend_rec IS RECORD ( VenNum VARCHAR2(10), VenAdd1 VARCHAR2(35), VenAdd2 VARCHAR2(35), VenCity VARCHAR2(30), VenState VARCHAR2(6), VenPostal VARCHAR2(12), VenCountry VARCHAR2(3) ); VendorRecord vend_rec; BEGIN -- executable part starts here OPEN C_Vendor FOR select a.VENDOR_ID, c.ADDRESS1, c.ADDRESS2,
You have an OUT parameter that is undeclared as you define the REF
CURSOR in the procedure itself.
Either define the REF CURSOR in a package header or use SYS_REFCURSOR:
The weakly typed built-in.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
sahcutie
10-18-2005, 09:46 AM
Which would be the better way to do this? Define the ref cursor in a
package header or do a weakly typed ref cursor?
DA Morgan
10-18-2005, 10:54 AM
sahcutie wrote: Which would be the better way to do this? Define the ref cursor in a package header or do a weakly typed ref cursor?
Define it in a package header.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
sahcutie
10-18-2005, 12:14 PM
Thanks, I have my package set up and I am trying to get it tested. How
can I test to make sure that it is returning the correct information?
The reason I ask is that I am trying to run this using odp.net for a
new web service that I am writing. The client is 8.1 (hope this makes
sense.) I would like to get back a dataset that we can use on various
platforms.
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.