Sponsored Content
Top Forums Shell Programming and Scripting PROBLEM WITH ORACLE QUERY IN UNIX SCRIPT Post 302533580 by apple2685 on Friday 24th of June 2011 06:12:00 AM
Old 06-24-2011
PROBLEM WITH ORACLE QUERY IN UNIX SCRIPT

hi Guys,

i have a problem with oracle query in my unix script..

I'm getting the following error while executing..

./logtab.sh: sqlplus -s "pmutv/pmutv1" << EOFSQL^Jset head off^Jinsert into sess_log(SESSION_NAME,WORKFLOW_NAME,START_TIMESTAMP,SESSION_STATUS,OUTPUT,REJECT)values(smLoadTesUha tgdb1FelkodMan,bLoadTesDomainMan,20110112,Success,36,36);^J^Jexit;^JEOFSQL: not found

enitire code is below
Code:
 
#!/bin/sh
###########################################
#                                         #
#  THIS SCRIPT FETCHES THE INFORMATION    #
#  FROM THE INFORMATICA LOG FILE AND      #
#  LOADS THE DATA IN TO THE SESS_LOG_TAB  #
#                                         #
###########################################
find /export/home/pmutv/data/  -type f -name *.4 -print > /export/home/pmutv/auto/LogFiles.txt
for i in `cat /export/home/pmutv/auto/LogFiles.txt | cut -f6 -d"/"`
  do
SESSION_NAME=`cat /export/home/pmutv/data/$i | head -1 | awk '{print $3}' | cut -f2 -d"[" |cut -f1 -d"]"`
WORKFLOW_NAME=`grep -w Workflow /export/home/pmutv/data/$i | awk '{print $4}' | cut -f2 -d"[" | cut -f1 -d"]"`
START_TIMESTAMP=`grep -iw "load start time" /export/home/pmutv/data/$i | cut -c 18-41 |  cut -f2,3,5 -d" " | sed 's/ //g'`
SESSION_STATUS=`cat /export/home//pmutv/data/$i | tail -1 | awk '{print $5}'`
OUTPUT=`grep -iw "output rows" /export/home/pmutv/data/$i | head -1 | cut -f1 -d"," | cut -f4 -d" " | cut -f2 -d"[" | cut -f1 -d"]"`
REJECTED=`grep -iw "output rows" /export/home/pmutv/data/$i | head -1 | cut -f1 -d"," | cut -f4 -d" " | cut -f2 -d"[" | cut -f1 -d"]"`
start_date=$START_TIMESTAMP
 New_date=`nawk -v Date=${start_date} '
 BEGIN { Months="  JanFebMarAprMayJunJulAugSepOctNovDec"
 year = substr(Date, 6, 4) + 0;
 day = substr(Date, 4, 2) + 0;
 month = index(Months, substr(Date, 1, 3))/3;
 printf "%04d%02d%02d", year, month, day;
 exit;
}
'`
if [ $SESSION_STATUS != "completed" ]; then
   SESSION_STATUS="Failed"
   else
   SESSION_STATUS="Success"
  fi
echo "Session Name------> $SESSION_NAME"
echo "Workflow name-----> $WORKFLOW_NAME"
echo "Load Start Time---> $New_date "
echo "Session Status----> $SESSION_STATUS"
echo "Inserts ----------> $OUTPUT"
echo "Rejects-----------> $REJECTED"
'sqlplus -s "pmutv/pmutv1" << EOFSQL
set head off
insert into sess_log values('$SESSION_NAME','$WORKFLOW_NAME','$New_date','$SESSION_STATUS','$OUTPUT','$REJECTED');
exit;
EOFSQL'
echo "$?"
done

THANKS IN ADVANCE Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script variable passed to Oracle query

Hi All, I pass a Perl script variable, whch is passed to a query to be prepared. But the problem is I have special character like '&' in this variable which are handled in a special way by the Oracle query parser. How do I get over this? my $cust_name='A&B'; my $sql="Select cust_short_name... (1 Reply)
Discussion started by: rahulrathod
1 Replies

2. Shell Programming and Scripting

Execute oracle query determined at runtime from a unix script

