Hi all,
I want to make a routine that returns the value of a database sequence.
Where i can find the functions to do that?
There is any function that executes a select statement?
Thanks in advance,
NP
Executing a select statement
If you really need to do this, then you will have to call ODBC direct from UniVerse Basic.
Refer to the UniVerse BASIC SQL Client Interface Guige (BCI.pdf), for details of how to do this.
Have you considered just using a lookup? The user defined query (in the case of Oracle) be something like select mysequence.nextval from dual
The main trick here is to determine, before you get to the transform which does the lookup, whether or not you need it to avoid unnecessarily incrementing the sequence.
Another approach is a user-defined INSERT which references your sequence.
Im sure Ive seen other solutions to this posted on this list as well.
-----Original Message-----
From: Nuno Pimenta [mailto:nuno.pimenta@tmn.pt]
Sent: Thursday, 25 October 2001 1:37 AM
To: LIST-DataStage (E-mail)
Subject: Executing a select statement
Hi all,
I want to make a routine that returns the value of a database sequence.
Where i can find the functions to do that?
There is any function that executes a select statement?
Thanks in advance,
NP
Refer to the UniVerse BASIC SQL Client Interface Guige (BCI.pdf), for details of how to do this.
Have you considered just using a lookup? The user defined query (in the case of Oracle) be something like select mysequence.nextval from dual
The main trick here is to determine, before you get to the transform which does the lookup, whether or not you need it to avoid unnecessarily incrementing the sequence.
Another approach is a user-defined INSERT which references your sequence.
Im sure Ive seen other solutions to this posted on this list as well.
-----Original Message-----
From: Nuno Pimenta [mailto:nuno.pimenta@tmn.pt]
Sent: Thursday, 25 October 2001 1:37 AM
To: LIST-DataStage (E-mail)
Subject: Executing a select statement
Hi all,
I want to make a routine that returns the value of a database sequence.
Where i can find the functions to do that?
There is any function that executes a select statement?
Thanks in advance,
NP
It will depend on the database of course, but why cant you do exactly what youd do working directly with the database? For example SELECT SEQ001.CURRVAL FROM TABLE;
-----Original Message-----
From: Nuno Pimenta [mailto:nuno.pimenta@tmn.pt]
Sent: Thursday, 25 October 2001 01:37
To: LIST-DataStage (E-mail)
Subject: Executing a select statement
Hi all,
I want to make a routine that returns the value of a database sequence.
Where i can find the functions to do that?
There is any function that executes a select statement?
Thanks in advance,
NP
-----Original Message-----
From: Nuno Pimenta [mailto:nuno.pimenta@tmn.pt]
Sent: Thursday, 25 October 2001 01:37
To: LIST-DataStage (E-mail)
Subject: Executing a select statement
Hi all,
I want to make a routine that returns the value of a database sequence.
Where i can find the functions to do that?
There is any function that executes a select statement?
Thanks in advance,
NP