wirting a basic routine to run sql

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsfan2004
Participant
Posts: 10
Joined: Tue Feb 17, 2004 5:03 pm

wirting a basic routine to run sql

Post by dsfan2004 »

Hi everyone,

is there anyway I can write a sql statement in a Datastage Basic routine?
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

The easiest way is to run a shell script which runs sqlplus or whatever.
Mamu Kim
dsfan2004
Participant
Posts: 10
Joined: Tue Feb 17, 2004 5:03 pm

Post by dsfan2004 »

I need to run a select statement and return the result ( the result is always a single value ), is there a way i can do it?
kduke wrote:The easiest way is to run a shell script which runs sqlplus or whatever.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Sure. You can write it to a sequential file but why not do it in a job. You could write it to a hash file or a sequential file in a job. It would be easy to read that from a routine.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Of course you can write one.

But what do you want to do with it then?

If it's "UniVerse" SQL you can execute it directly, via DSExecute.

If it's not, you can write it to a file as others have noted, then invoke some kind of script to execute it.

Another possibility is to write a routine that is an ODBC client, using a library of functions collectively called the BASIC SQL Client Interface (BCI). However, to use this on a UNIX server you will need to purchase a licensed ODBC driver to connect to the database in question. The drivers supplied with DataStage are licensed only to be used with stages, not with routines.

Search the Forum for more information.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply