connecting ....sql


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting connecting ....sql
# 1  
Old 11-12-2004
connecting ....sql

if[ $action = 'START' ];
sqlplus /nolog <<EOF
conn / as sysdba
spool /tmp/start.out
@/oracle/home/start.sql
spool off
exit
EOF
fi

For this code i am getting error:
Test.sh: syntax error at line 7 : `<<' unmatched
# 2  
Old 11-12-2004
Could u try putting 'exit' after EOF ??

Also , try ';' after ORACLE statements whereever necessary .
# 3  
Old 11-12-2004
Your if statement is illegal. You need
Code:
if [ $action = 'START' ]; then
.
.
.
.
fi

You forgot the "then", plus you had no whitespace between if and [

Cheers
ZB
# 4  
Old 11-12-2004
PromptUser()
{
echo "Enter the owner of the Schema"
read User
if [ $action = 'export' ]; then
sqlplus /nolog <<EOF
conn / as sysdba
spool /tmp/start.out
@/oracle/home/user.sql
spool off
exit
EOF
fi
}

For this code i am getting error:
Test.sh: syntax error at line 7 : `<<' unmatched


I made all the changes as i got replies, but i am still getting the same error!
# 5  
Old 11-13-2004
Is there any whitespace before the here document terminator (EOF in this case)?

e.g.
Code:
somecommand <<EOF
this
will
work
EOF

somecommand <<EOF
   but this
   will not
   EOF


Cheers
ZB
# 6  
Old 11-14-2004
connecting to Database

#UserTest.sh
User()
{
sqlplus /nolog <<EOF
conn / as sysdba
spool /tmp/check_User.out
start /oracle/home/check_FUser.sql;
spool off
exit
EOF
user=`cat /tmp/check_User.out`
echo $user
}

User

For this shell script i am getting the error
UserTest.sh: syntax error at line 7 : `<<' unmatched
# 7  
Old 11-14-2004
try
function User () {etc etc }
the error could be that the shell doesn't recognize the script itself ending at line 7 because it doesn't know it is a function..
moxxx68
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies

2. Shell Programming and Scripting

How to get rid off Password expiry error message when connecting to sql in script?

I am connecting to sql databases through shell script. Databases that i am connecting will need password change every 60 days. This is according to our security policy and cannot be changed. But this is creating problem when connecting to Databases through shell script . To connect to oracle DB we... (2 Replies)
Discussion started by: pallvi_mahajan
2 Replies

3. UNIX for Dummies Questions & Answers

SQL block in a Shell Script connecting to a local and remote DB

Hi All, In a Shell scriipt with a SQL block I want to issue a query against a local DB and a remote DB on a remote server. The shell script is running locally. This is how I connect to the local server. But I want the query to reference remote table in the join. Question can I specify a... (1 Reply)
Discussion started by: daveu7
1 Replies

4. Shell Programming and Scripting

how to replace a string with new string after connecting to sql

Hi, I have a file which contains the following data File.dat <filenum> W10 </filenum> <hello>Heading </hello> I need to replace the contents of file.dat with database value inplace of W10 Can some one please tell me how to search this <filenum> W10</filenum> and replace... (1 Reply)
Discussion started by: Ramyajiguru1
1 Replies

5. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

6. Shell Programming and Scripting

Connecting to MS SQL database from bash (using unixODBC)

I've installed unixODBC and I would like to connect to a MS SQL (2005) database from a bash script. Can you post a code example? Thank you! :D J. (0 Replies)
Discussion started by: ph0enix
0 Replies

7. Shell Programming and Scripting

error connecting sql through a shell script

Hi I am getting this error while connecting to sql through a shell script, whereas i am able to connect to sql directly. It was working properly earlier, no clue why i am getting this. Please find the log below: FTP to <IP> completed Wed Apr 30 11:42:01 BST 2008 Program ended. Wed Apr 30... (1 Reply)
Discussion started by: nehak
1 Replies

8. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

9. Shell Programming and Scripting

connecting sql from shell

Hi all, I am running an sql file from unix .In the log file along with the output i am getting details of connecting and disconnecting sqlplus like It saves the output with "Connected to Oracle8i Enterprise Edition Release 8.1.7.4.0 Connected as apps" and "disconnected... (1 Reply)
Discussion started by: rrs
1 Replies

10. UNIX for Advanced & Expert Users

Connecting DB in the Shell Script to do SQL Query

Any link or example to write shell script for the Connecting Oracle for Quering through SQL thanks in advance ... Cheers !! Mehul Doshi (3 Replies)
Discussion started by: mehuldoshi
3 Replies
Login or Register to Ask a Question