EOF problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting EOF problem
# 1  
Old 09-25-2010
EOF problem

hi
i am trying to connect to database by two method one is

Code:
sqlplus fss_blf/fss_blf@schema1
>select * from schema1_ta_example
exit

above method succesfffuly connect it to dabase
but the problem comes when i try to enter this code into mine shell script by using EOF character it is giving following problem

Code:
sqlplus fss_blf/fss_blf@schema1 << EOF
>select * from schema1_ta_example
EOF

now it is giving the error schema_ta_example does not exist , why because from the above first method it connect successfully and display the content of table why it is giving the error if i put EOF

pls help me regarding this

---------- Post updated at 07:29 AM ---------- Previous update was at 07:03 AM ----------

hi
can anyone pls help me regarding this i have googled it too but did not find any good solution

y it is giving the error if i put the EOF

Last edited by pludi; 09-25-2010 at 09:50 AM..
# 2  
Old 09-25-2010
Quote:
Originally Posted by aishsimplesweet
...
Code:
sqlplus fss_blf/fss_blf@schema1 << EOF
>select * from schema1_ta_example
EOF

now it is giving the error schema_ta_example does not exist , why because from the above first method it connect successfully and display the content of table why it is giving the error if i put EOF
...
There's nothing wrong with the here-document ("EOF"), but your script is incorrect. Remove the ">" character right before your query and put the sql terminator ";" after it.

tyler_durden
# 3  
Old 09-25-2010
hi actually the > character comes when i write this command on command line but if i write on shell script then it won't come and also i put the semicolon too but still it did not work.

actually in my company there are two database so if i connect to other database and ifi write same query then it works like butter but for this database it is giving problem
# 4  
Old 09-25-2010
Quote:
Originally Posted by aishsimplesweet
...but if i write on shell script then it won't come and also i put the semicolon too but still it did not work. ...
(1) Print the content of your shell script on the Unix/Linux prompt. Use this command below, replacing name_of_your_shell_script by the actual name of your shell script.

Code:
cat -n name_of_your_shell_script

(2) Execute your shell script on the Unix/Linux prompt.

(3) Select and copy your commands and output of steps (1) and (2) and paste them here.

tyler_durden
# 5  
Old 09-25-2010
In the first example you were answering a SQL prompt where the asterisk has only one meaning.
In the second example the commands were first seen by unix shell. It is then necessary to protect the asterisk from the shell and also to exit from SQL.

Code:
select \* from schema1_ta_example;
quit

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

EOF problem with Cron Job?

Hey guys... first post here... I have set up the following cron to create daily backups for me and rotate them weekly: date=`date +%d`; tar -zcvf /home/mysite/backups/backup_dev_$date.tgz /home/mysite/public_html/dev/app --exclude=/home/mysite/public_html/dev/app/tmp However, I keep... (4 Replies)
Discussion started by: Crazy Serb
4 Replies

2. Shell Programming and Scripting

confused with << EOF EOF

Hi friends , I am confused with << EOF EOF Most of the cases I found sqlplus $db_conn_str << EOF some sql staments EOF another exapmle is #!/bin/sh echo -n 'what is the value? ' read value sed 's/XXX/'$value'/' <<EOF The value is XXX EOF (1 Reply)
Discussion started by: imipsita.rath
1 Replies

3. Shell Programming and Scripting

Until eof do????

Hey! Can I write a routine that allows me to in a txt file check line by line until the end of file? something like until do ---some code--- done maybe it is a stupid question but I never learned shell scripts and I need this :p thanks in advance (1 Reply)
Discussion started by: ruben.rodrigues
1 Replies

4. Shell Programming and Scripting

EOF creating problem

In shell file, i am writing following statement: cat > File1.sh <<EOF set feedback off set serveroutput on cat > File2.sh <<EOF contents of second file EOF Contents of First file EOF Actually, i want these bolded statements in File1.sh as it. But after first EOF, contents are... (1 Reply)
Discussion started by: mmunir
1 Replies

5. Programming

Eof

How can I write EOF into a file? I tryed to do as follows: size=sizeof(EOF); end_of_file=EOF; write(fdMutexRichieste, &end_of_file, size); But it does non work correctly, becouse in the next cicle (using lseek(..., SEEK_END) of my code it seems to ignore my EOF and use the LAST... (5 Replies)
Discussion started by: DNAx86
5 Replies

6. Shell Programming and Scripting

What is << EOF

I'm trying to connect to oracle with the following code in the script: checksqlerror{ if echo $1 exit fi } $SQLPLUS username/password@schemaname checksqlerror "failed to connect to oracle" If I'm passing wrong schema name,instead of executing checksqlerror it stops and expects user... (2 Replies)
Discussion started by: BhawanaAggarwal
2 Replies

7. AIX

problem with expect eof

hi guys i have such simple script, which i'm executing on AIX 5.3 #!/usr/local/bin/expect spawn passwd exptest set password 123 expect "*password:*" send "$password\r" expect "*password again:*" send "$password\r" expect eof the output is following: spawn passwd exptest sh:... (4 Replies)
Discussion started by: zoom
4 Replies

8. UNIX for Dummies Questions & Answers

\n after EOF

Hello all, I have unix file that ends with the following EOF '9999999999' I want to remove the '\n' character after EOF. What is the command that should be included in the script, before sending the file? will this work: $ echo "<99999999999>\c" >> <filename> thanks in advance. (3 Replies)
Discussion started by: priya12
3 Replies

9. Shell Programming and Scripting

Please help with EOF

Hello, you are an awesome crowd! You answered my last questions, thank you sooo much! I am trying to write a korn shell script that will record the memory my application is using (HP-UX B.11.11) and I have this: if (( $APP > $THRESHOLD )) then echo "Warning message will display" cat... (2 Replies)
Discussion started by: satraver
2 Replies

10. Shell Programming and Scripting

EOF use

Hi, I'd like to access a windows directory from aix with samba client. To allow direct access (not interactive), i'm using EOF like: smbclient \\\\winserver\\windir 'passwd' -U usersmb << EOF cd subwindir put myfile EOF The access is correct but does somebody know how to trap errors... (1 Reply)
Discussion started by: jo_aze
1 Replies
Login or Register to Ask a Question