Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

embedded sql in unix (c shell) urgent

Status
Not open for further replies.

encourage

Programmer
Apr 16, 2002
5
IN
i am having a problem regarding embedded sql in cshell.

i run a sql query and obtain the data in a file. then the data obtained in the file needs to be parsed in order to do proper function.

is there a way by which i can run a sql query and the data abtained be stored in variables which can directly be used by the C SHELL instead of writing it in a spool file

 
encourage:

It depends on how you're embedding the SQL. If you're using an interface program such as sqlplus for Oracle, or dbaccess for Informix, etc, it's going to be difficult.

The idea is using command substitution, to set the output of a select equal to a shell variable. Generally, these database interfaces outputs include white space, headings, and what not, so it's next to impossible to set shell variables without sending the output to a file, editing the file, reading the file, etc.

Now, if the embedded SQL is in a "C" program or other high level language, you might be able to use command substitution:

#!/bin/ksh
somevar=`some_executable_program`

Regards,

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top