Sponsored Content
Top Forums Shell Programming and Scripting Problems with SQLPLUS in shellscript Post 302239538 by Dhruva on Wednesday 24th of September 2008 01:39:26 AM
Old 09-24-2008
Here is script

Quote:
echo "in script"

X=`sqlplus -s user/password@servername <<eof
set serveroutput on;
set heading off;
set feedback off;
set linesize 1000;
declare
out_value number; --use variable type as per ur requirement

BEGIN
SELECT DISTINCT 1 into out_value FROM ******* WHERE ***** ('CRE','CRA')
AND TO_CHAR (***** , 'DD:MM:YYYY') = TO_CHAR ( SYSDATE, 'DD:MM:YYYY')
AND ****** IN ( 0) AND ******** =0;

dbms_output.put_line(out_value);
EXCEPTION WHEN NO_DATA_FOUND THEN
out_value:=null;
END;
/
EXIT;
eof`
echo "after plsql block"
echo "value after query is $X"

Last edited by Dhruva; 09-25-2008 at 01:32 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create Shellscript

I am new to UNIX. I got the file from Oracle, with two columns (Table Name and Column Name). I need to create the shell script where the result suppose to include plain text, <table_name>, <Column_name> from the file. Plain text will be the statements to create index in Oracle. something like... (1 Reply)
Discussion started by: newuser100
1 Replies

2. UNIX for Advanced & Expert Users

ftp in Shellscript

Can I do something like this from a shellscript ?: ftp 12.34.56.78 <<! username password put a.c bye ! It does not go through as the login fails. Is there any alternative to do the above requirement? Thanks in advance. Gowrish (3 Replies)
Discussion started by: ggowrish
3 Replies

3. Shell Programming and Scripting

Need help with shellscript

Hello. I am a novince at writing shell scripts but here is the question. I have to write a shell script that does the following: Once executed via crontab, the script should do the following: a. get date/time stamp in for format 10-MAR-05 and b. execute shell script my_script.sh (which... (2 Replies)
Discussion started by: jigarlakhani
2 Replies

4. Shell Programming and Scripting

Problems with storing oracle sqlplus query output shell script

Hello everyone, I have a RHEL 5 system and have been trying to get a batch of 3-4 scripts each in a separate variables and they are not working as expected. I tried using following syntax which I saw a lot of people on this site use and should really work, though for some reason it doesn't... (3 Replies)
Discussion started by: rockf1bull
3 Replies

5. Shell Programming and Scripting

Needed shellscript for the following

hi all, i need the shell script for he below requirement i had the input file as a_20121217_035120( frmat is a_date_hhmmss) a_20121217_035128 a_20121217_035456 a_20121217_035767 a_20121217_035178 a_20121217_035189 a_20121217_035220 my output should be a_20121217_035456... (0 Replies)
Discussion started by: hemanthsaikumar
0 Replies

6. Shell Programming and Scripting

Help with shellscript

I am new in shell script i want to convert .txt file in the format axsjdijdjjdk to a x s j d i j d j j d k (5 Replies)
Discussion started by: sreejithalokkan
5 Replies

7. Shell Programming and Scripting

Sqlplus error - sqlplus -s <login/password@dbname> : No such file or directory

i am using bash shell Whenever i declare an array, and then using sqlplus, i am getting sqlplus error and return code 127. IFS="," declare -a Arr=($Variable1); SQLPLUS=sqlplus -s "${DBUSER}"/"${DBPASS}"@"${DBASE} echo "set head off ; " > ${SQLCMD} echo "set PAGESIZE 0 ;" >> ${SQLCMD}... (6 Replies)
Discussion started by: arghadeep adity
6 Replies

8. Shell Programming and Scripting

Telnet shellscript

cat << EOF | telnet alt1.aspmx.l.google.com 25 HELO verify-email.org MAIL FROM: <check@verify-email.org> RCPT TO: <test@gmail.com> quit EOF Hello, I'm trying to get the result of that execution, and can not see the result or bring it to a txt ... the direct command in ssh running the result... (5 Replies)
Discussion started by: c0i0t3
5 Replies

9. Shell Programming and Scripting

Avoid $ symbol while calling sqlplus in shellscript.

Hi All, we have requirement, i am created a shell script , inside i am connecting sqlplus and execute the query. below my code for your reference. get_sqlid () { sqlid=$( sqlplus -s $PBDW_USERID/$PBDW_PW@$PBDW_SID <<EOF DEFINE TBLNAME=$1 set feedback off set serverout on size... (4 Replies)
Discussion started by: KK230689
4 Replies
ii(1)							      General Commands Manual							     ii(1)

NAME
ii - irc it or irc improved DESCRIPTION
ii is a minimalistic FIFO and filesystem based IRC client. It creates an irc directory tree with server, channel and nick name directo- ries. In every directory a FIFO file (in) and and normal file (out) is placed. This will be for example ~/irc/irc.freenode.net/. The in file is used to communicate with the servers and the out files includes the server messages. For every channel and every nick name there will be new in and out files. The basic idea of this is to be able to communicate with an IRC server with basic command line tools. For example if you will join a channel just do echo "/j #channel" > in and ii creates a new channel directory with in and out file. SYNOPSIS
ii [-s servername] [-p port] [-k password] [-i prefix] [-n nickname] [-f realname] OPTIONS
-s servername lets you override the default servername (irc.freenode.net) -p port lets you override the default port (6667) -k password lets you use a password to authenticate your nick on the server (be aware of the problem that this is visible in the process list, if you don't want this use a query to submit your password) -i prefix lets you override the default irc path (~/irc) -n nickname lets you override the default nick ($USER) -f realname lets you specify your real name associated with your nick DIRECTORIES
~/irc In this directory the irc tree will be created. In this directory you will find a directory for your server (default: irc.freen- ode.net) in which the FIFO and the output file will be stored. If you join a channel a new directory with the name of the channel will be created in the ~/irc/$servername/ directory. COMMANDS
/a [<message>] mark yourself as away /j #channel/nickname [<message>] join a channel or open private conversation with user /l #channel/nickname leave a channel or query /n nick change the nick name /t topic set the topic of a channel Everything which is not a command will simply be posted into the channel or to the server. So if you need /who just write /WHO as described in the RFC to the server in FIFO. out file usage Write wrappers, pagers or use your tools of choice to display the out file contents (loco, multitail, etc.). CONTACT
Write to ii (at) modprobe (dot) de for suggestions, fixes, 7|-|>< ;) etc. AUTHORS
Copyright (C) 2005-2006 by Anselm R. Garbe <garbeam (at) gmail (dot) com> and Copyright (C) 2005-2008 by Nico Golde <nico (at) ngolde (dot) de> SEE ALSO
echo(1), tail(1), ii(1)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy