If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > unix shell scripting question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-03, 08:45
adip adip is offline
Registered User
 
Join Date: Jun 2003
Posts: 1
unix shell scripting question

me
trying to run a select statment
select * from x >a.txt
this does not work
wheras
select * from x works

What is teh redirection operator required
Reply With Quote
  #2 (permalink)  
Old 06-06-03, 19:25
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
Re: unix shell scripting question

Just a thought ....

Can you have your statement within quotes
"select * from x" > a.txt

Quote:
Originally posted by adip
me
trying to run a select statment
select * from x >a.txt
this does not work
wheras
select * from x works

What is teh redirection operator required
Reply With Quote
  #3 (permalink)  
Old 06-16-03, 18:10
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
In unix shell sript you can do something like this:

#!/bin/ksh
sqlplus <usr>/<pw> <<!
spool a.txt
select * from x;
spool off
exit
!

And also like this:

#!/bin/ksh
sqlplus <usr>/<pw> <<! >a.txt
select * from x;
exit
!

Last edited by LKBrwn_DBA; 07-10-03 at 11:46.
Reply With Quote
  #4 (permalink)  
Old 07-09-03, 19:09
aruneeshsalhotr aruneeshsalhotr is offline
Registered User
 
Join Date: Jul 2003
Location: US
Posts: 314
Scripting

If u are using sqlplus, kindly use the following command and you would be fine with the same.

script a.txt
sqlplus user /password
select fname, lname, orderid from prod_table;
quit
exit

now you can do a
cat a.txt
cat a.txt | mail user@domain.com
Reply With Quote
  #5 (permalink)  
Old 07-15-03, 10:50
pooja pooja is offline
Registered User
 
Join Date: Dec 2002
Posts: 104
another solution

isql -U<username> -P<pwd> -S<servername> -D<dbname> -oa.txt <<-EOF
select * from table
go
EOF

Pooja
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On