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: create sequence problem !! pls help

Re: create sequence problem !! pls help

From: damorgan <damorgan_at_exesolutions.com>
Date: Sun, 29 Dec 2002 21:55:03 -0800
Message-ID: <3E0FDFB7.5275B160@exesolutions.com>


pke wrote:

> is it possible to do this?
>
> create sequence Test
> start by x
> increment by 1
> cache 1000;
>
> where x is a variable which is determined in a PL/SQL procedure
> CREATE OR REPLACE PROCEDURE findID
> ( x OUT SMALLINT) AS
> v_max Test.ID%TYPE;
> BEGIN
> SELECT max(id) INTO v_max FROM Test;
> x:=v_max;
> END;
>
> BEGIN
> findID(:x);
> END;
>
> so x has the highest value of the ID, I want the sequence to start from this
> value!
> Or is there an other solution ... ??
>
> Thx in advance

No. And it is really a rather preposterous idea if you think it through.

A sequence is not something you create on the fly, use once, and then destroy. It is something created during application development, run through testing, and deployed into production. It is also intended to be used by multiple simultaneous users.

Think it through and you will find that you either have a huge architecture issue that needs to be resolved or you need something ... but that something is not a sequence.

If you are doing any DDL that creates objects on-the-fly YOU have a problem and need to stop doing it.

Daniel Morgan Received on Sun Dec 29 2002 - 23:55:03 CST

Original text of this message

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