Executing a select statement

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Executing a select statement

Post by admin »

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
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

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
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

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
Locked