Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: ALTERing a sequence's min value
Thanx.
Brian
On Tue, 23 May 2000 12:38:11 GMT, Brian Peasland <peasland_at_edcmail.cr.usgs.gov> wrote:
>> Thanx. But is there anyway to set ti to a return from a select
>> statement such as SELECT MAX?
>
>You'll have to do something like Sybrand suggested in his post to this
>thread. Or you can use some PL/SQL and DBMS_SQL. Something like:
>
>
>DECLARE
> NewMin NUMBER;
> AlterStmt VARCHAR2(100);
> vCursor NUMBER;
> vNumRows NUMBER;
>BEGIN
> /* get the new minimum value */
> SELECT some_column INTO NewMin FROM some_table WHERE some_condition;
>
> /* create the alter statement */
> AlterStmt := 'ALTER SEQUENCE some_sequence MINVALUE ' || NewMin;
>
> /* use DBMS_SQL to issue the DDL statement */
> vCursor := DBMS_SQL.OPEN_CURSOR;
> DBMS_SQL.PARSE(vCursor,AlterStmt,DBMS_SQL.V7);
> vNumRows := DBMS_SQL.EXECUTE(vCursor);
>END;
>
>Or something of that nature.
>
>HTH,
>Brian
>
>
>
>
>
>--
>========================================
>Brian Peasland
>Raytheons Systems at
> USGS EROS Data Center
>These opinions are my own and do not
>necessarily reflect the opinions of my
>company!
>========================================
Received on Tue May 23 2000 - 00:00:00 CDT
![]() |
![]() |