Hi I am trying to run a SQL statement from a unix script determined at runtime. It is throwing me an error. Please advise some solution to this. echo "Enter username for the database" read username echo "Enter password for the database" read password echo "Enter SQL stmt" read... (4 Replies)
Discussion started by: infyanurag
4 Replies

3. Shell Programming and Scripting

run oracle query remotly with shell script

hello how to run shell script to excute oracle queries on remote db ? i have tried as following sqlplus -s user/password@remote_server "select query;" but not working also this one sqlplus -s user/password@remote_server `select query;` not working :( i add this line to run another... (4 Replies)
Discussion started by: mogabr
4 Replies

4. Shell Programming and Scripting

Oracle Query results to be stored in variables using unix

I want to store the sql query output into a variable #!/bin/ksh ORACLE_SID=DB01; export ORACLE_SID; export FILE_PATH=/home/asg/Tmp # Order Checking echo " removing old files " rm $FILE_PATH/Malformed_Order.txt echo " Enter the Malformed Order ....!" read orders echo "Regrade... (5 Replies)
Discussion started by: Nareshp
5 Replies

5. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

6. Shell Programming and Scripting

Shell script to query Oracle table

Hi, unix gurnis I need help for following requirement for writing a shell scritp. log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file. Thanks in advance (2 Replies)
Discussion started by: ken002
2 Replies

7. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

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

9. Shell Programming and Scripting

How to run a SQL select query in Oracle database through shell script?

I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this? Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 Replies

10. Shell Programming and Scripting

Korn Script to connect and query oracle database

I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error: ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies
XCUTSEL(1)						      General Commands Manual							XCUTSEL(1)

NAME
xcutsel - interchange between cut buffer and selection SYNOPSIS
xcutsel [ -toolkitoption ...] [-selection selection] [-cutbuffer number] DESCRIPTION
The xcutsel program is used to copy the current selection into a cut buffer and to make a selection that contains the current contents of the cut buffer. It acts as a bridge between applications that don't support selections and those that do. By default, xcutsel will use the selection named PRIMARY and the cut buffer CUT_BUFFER0. Either or both of these can be overridden by com- mand line arguments or by resources. An xcutsel window has the following buttons: quit When this button is pressed, xcutsel exits. Any selections held by xcutsel are automatically released. copy PRIMARY to 0 When this button is pressed, xcutsel copies the current selection into the cut buffer. copy 0 to PRIMARY When this button is pressed, xcutsel converts the current contents of the cut buffer into the selection. The button labels reflect the selection and cutbuffer selected by command line options or through the resource database. When the ``copy 0 to PRIMARY'' button is activated, the button will remain inverted as long as xcutsel remains the owner of the selection. This serves to remind you which client owns the current selection. Note that the value of the selection remains constant; if the cutbuffer is changed, you must again activate the copy button to retrieve the new value when desired. OPTIONS
Xcutsel accepts all of the standard X Toolkit command line options as well as the following: -selection name This option specifies the name of the selection to use. The default is PRIMARY. The only supported abbreviations for this option are ``-select'', ``-sel'' and ``-s'', as the standard toolkit option ``-selectionTimeout'' has a similar name. -cutbuffer number This option specifies the cut buffer to use. The default is cut buffer 0. X DEFAULTS
This program accepts all of the standard X Toolkit resource names and classes as well as: selection (class Selection) This resource specifies the name of the selection to use. The default is PRIMARY. cutBuffer (class CutBuffer) This resource specifies the number of the cut buffer to use. The default is 0. WIDGET NAMES
The following instance names may be used when user configuration of the labels in them is desired: sel-cut (class Command) This is the ``copy SELECTION to BUFFER'' button. cut-sel (class Command) This is the ``copy BUFFER to SELECTION'' button. quit (class Command) This is the ``quit'' button. SEE ALSO
X(7x), xclipboard(1), xterm(1), text widget documentation, individual client documentation for how to make a selection. BUGS
There is no way to change the name of the selection or the number of the cut buffer while the program is running. AUTHOR
Ralph R. Swick, DEC/MIT Project Athena X Version 11 Release 6.6 XCUTSEL(1)
All times are GMT -4. The time now is 02:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy