Oracle Stored Procedures

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Back about 3 years ago when I took an Oracle class, I recall that when I created an used a stored procedure in Oracle, that I was taught to create a column in my output which contained the "return" code which I would manually populated in the procedure. Then I would loop through reading those records and checking the return code.

That was before the .Net Environment.

My question is that can I create a stored procedure and associate it with a DataAdapter and it will take care of reading till the end of file? I no longer need to create a "return" code to identify when I am at the end of file?

Thanks in advance for your assistance!!!!!!
 
To simply output a Result set, you will create a REF_CURSOR (at least in
Oracle 9i+). The basics are this:

CREATE OR REPLACE PROCEDURE MyProc
(
MyCursor OUT Types%cursor_type
)
AS
BEGIN
OPEN MyCursor AS
SELECT * FROM MyTable;
END;
/

You can still use an out param, as a return value, if that makes sense.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
Jim Heavey said:
Back about 3 years ago when I took an Oracle class, I recall that when I
created an used a stored procedure in Oracle, that I was taught to create a
column in my output which contained the "return" code which I would manually
populated in the procedure. Then I would loop through reading those records
and checking the return code.
That was before the .Net Environment.

My question is that can I create a stored procedure and associate it with
a DataAdapter and it will take care of reading till the end of file? I no
longer need to create a "return" code to identify when I am at the end of
file?
 
Back
Top