Creating a .sh script to execute an SQL file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating a .sh script to execute an SQL file
# 1  
Old 07-01-2009
Creating a .sh script to execute an SQL file

Hello

I'm hoping someone may be able to help. I'm absolutely brand new to these shell scripts and have tried to bash bits together from the little learnt but my final script still doesn't work. Sorry if something similar is already posted but couldn't find anything existing close enough to help me with what I need.

The .sh is running from an external application and displays the following error meesage Unable to execute 'filepath' 2>&1. Does this error message relate to anything specific or anything anyone is aware of?

All I require the .sh to do is execute 1 SQL file called unique.sql and the SQL code does everything else I need but still been unable to get it to work.

Thanks in advance
# 2  
Old 07-01-2009
to run a sql file from a script, the following line should do:

sqlplus -s user/password@inst @unique.sql
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with shell script to execute a sql cursor

Hi All, I want some help in writing a shell script which will be in the below form: A logical representation of shell scripts: ->Shell scripts start ->Connect to database ->Execute a sql and store the output in a cursor(need to know is there any concept of cursor in unix) ->Using a loop... (2 Replies)
Discussion started by: Chitragupta
2 Replies

2. Shell Programming and Scripting

How to execute a sql querry from shell script?

hello forum , I am new to shell scripting. as part of my assignment i have to execute a sql querry from the shell script. please help me. example. sql queerry:db2 "select emp_id from tsble emp". i have to execute the above querry from the script. advance thanks to forum Siva ranganath (1 Reply)
Discussion started by: workforsiva
1 Replies

3. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

4. Shell Programming and Scripting

Execute SQL query in unix script

Hi I am new in unix. oracle and unix are installed in my sytem.i need the script which could connect to the oracle using username ,password and schema and can run the select * from tab query. Thanks vijay (8 Replies)
Discussion started by: vijays3
8 Replies

5. Programming

how to execute the sql quires from shell script?

hi all, I'm new to shell scripting, i want to know how to use the sql statements from the shell script? is there any documents or pdf to learn from the begining? plese provide me some useful links on the same. Thanks all in advance..,:b: (3 Replies)
Discussion started by: vij_krr
3 Replies

6. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

7. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

8. Shell Programming and Scripting

TO execute .sql 2005 query file in shell script

Hi, I know in oracle a .sql file is called by @ <path> /<filename>. But how to call in sql 2005, I am opening the sql sessionwith sqsh, is there any command to execute there a .sql file (query in sql 2005) in K shell script. (0 Replies)
Discussion started by: n2ekhil
0 Replies

9. Shell Programming and Scripting

Shell Script to execute SQL's

Hi people, i need youre help on this. I need to create an Shell SCript to list in a directory some sql files and then execute them one by one . Also i need to have Logs from the executed Sql's to send to our costummers. Can anyone help me on this Regards, osramos (2 Replies)
Discussion started by: osramos
2 Replies

10. Shell Programming and Scripting

How to execute a .sql file with shell script

hi everybody... can anyone help me in executing the .sql file with shell scripting.... thanx in advance (2 Replies)
Discussion started by: abuanas
2 Replies
Login or Register to Ask a Question