Hello,
I have a script to run a list of customer information, but it not work. can anyone help below:
echo "Please input list to check customer detail:"
read list
for file in 'cat $list.txt'
do
echo "select cuname as "FROM CUNAME", invo_num as "RECS", total_amount as "AMOUNT", tax_amount as "TAX", CUSTOMERNAME as "INTO CUSTOMER", status, original_amount from cuname_2 where CUNAMEin '$file' ;"|sqlplus4 >> output.txt
done
I think you have to escape all the quote characters inside the statement:
echo "select cuname as \"FROM CUNAME\", invo_num as \"RECS\", total_amount as \"AMOUNT\", tax_amount as \"TAX\", CUSTOMERNAME as \"INTO CUSTOMER\", status, original_amount from cuname_2 where CUNAMEin '$file' ;"|sqlplus4 >> output.txt
It's still not work.
nothing in the output.txt
If I just copy the startment below, it work ok.
echo "select cuname as \"FROM CUNAME\", invo_num as \"RECS\", total_amount as \"AMOUNT\", tax_amount as \"TAX\", CUSTOMERNAME as \"INTO CUSTOMER\", status, original_amount from cuname_2 where CUNAME in 'Tom';"|sqlplus4 >> output.txt
if you want use the oracle SQL query in shell script before that we have to connect the Oracle using sqlplus command with user name, password with respective oracle server host string.
Then you can use your query with appropriate format and you have to exit from sqlplus prompt using exit;