Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Informix
Expertise: Beginner
Aug 29, 2000

SQL with Unix Arguments

Question:
How do I pass arguments from a Unix shell onto SQL for various SQL statements (e.g., select * from $tablename, create table $TABS, etc.)?

Also, how do I get output from SQL within a SPL to several different files? So SQL executes many times and creates a different file each time. Tried to use OUTPUT, but gives some error.

Answer:
You can pass the variables into an Informix dbaccess session by using a UNIX "here file." Create an ascii file called doit:

dbaccess databasename <

Now, chmode doit to allow execution. Execute it by typing "doit tablename." The "tablename" is passed into the doit here-document as $1.

As to your stored procedure question, there are a few provisions in SPL for generating output. Some programmers use the TRACE statement to provide rudimentary output. Some simply populate tables with the results of the SP and then run other programs to generate the output from those tables. Another way would be using the SYSTEM functionality in SPL to let the OS do the output.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap