HighTechTalks DotNet Forums  

Re: Oracle stored procedure - with more than one row?

Dotnet Framework (ODBC.net) microsoft.public.dotnet.framework.odbcnet


Discuss Re: Oracle stored procedure - with more than one row? in the Dotnet Framework (ODBC.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Wayne Barr
 
Posts: n/a

Default Re: Oracle stored procedure - with more than one row? - 10-01-2003 , 06:05 PM






A cursor variable points to the current row in the result set of a
multi-row query. Cursor variables are dynamic because they are not tied
to a specific query. You can open a cursor variable for any
type-compatible query. This gives you more flexibility.

To create cursor variables, you take two steps. First, you define a REF
CURSOR type, then declare cursor variables of that type. You can define
REF CURSOR types in any PL/SQL block, subprogram, or package using the
syntax

TYPE ref_type_name IS REF CURSOR [RETURN return_type];

Once you define a REF CURSOR type, you can declare cursor variables of
that type in any PL/SQL block or subprogram. In the following example,
you declare the cursor variable pcur:

CREATE OR REPLACE PACKAGE EmpUtils AS
TYPE empcur IS REF CURSOR;

PROCEDURE GetEmpRecords(
indept IN NUMBER,
perr OUT NUMBER,
pcur OUT empcur);

END EmpUtils;
/

CREATE OR REPLACE PACKAGE BODY EmpUtils AS

PROCEDURE GetEmpRecords(
indept IN NUMBER,
perr OUT NUMBER,
pcur OUT empcur) IS

BEGIN
perr := 0;
OPEN pcur FOR
SELECT * FROM emp
WHERE deptno = indept
ORDER BY empno;

EXCEPTION
WHEN OTHERS THEN
perr:= SQLCODE;

END GetEmpRecords;
END EmpUtils;
/

essentially within your code you can then create an DataAdaptor and call
the fill method passing in a dataset.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.