Board index » delphi » Accessing oracle sequences from Delphi 1.0 CS

Accessing oracle sequences from Delphi 1.0 CS

Hi,

Does anyone know how it is possible to access a sequence from Delphi?
The sql code is select sequncename.nectval from dual. Delphi thinks the sequence
name is a table so it crashes.
Another problem is that the dual table is not visible from within delphi?
I'm really stucked this time.

Thanks in advance

Joao

 

Re:Accessing oracle sequences from Delphi 1.0 CS


Quote
Joao Lourenco wrote:

> Hi,

> Does anyone know how it is possible to access a sequence from Delphi?
> The sql code is select sequncename.nectval from dual. Delphi thinks the sequence
> name is a table so it crashes.
> Another problem is that the dual table is not visible from within delphi?
> I'm really stucked this time.

> Thanks in advance

> Joao

Strange I am currently accessing both the Dual and a sequence from
Oracle within Delphi (both 1.0 abnd 2.0)  Here's a line straight out of
my app:

SELECT 'RM'||to_char(SQ_DEAL_ID.CURRVAL) AS ID FROM DUAL

One think that I sometimes overlook (and Delphi gives a stupid error
message to) is that you need to connect the SQL component to a database
object.  Other than that maybe its just an Oracle access rights thing.

--
John Parrott
Elysium Financial Systems
s...@interlog.com
http://www.interlog.com/~spo

Re:Accessing oracle sequences from Delphi 1.0 CS


: Does anyone know how it is possible to access a sequence from Delphi?
: The sql code is select sequncename.nectval from dual. Delphi thinks the sequence
: name is a table so it crashes.
: Another problem is that the dual table is not visible from within delphi?
: I'm really stucked this time.

Hi,

I have no problems accessing sequence over BDE/ODBC using Delphi 1.

I just do:

..
query.SQL.Clear;
query.SQL.Add( 'SELECT mySeq.NextVal FROM DUAL' );
query.Open;
nextvalue := query.Fields[0].asInteger;
..

tanel

Re:Accessing oracle sequences from Delphi 1.0 CS


Quote
John Parrott wrote:

> Joao Lourenco wrote:

> > Hi,

> > Does anyone know how it is possible to access a sequence from Delphi?
> > The sql code is select sequncename.nectval from dual. Delphi thinks the sequence
> > name is a table so it crashes.

Be sure you grant ALL on Sequence to the username you access the
sequence from, if it's not the owner.  The Oracle manual is
misleading on that point.

  ||                                                         /\
  ||||  Jason Pociask, Tempe Arizona USA                /\  /  \/\
  ||    Poci...@Maricopa.Edu  Vox: 602-731-8835    /\  /  \/      \
||||    "You have to do the hard thing"           /  \/
  ||                      -- The Turtles         / Viva Fibonacci!

Other Threads