I am writing a korn shell script in which I need to read some field values from an Informix database. I execute the query using isql $DBNAME <<. loading the appropriate modules for the informix database. Can I get the select query value directly into a shell variable? For example, is this possible:
Code:
#!/bin/ksh
#load db specific modules
typeset SOMEVARIABLE
isql $DBNAME <<.
select field_name INTO SOMEVARIABLE from table_name where record_id = 1;
.
#now use SOMEVARIABLE which contains the value that would have had been returned.
Don't need to worry about multiple values being returned from the query. Any modifications that can help do this? Any other simpler methods to achieve something like this? I need to fetch around 5 values from the same table depending upon different where clause conditions and use them with another informix database (with different module loads - on another server)
Or, is there a way to query a different informix server from another server? Like in case of MS Sql Server 2000, there is something like OPENDATASOURCE() function that helps with this. We can call it from stored proc on one server to query a db on another server giving the connection parameters.
Thanks to all in advance. Appreciate any help.