![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help (Select query) | topgear1000cc | Shell Programming and Scripting | 5 | 02-12-2008 07:22 AM |
| Displaying the data from the select query in a particular format | sachin.tendulka | Shell Programming and Scripting | 15 | 12-11-2007 08:44 AM |
| Extract numbers from a string and store in variables | davewg | Shell Programming and Scripting | 6 | 11-14-2007 05:22 AM |
| How to store query multiple result in shell script variable(Array) | div_Neev | Shell Programming and Scripting | 4 | 11-06-2007 08:10 PM |
| Select a portion of file based on query | vanand420 | Shell Programming and Scripting | 14 | 10-31-2006 04:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi Friends,
Can u please help mw with the following query . I need to run a database sql statement to select particular fields from a table.I need to store the retrieved filed values into variables so that i can print it in a specific format. But the particular select query retrieves more than 1 row .I have redirected the result of the query to a temporary text file.Lets say there are 10 rows retrieved. These retrieved values(filed_name value) are written into say 1.txt. Now 1.txt looks some what like this : fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value I thought of using a grep command to get the values and store it in a variable.But the format of this text file makes it impossible. Can please help me to put the data as below in 1.txt fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value or When we run a select statement the rows are retrieved in the below format : fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value fld_name value 3 rows retrieved Is there any way to store exactly this way to 1.txt? Thanks in advance Jisha |
|
||||
|
Quote:
My script is like this : `isqlrf <database_name> - <<EOFSQL select .... from ..... where .....; EOFSQl` How i put the output of the above query was as below: values=`isqlrf <database_name> - <<EOFSQL select .... from ..... where .....; EOFSQl` echo $values > 1.txt I dont know anything about spools.Do u think my way of approach is correct? Many Thanks Jisha |
|
||||
|
try like this
`isqlrf <database_name>;<<EOFSQL spool 1.txt select .... from ..... where .....; spool off; EOFSQl` you may need to tweak it around a bit, Sorry cant check right now for you as dont have access to UNIX system right now |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|