Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> ksh scrip to include various sql commands and rownum

ksh scrip to include various sql commands and rownum

From: Bilal <bjeewa_at_hotmail.com>
Date: 18 Jan 2004 23:50:50 -0800
Message-ID: <f9882c89.0401182350.5a543290@posting.google.com>


Hi,

I'm very new to ksh, unix and oracle (bad combination for this task!!). I'm trying to include several insertion sql commands in a ksh script and after each insertion I would like to store the number of lines inserted into a variable. e.g
This is my attempt so far but its not working. I doubt it is efficient and I'm not too sure about the syntax:

sqlplus - silent "$USERNAME/$PASSWORD@$DATASTORE" <<EOF set pagesize 0 feedback off verify off heading off echo off

insert into ALARM_ARC (select * from ALARM where ID_ALARM = 6); row_num_6=`SQL%ROWCOUNT`;
insert into ALARM_ARC (select * from ALARM where ID_ALARM = 105); row_num_105=`SQL%ROWCOUNT`;
insert into ALARM_ARC (select * from ALARM where ID_ALARM = 96); row_num_96=`SQL%ROWCOUNT`;

echo "Number of rows inserted is for ID 6 is "$row_num_6;
echo "Number of rows inserted is for ID 96 is "$row_num_96;
echo "Number of rows inserted is for ID 105 is "$row_num_105;
EXIT;
EOF; My constraint is that the script must not call any other sql files or ksh scripts. It must be completely self contained. I thank you and appreciate any help.
Thanks
Bilal Received on Mon Jan 19 2004 - 01:50:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US