Shell Linux to connect to a database and execute store procedure


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Linux to connect to a database and execute store procedure
# 1  
Old 07-01-2010
Shell Linux to connect to a database and execute store procedure

HI,
i want to write a script (Linux) that:
1) connect to a database oracle
2) execute some store procedure.

Can anybody help me, please?

Thanks a lot

Andrew
# 2  
Old 07-01-2010
Hi

to start with, You can check for some examples here: connect to sqlplus from shell

Guru.
# 3  
Old 07-01-2010
Thanks a lot, but it wasn't very useful. I know that the script is very simple, but i don't know Linux. The script must:
1) connect to sqlplus
2) execute my store procedures

Thanks a lot

Andrew
# 4  
Old 07-01-2010
i will try to explain whts happeing in the The UNIX School: How to connect to sqlplus from Shell?

Code:
#!/usr/bin/ksh


emp_id=`sqlplus –s $USER/$PASSW@$INST   << EOF
                set pagesize 0
                set feedback off
                set verify off
                set heading off
                select EMP_ID from EMPLOYEE where EMP_NAME=’Blogger’;
                exit;
               EOF`
echo $emp_id

the above is the exact script that is pasted ....

Code:
u just need to change $USER = with your username
and $PASSW = password

int he sqlplus command.
then you set some values for asthetics and then run your query inside. what are you not clear with??
This User Gave Thanks to dazdseg For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Connect to database server and execute sql

I have a requirement and below is the detail. Create a shell script and needs to run in server "a". Connect to teradata database server "b". execute the .sql file from server "a" Save the output of the query to a file in server "a" Schedule this shell script to run every day for every 4... (1 Reply)
Discussion started by: MadhuSeven
1 Replies

2. Shell Programming and Scripting

Why i can't execute the procedure in shell script?

i have the following code inside a shell script .prog in oracle server when i call the program DBMS_OUTPUT.PUT_LINE(x_return_status|| ln_rep_req_id); will return 0 , it is very strange , i try to submit the concurrent request in oracle , and it can successfully executed, what am i missing ? i... (1 Reply)
Discussion started by: feilhk
1 Replies

3. Shell Programming and Scripting

Execute a shell script from Oracle procedure

Hi Gurus, Want to execute a shell script from a oracle procedure and get the status of the same, any assistance in this regard will be appreciated. proc_data.sh is script name which I want to execute from oracle procedure It should work something like below procedure test begin... (1 Reply)
Discussion started by: palanisvr
1 Replies

4. Shell Programming and Scripting

Execute stored procedure through script in sybase database and store the output in a .csv file

Hi, I have a sybase stored procedure which takes two input parameters (start_date and end_date) and when it get executed, it gives few records as an output. I want to write a unix script (ksh) which login to the sybase database, then execute this stored procedure (takes the input parameter as... (8 Replies)
Discussion started by: amit.mathur08
8 Replies

5. Shell Programming and Scripting

Different way to connect to database ans execute sql query

Hi Friends, I am using AIX version and sqlplus to connect to database while writing a shell script. I have implemented three ways to connect to database : 1) sqlplus -s <USERNAME>/<PASSWORD> <<! @<SQL FILE TO EXECUTE> exit ! 2) sqlplus -s <USERNAME>/<PASSWORD> <<! -----sql statemenets... (6 Replies)
Discussion started by: gauravgarg
6 Replies

6. Shell Programming and Scripting

How to execute the stored procedure from shell script

How to execute the stored procedure from shell script and is there any possibility to print the dbms output in a log file. (2 Replies)
Discussion started by: dineshmurs
2 Replies

7. Shell Programming and Scripting

how to store the return values of stored procedure in unix shell script.

hi i am calling a oracle stored procedure(in the database) from unix shell scripting (a.sh). the called stored procedure returns some values through OUT variables i want to assign the return values of stored procedure in to unix shell script variable. can you provide me the code. ... (1 Reply)
Discussion started by: barani75
1 Replies

8. Shell Programming and Scripting

How to execute an Oracle procedure using shell

Hi , i have created an .sh file that has the following code: #!/bin/ksh sqlplus -s p1istuat/p1istuat@CWS_IST6 @Procedure_Execute.sql & sqlplus -s p1istuat/p1istuat@CWS_IST6 << EOF exit EOF The mentioned Procedure_Execute.sql file inside has the following code: exec TEST; ... (5 Replies)
Discussion started by: vins_san
5 Replies

9. Shell Programming and Scripting

run shell script from oracle store procedure

hi, this is urgent..can i run a shell script from store procedure without using java. (8 Replies)
Discussion started by: arnabb4u
8 Replies

10. UNIX for Dummies Questions & Answers

execute store procedure

Hi, can someone point out the tutorial or syntax for how to execute store procedure through shell scripting . thanks. (7 Replies)
Discussion started by: epall
7 Replies
Login or Register to Ask a Question