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 -> Re: Calling a stored procedure from an insert statement

Re: Calling a stored procedure from an insert statement

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sun, 26 Mar 2006 07:24:20 +0200
Message-ID: <o69c225m47rl46d37d8ka6a7qfkqov9713@4ax.com>


On 25 Mar 2006 19:56:40 -0800, "bmaxed" <brodellis_at_gmail.com> wrote:

>Can someone provide guidance on how I can call a stored procedure from
>a sql statement. We have a procedure which generates sequence numbers.
> I want to call this procedure to generate a value for an insert
>statement.
>
>Any help is greatly appreciated.

First of all: avoid using your own sequence number mechanism at all costs. It will *always* be less efficient than using Oracle sequences. Secondly: observing the difference between a procedure and a function (but you are probably from a Microsoft T-SQL background so you don't know the difference), you don't need a *procedure* but you need a *function*.
The function should be designed with the pragma autonomous_transaction attribute, and include a COMMIT.

--
Sybrand Bakker, Senior Oracle DBA
Received on Sat Mar 25 2006 - 23:24:20 CST

Original text of this message

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