SQL Commands in Unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SQL Commands in Unix
# 1  
Old 05-19-2006
SQL Commands in Unix

Hi gurus,

Being a newbie not sure whether iam asking the right question?

can we use oracle commands in unix for ex: to read a count on a table.

if so, what needs to be configured and etc..

any kind of help is appreciated.

Thanks
sish
# 2  
Old 05-19-2006
Code:
sqlplus -s <<EOF
$user/$passwd@oracle_instance
select count(*) from mytable;
exit
EOF

sqlplus has to be in your PATH.
# 3  
Old 05-19-2006
Hi Jim

That works perfectly.

Thanks for the earliest reply.

sish
# 4  
Old 05-25-2006
It worked well before

but when i try to execute the above shell script(as given by jim) it encounters the following error as 'sqlplus not found'

may be some one removed the path of sqlplus.

how should i configure the path and in which file should i configure the path

the shell type is : ksh

any mind of help is appreciated

regards
sish
# 5  
Old 05-25-2006
set up your Oracle environment first:

. /usr/local/bin/oraenv
# 6  
Old 05-25-2006
hey

Thanks for the earliest reply

do i need to setup it in .cshrc file?
# 7  
Old 05-25-2006
If you are using CSH then you'll want to invoke a different script:

source /usr/local/bin/coraenv

and yes, you will want to put it in your .cshrc but you'll have to set your ORACLE_SID variable and ORAENV_ASK=N prior to sourcing the script.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to parse text file into sql commands

Hello all, I tried searching for something similiar before posting but couldn't come up with anything that fit what I need. In Linux, I'm trying to parse through a number of files and take the info in them and put it into mysql. My file is a dump from an expect script: ---filename... (3 Replies)
Discussion started by: hamanjam
3 Replies

2. UNIX Desktop Questions & Answers

Multiple SQL Commands

Hello Experts !!! Im new to this so, please bear with me ! I have the following 2 sql statements create table CMD_NEW_USER as Select FD.EMPLOYEE, FD.PASTUSER, ..... FROM REPORTS FS, TASKLIST FD WHERE FS.EMPLOYEEID = FD.EMPLOYEEID ; create table CMD_OLD_USER as Select FD.EMPLOYEE,... (4 Replies)
Discussion started by: OMLEELA
4 Replies

3. Shell Programming and Scripting

SQL commands in Scripting

Hi , Daily I sneding report to client about the status of State 2 jobs in Control M . I would like to schedule it via cron . I am using teh following command : sudo su - <control M server Name> then reach to the control M server then run #isql <It ask for the password > ... (1 Reply)
Discussion started by: chandancsc
1 Replies

4. 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

5. Shell Programming and Scripting

SQL commands in a shell scripting

Hi, I need to write a shell script file that does 1)Connects to DB using SQL plus 2)Do some SQL query like select * from.... 3)Based on the output that I got from the sql query I will have to write a if else loop. Plz let me know how to write the shell scripting for this. Thanks for... (1 Reply)
Discussion started by: villain41
1 Replies

6. AIX

how can i install sqlplus and execute some sql commands

hi everybody, i am Talip, a begginner at unix based systems and i have a problem (actually, we may think myself as the problem, in this situation). i am not sure if this is the correct platform for my questions. if it is not please forgive me about this inappropriate mail. what i have: *... (2 Replies)
Discussion started by: talipk
2 Replies

7. Shell Programming and Scripting

how to sql commands in shell script

hi, plz let me know one example in using sql command in shell script thanks inadvance -bali. (1 Reply)
Discussion started by: balireddy_77
1 Replies
Login or Register to Ask a Question