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

Home -> Community -> Usenet -> c.d.o.tools -> Re: ALTERing a sequence's min value

Re: ALTERing a sequence's min value

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: 2000/05/23
Message-ID: <392A7BB3.77A838CE@edcmail.cr.usgs.gov>#1/1

> 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

Original text of this message

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