|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
UNIX shell scripting for retrieving from oracle
Hello folks,
Please find the below code sample5.sh -> filename)echo "Selecting dat afrom Cause code" echo "set appinfo Causecode $preamble set serveroutput on size 10000 select * from RMI003_CAUSE_CODE /" | sqlplus -S $username@$hoststring/$password >> test2.dat When i tried executing the code using "SH" i am getting a file "test2.dat",but the file doesn't have any records. Please suggest me where i am wrong. Thanks, Sundar. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Try this script
X=`sqlplus -s user/password@host <<eof set serveroutput on; set feedback off; set linesize 1000; select * from tablename; EXIT; eof` echo $X>testing.dat Here in X you will get the output and after exiting from sql session put that output in some file.May be this will solve your problem..... |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
|||
|
|||
|
tmarikle: Actually old form of Oracle sql statments were in a block ended by a slash. If he added a \n character it would work. This is legal SQL, try it: Code:
select 1 from dual /
|
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Yes / is absolutely right but that is required when pl/sql block is used from shell script.here ; would have done the job.
|
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Jim,
I must not have been as clear as I thought, that's actually what I was trying to communicate to the OP. I was trying to point it out but also prompt an answer so that perhaps the OP could see his own error. Oh well, perhaps next time I'll be more plain. Thomas |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| scope of oracle plsql development /unix shell scripting | jesthomas | Shell Programming and Scripting | 2 | 10-01-2011 12:16 AM |
| Help needed for shell scripting for oracle. | fidelis | Shell Programming and Scripting | 2 | 05-25-2010 11:26 AM |
| Help need urgently for oracle cursors in k shell scripting | rajeshorpu | Shell Programming and Scripting | 4 | 08-10-2009 11:02 PM |
| Shell Scripting with Oracle... | B14speedfreak | Shell Programming and Scripting | 2 | 03-22-2006 11:04 AM |
| Unix and Oracle scripting | Khoomfire | Shell Programming and Scripting | 7 | 08-19-2005 06:07 AM |
|
|