Hi All,
I have problem with database validations, actually my requirement is, my code will generate some seqno;s, which i have to check in database, whether the generated seqno;s are present in database or not, if the generated seqno;s are present in the database means, i need to generate new seqno;s skipping the found seqno;s in database, for this i have written code
Code:
p_no_seqno=5
tempa=1
p_seqno=232123210123
while [ $tempa -le $p_no_seqno ]
do
p_seqno=`expr $p_seqno + 1`
if [ $tempa -lt $p_no_barcode ]; then
d_seqno="${d_seqno}${p_seqno}",""
else
d_seqno="${d_seqno}${p_seqno}"
fi
tempa=`expr $tempa + 1`
done
barc=`sqlplus -s scott/tiger << EOF
WHENEVER SQLERROR EXIT 1
SET FEEDBACK OFF VERIFY OFF HEAD OFF ECHO OFF
SET SERVEROUTPUT OFF TIMING OFF
SET PAGES 0
select seq_no from temp where seq_no in ($d_seqno);
exit
EOF`
echo $barc
The Output for this will be
If only one seqno or no seqno found in database means,
No errors are displaying and the scripting is running fine
If more than one seqno found in database means,
It is showing the following error
seq_no.ksh[56]: test: 0403-004 Specify a parameter with this command
I tried store the values in a text file, but i am unable to retrieve the stored values by using the following code
Code:
echo $barc > testing.txt
The output of the testing.txt file when more records are there is
121313123123 123123123123 2342342342342
How to split the seqno;s and assign them to a array or variable
Thanks in Advance