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: dynamic value for sequence

Re: dynamic value for sequence

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Wed, 25 Sep 2002 16:07:26 GMT
Message-ID: <3D91DF31.243D3D48@exesolutions.com>


"Ingo R. Kirchner" wrote:

> Hi Daniel, the only access to oracle I have on this client is via
> access-sql pass through queries in a vba routine, so there is no hand ...
>
> thanX anyway
>
> Ingo
>
> "Daniel Morgan" <dmorgan_at_exesolutions.com> schrieb im Newsbeitrag
> news:3D90C67F.568B7438_at_exesolutions.com...
> > "Ingo R. Kirchner" wrote:
> >
> > > Hi Daniel,
> > >
> > > I'm just developing a vba routine in access to move access-tables to
> oracle
> > > server, so i like to send sql pass-through queries dynamicly to oracle.
> > > Therefore wouldn't it be better to have it a in one sql statement?
> > >
> > > Ingo
> > >
> > > "Daniel Morgan" <dmorgan_at_exesolutions.com> schrieb im Newsbeitrag
> > > news:3D908E6E.9CA85927_at_exesolutions.com...
> > > > "Ingo R. Kirchner" wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I would like to create a sequence with a start value based on the
> > > maximal
> > > > > Value of the table
> > > > >
> > > > > something like
> > > > >
> > > > > create sequence software_seq
> > > > > start with (select max(softwareid) from software)+1
> > > > > increment by 1
> > > > > nomaxvalue;
> > > > >
> > > > > but it doesn't work this way
> > > > >
> > > > > any help appreciated, thanks in advance
> > > > >
> > > > > Ingo
> > > >
> > > > SELECT MAX(column_name) FROM table;
> > > >
> > > > CREATE SEQUENCE sequence_name START WITH <the number previously
> returned
> > > > here>
> > > >
> > > > unless you want to put it all together in code with dynamic SQL but I
> > > can't
> > > > imagine why.
> > > >
> > > > Daniel Morgan
> > > >
> >
> > In theory yes. In practice ... you can do it by writing a stored procedure
> > using native dynamic SQL. But I dislike spending hours to write and test
> > something that can easily be done by hand in a few minutes.
> >
> > Daniel Morgan
> >

Then try to pass the native dynamic SQL through as an anonymous block.

But I can not conceive of a situation where you can access via ODBC but can't access using SQL*Plus. How is that accomplished?

Daniel Morgan Received on Wed Sep 25 2002 - 11:07:26 CDT

Original text of this message

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