![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| getting variable inside awk | subin_bala | Shell Programming and Scripting | 1 | 06-05-2008 04:21 AM |
| Sed , Replace a "variable text" inside of a statement | jackn7 | Shell Programming and Scripting | 4 | 03-04-2008 03:40 PM |
| passing a variable inside a variable to a function | KingVikram | UNIX for Dummies Questions & Answers | 2 | 01-14-2008 08:28 PM |
| Replace variable with a user defined variable | ce124 | Shell Programming and Scripting | 1 | 04-15-2007 02:56 PM |
| ksh: A part of variable A's name is inside of variable B, how to update A? | pa3be | Shell Programming and Scripting | 4 | 03-30-2005 11:29 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to replace variable inside the variable
hi sir,
i need your help for this script Quote:
select * from invoice where bill_date=$BILLDATE and startNum=$STARTPARTNNUM and total_partn=$TOTALPARTN if i just paste this replace with the $SCRIPT it works great,if i put script other place with with the variable,and put in the varaible script,it not works because the variable is not subtitute.. can anyone help me to solve this problem,i need to replace it with the parameter given here |
|
||||
|
try replacing $script by cat /rnmucdr/ednms05/ken/xMNBDF045_Script.sql
like this Code:
USERID=username/passwd
BILLDATE=19-FEB-07
STARTPARTNNUM=101
TOTALPARTN=20
SQLLOG=${BILLDATE}_xMNBDF045_P_CTEL.log
SCRIPT=`cat /rnmucdr/ednms05/ken/xMNBDF045_Script.sql`
sqlplus -s $USERID > $SQLLOG << EOF
WHENEVER SQLERROR EXIT 1
cat /rnmucdr/ednms05/ken/xMNBDF045_Script.sql
EOF
if [ $? -ne 0 ]
then
cat $SQLLOG
else
echo "SUCCESSFULLY FINISHED" > $SQLLOG
fi
|
|
||||
|
Add slash
Code:
select \* from invoice where bill_date=$BILLDATE and startNum=$STARTPARTNNUM and total_partn=$TOTALPARTN Code:
SCRIPT=`cat /rnmucdr/ednms05/ken/xMNBDF045_Script.sql` Code:
SCRIPT=$( eval echo $(cat /rnmucdr/ednms05/ken/xMNBDF045_Script.sql)) |
|
||||
|
here is the code
Code:
USERID=USER/pass
SCRIPTFILE=/rnmucdr/ednms05/ken/xMNBDF045_Script.sql
BILLDATE=19-FEB-07
STARTPARTNNUM=101
TOTALPARTN=20
SQLLOG=${BILLDATE}_xMNBDF045_P_CTEL.log
echo $SQLLOG
echo $SCRIPTFILE
SCRIPT=$( eval echo $(cat $SCRIPTFILE))
sqlplus -s $USERID > $SQLLOG << EOF
WHENEVER SQLERROR EXIT 1
$SCRIPT
EOF
if [ $? -ne 0 ]
then
cat $SQLLOG
else
echo "SUCCESSFULLY FINISHED" > $SQLLOG
fi
Code:
create table acct_to_print_bak as select BILL_DATE,ACCT_NO,STATUS_CODE,floor((ROWNUM-1)/N)+$STARTPARTNNUM BP_PARTN_NUM,SYS_APPL_ID FROM ( select T1.BILL_DATE,T1.ACCT_NO,T1.STATUS_CODE,T1.BP_PARTN_NUM,T1.SYS_APPL_ID,T3.N from acct_to_print t1,inv_acct_bill_addr T2 ,(select ceil(count(*)/$TOTALPARTN) N from inv_acct_bill_addr) T3 where t2.bill_date='$BILLDATE' and t2.bill_date=t1.bill_dat e and t1.ACCT_NO=t2.ACCT_NO order by T2.postal_code ) T4; commit; truncate table acct_to_print; insert into acct_to_print (select * from acct_to_print_bak); commit; drop table acct_to_print_bak; |
|
||||
|
what's the error you are getting from my code???? And also, remember all the multiple lines will be converted to one line when assignint it to a variable.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|