Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Stored Procedure/Function Question

Stored Procedure/Function Question

From: Bill Cohagan <bill_at_XNOSPAMXteraquest.com>
Date: Tue, 30 Nov 1999 12:53:02 -0600
Message-ID: <o9V04.231$Ld.58908@newsin1.ispchannel.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US