Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Stored Procedure/Function Question
I'm using Oracle 8.0.4 PE and am new to Oracle with past experience with MS
Access & SQL7. I'm trying to create the equivalent of an Access
"parameterized query" -- which in SQL7 is done simply with a Stored
Procedure. The query returns (possibly) multiple rows.
Oracle doesn't seem to like this formulation however; e.g.,
CREATE PROCEDURE foo (arg1 IN Int, arg2 IN Int) IS
BEGIN
SELECT tblFoo.* WHERE (tblFoo.field1 = arg1) AND (tblFoo.field2 = arg2);
END;
[This is how it's done in SQL7 except for minor syntactic differences.] With
Oracle this produces a message indicating compilation errors, although SHOW
ERRORS then says there are none (even when I explicitly ask for errors on
this procedure.)
Since Oracle supports FUNCTION I'm guessing that FUNCTION is probably what I need to use rather than PROCEDURE. Of course what's not clear is exactly WHAT I should return in the function as a value. Is a CURSOR the right thing? Is there a better way to do this in general in Oracle?
Thanks in advance,
Bill
Received on Tue Nov 30 1999 - 12:53:02 CST