Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> ksh scrip to include various sql commands and rownum
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;
![]() |
![]() |