Error while connecting to Oracle with Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while connecting to Oracle with Script
# 1  
Old 02-23-2011
Error while connecting to Oracle with Script

Experts,

I am using the following Linux version:

Linux localhost.localdomain 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:32:14 EDT 2005 i686 i686 i386 GNU/Linux

and creating a ksh script with below code in it.
Code:
clear
sqlplus RIB/RIB321@RIB_LOCAL
#whenever sqlerror exit failure
#set serveroutput on size 1000000
exec entry_to_employees_result('Raja','Khan','eftgggs@gmail.com','12');
exit;

while running the above script, It connects me to the oracle database but its not executing the procedure 'entry_to_employees_result'. Then, writing EXIT manually i am getting the below mentioned error:
Code:
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 23 04:38:36 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
./insert_to_table.ksh[14]: syntax error: `(' unexpected
[origin@localhost testdir]$


Can anyone help me out of this.

Regards
Oracle User

Last edited by Franklin52; 02-23-2011 at 03:28 AM.. Reason: Please use code tags, thank you
# 2  
Old 02-23-2011
Welcome to the forum.
You need a method which tells shell that the below commands are sqlplus commands and not shell commands. "Here documents" is the solution for that.

Code:
sqlplus RIB/RIB321@RIB_LOCAL << SQL
--whenever sqlerror exit failure
--set serveroutput on size 1000000
exec entry_to_employees_result('Raja','Khan','eftgggs@domain.com','12');
exit;
SQL

This User Gave Thanks to clx For This Post:
# 3  
Old 02-23-2011
Thank-you Anchal.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Connecting to Oracle database

Hi guys, long time no typing :D I have problems when I try to connect to Oracle database from SQL Developer which is located on my Windows box. Server is running Solaris 11/11 and Oracle 11 enterprise. I can log in locally with sys account to database, start it up and shut it down but when I... (2 Replies)
Discussion started by: solaris_user
2 Replies

2. Shell Programming and Scripting

Connecting to oracle database

Hai i want to connect to oracle database from user input and create a view. ${ECHO} "Debut Creating View" ${ECHO} "Please Enter the User Name:" read user_name ${ECHO} "Please Enter the Connection String:" read con_string ${ECHO} "Please Enter the Password:" read pwd... (3 Replies)
Discussion started by: shenthil76
3 Replies

3. UNIX for Dummies Questions & Answers

Connecting to Oracle DB using sqlplus

Hi, I am very new to shell scripting and trying to write a simple shell script in which i am trying to achieve the following: 1. Connect to oracle database hosted on a different server 2. fire a query on the oracle db 3. store the output in a variable 4. use this variable for further logic... (1 Reply)
Discussion started by: shrutihardas
1 Replies

4. Shell Programming and Scripting

Help me Connecting CA::Autosys to oracle DB

Hi :), Am new to work with Autosys. I have Oracle installed in my computer. Please guide me how to configure and connect autosys with oracle database. thank you..!:) (0 Replies)
Discussion started by: bhuvaneshlal
0 Replies

5. Shell Programming and Scripting

Connecting CA::Autosys to oracle DB

Hi :), I have installed CA Autosys in my Unix system. It contains 3 ( .pm ) files namely AutoSys.pm, Job.pm, Status.pm ....... in a directory CA. Am trying to work with autosys for first time. Please guide in how do i connect autosys to oracle DB in my system. My oracle db name is XE.. Thank... (0 Replies)
Discussion started by: bhuvaneshlal
0 Replies

6. Shell Programming and Scripting

run shell script connecting to oracle from crontab

Hi, I have problems with running shell script connecting to Oracle from the crontab. Here is the script: #!/sbin/sh ORACLE_HOME=/opt/oracle/10g/ export ORACLE_HOME if then echo "Source path is not specified" exit fi /opt/oracle/10g/bin/sqlplus user/pass@testdb << EOF truncate table... (6 Replies)
Discussion started by: apenkov
6 Replies

7. Shell Programming and Scripting

Connecting to oracle database from shell script

Hi all, I am satyakiran , i am new to the forum. i never done shell scripts for connecting to the data base (oracle) and fetching the data from the database( thru sql select statements ) i want to know 1. how to connect to the data base(oracle) using shell script 2. how to retrieve data... (8 Replies)
Discussion started by: satyakiran
8 Replies

8. Shell Programming and Scripting

Error connecting oracle from inside while loop

Hi, I m trying to connect oracle database from inside while loop. I m trying to put the output of sql query in a flat file. Anyone please help me out. cat $FILE_NAME | \ while read da_name do $ORACLE_HOME/bin/sqlplus -s user_name/password@instance << EOF >> $OUTPUT_FILE select... (3 Replies)
Discussion started by: Devesh5683
3 Replies

9. Shell Programming and Scripting

Connecting to Oracle Database

if; sql="select username from dba_users where username = '$FromUser';" check_FromUser=`ExecSql "$sql"` I want to connect to Oracle database & check the users in the database, store the value in check_FromUser. First how to connect to Oracle database from the shell script ? Appreciate your... (4 Replies)
Discussion started by: dreams5617
4 Replies

10. 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
Login or Register to Ask a Question