09-06-2001
If it's a problem with the ' in a shell script, have you tried escaping them with a \ in front of them? Also, could the numbers of embedded ('s in the script be a problem also? I haven't tried this, but how about:
sql_job () {
sqlplus -s user/user@db1 << END
set head off
set feed off
select to_char(min(create_dt) , 'HH24') from table_name where
trunc(create_dt)=trunc(sysdate-2);
/
END
}
INICIO=`sql_job | awk '{print $1}'`
echo $INICIO
This is just a guess... like I said, I didn't try this script, but this is how I would have tried it...
HTH
--
LF
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Can someone tell me how to execute sqlplus command.
I`m Executing:
sqlplus user/pasw @/report/output/new/PlatformOut_Cdrs.sql
the error is:
SQL*Plus: Release 9.2.0.5.0 - Production on Wed Aug 9 15:37:44 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
ERROR:... (3 Replies)
Discussion started by: Nel
3 Replies
2. Shell Programming and Scripting
How to execute a query which is stored in a variable.
Say for example :
v_source_query=”select count(*) from emp”
v_source_value=`sqlplus -S "$DATABASE_LOGIN" << EOF | tr '\n' ' '
set feed off
set pagesize 0
set head... (12 Replies)
Discussion started by: trupti_d
12 Replies
3. UNIX for Dummies Questions & Answers
hi all,
i was given by my supervisor a task to search for scripts which contain oracle sqlplus i.e "myusername/mypasswd @myDB" in every /home/userfolder, which are, all the scripts made by different user. I've done some find command to search string for sqlplus, but it may up too long to respond.... (8 Replies)
Discussion started by: Helmi
8 Replies
4. HP-UX
hi,
i need bash shell script run on the crontab(Unix tru64).
i have write my shell. it's using sqlplus command and connect to oracle db.
execute cron job when i have error messege: "sqlplus: command not found"
have you any suggestion? (4 Replies)
Discussion started by: Tlg13team
4 Replies
5. Shell Programming and Scripting
Hi folks
I use a Solaris 10 box with Bash shell.
I have here a script (it works!) to list all scripts in crontab which contains the string "sqlplus":
for i in $(ls `crontab -l | grep -v '#' | awk '{ print $6 }' | grep -v '^$'`); do grep -l 'sqlplus' "$i"; done
Is there a more elegant... (1 Reply)
Discussion started by: slashdotweenie
1 Replies
6. Ubuntu
I installed Oracle 10.2.1.0 in Ubuntu 10.10..my installation was well,i could even open isqlplus( http://ubuntu.ubuntu-domain:5560/isqlplus/workspace.uix ) and execute some queries..But,back in terminal when i try to login to sqlplus i am getting error (20 Replies)
Discussion started by: sandy0594
20 Replies
7. UNIX and Linux Applications
using sqlplus I want to execute a .sql script that has dbms_output statments in rhe script. I want to write the dbms_output statements from .sql file to a log file. is this possible. thanks
any help would be appreciated
:wall: (1 Reply)
Discussion started by: TRS80
1 Replies
8. Red Hat
Hi,
I am facing a strange issue when connecting to SQLPLUS via a shell scripts.
I am using Linux 2.6.18-274.18.1 and gbash shell.
When I connect to SQLPLUS through scripts then it throws TNS Time Out error ""sometimes"" and connects successfully other times.This is only happening when... (9 Replies)
Discussion started by: aashish.sharma8
9 Replies
9. Shell Programming and Scripting
Hi ,
i am new to unix i need a small clarification regarding this
sqlplus -s $USER_NAME/$PASSWD@$ORA_SID<< EOF >> SQL_CONN_LOG.log
In the above command what is the meaning of <<EOF>>
Thanks,
krishna. (2 Replies)
Discussion started by: rams_krishna
2 Replies
10. UNIX and Linux Applications
Hi all,
i face an error related to my server ""it's running server"" when i use sqlplus command
$ sqlplus
bash: sqlplus: command not found
the data base is up and running i just need to access the sqlplus to import the dump file as a daily backup.
i already check the directory... (4 Replies)
Discussion started by: clerck
4 Replies
LEARN ABOUT HPUX
cmhaltserv
cmhaltserv(1m) cmhaltserv(1m)
NAME
cmhaltserv - halt a service from the high availability package halt script
SYNOPSIS
cmhaltserv [-v] service_name
DESCRIPTION
cmhaltserv is used only in the high availability package halt script to halt a service.
To stop a package service, the running package halt script must be running as superuser(UID=0), or as a user with access policy of
FULL_ADMIN allowed in the cluster configuration file. See access policy in cmquerycl(1) or cmmakepkg(1).
If any part of a package is marked down, the package halt script is executed as part of the recovery process.
This command sends a SIGTERM signal to the PID and the corresponding process group of the monitored service. If this signal is caught by
the running application, it is up to the application to ensure that the processes will be terminated.
Options
cmhaltserv supports the following options:
-v Verbose output will be displayed.
RETURN VALUE
cmhaltserv returns the following values:
0 Successful completion.
1 Command failed.
EXAMPLES
To halt the service db1, do the following:
# Halt the service db1
cmhaltserv db1
This line should only be executed within a package halt script.
AUTHOR
cmhaltserv was developed by HP.
SEE ALSO
cmmakepkg(1m), cmquerycl(1m), cmmodnet(1m), cmrunserv(1m).
Requires Optional Serviceguard Software cmhaltserv(1m)