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

sqlplus -s <<EOF
$user/$passwd@oracle_instance
select count(*) from mytable;
exit
EOF

sqlplus has to be in your PATH.

Hi Jim

That works perfectly.

Thanks for the earliest reply.

sish

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

set up your Oracle environment first:

. /usr/local/bin/oraenv

hey

Thanks for the earliest reply

do i need to setup it in .cshrc file?

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.