![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to accomplish this: estimates=`sqlplus -s $user/${password} << " *EOF" * set heading off feedback off verify off timing off * SELECT count(*) * FROM daily_estimates * WHERE TO_CHAR(date_appended,'YYYYMMDD') = '$yyyymmdd'; * exit * EOF` I get nothing. *If I hard code an actual date in there, it works fine. *Why is Oracle not resolving the variable? *I've seen this on many pages and it works fine there....... Oracle 10g R2. *Using ksh...... Many thanks! |
#3
| |||
| |||
|
|
I'm trying to accomplish this: estimates=`sqlplus -s $user/${password} << " *EOF" * set heading off feedback off verify off timing off * SELECT count(*) * FROM daily_estimates * WHERE TO_CHAR(date_appended,'YYYYMMDD') = '$yyyymmdd'; * exit * EOF` I get nothing. *If I hard code an actual date in there, it works fine. *Why is Oracle not resolving the variable? *I've seen this on many pages and it works fine there....... Oracle 10g R2. *Using ksh...... Many thanks! |
#4
| |||
| |||
|
|
On Jul 16, 2:03*pm, The Magnet <a... (AT) unsu (DOT) com> wrote: I'm trying to accomplish this: estimates=`sqlplus -s $user/${password} << " *EOF" * set heading off feedback off verify off timing off * SELECT count(*) * FROM daily_estimates * WHERE TO_CHAR(date_appended,'YYYYMMDD') = '$yyyymmdd'; * exit * EOF` I get nothing. *If I hard code an actual date in there, it works fine. *Why is Oracle not resolving the variable? *I've seen this on many pages and it works fine there....... Oracle 10g R2. *Using ksh...... Many thanks! Oddly, this also works: yyymmdd=`date` user=xxx password=yyy echo $user echo $password echo $yyymmdd estimates=`sqlplus -s $user/${password} <<EOF * set heading off feedback off verify off timing off * SELECT count(*),'blorf','$yyymmdd' * FROM dual; * exit * EOF * ` echo $estimates The issue is that (per Unix Power Tools) white space and newlines both become argument separators when in backquotes. *That's why you can put a command that outputs things on separate lines in backquotes and they are treated as though they are parameters on the same line. *That's not the trick I thought I was about to remember. *That's not how I always thought putting quotes around a hereis delimiter worked - when I first started this second post, I had thought a backslash was necessary on the line before the EOF to force the newline not to be like whitespace. *Learn something new every day. jg -- @home.com is bogus.http://blog.mozilla.com/security/200...vascript-vulne... |
#5
| |||
| |||
|
|
On Jul 16, 2:03*pm, The Magnet <a... (AT) unsu (DOT) com> wrote: I'm trying to accomplish this: estimates=`sqlplus -s $user/${password} << " *EOF" * set heading off feedback off verify off timing off * SELECT count(*) * FROM daily_estimates * WHERE TO_CHAR(date_appended,'YYYYMMDD') = '$yyyymmdd'; * exit * EOF` I get nothing. *If I hard code an actual date in there, it works fine. *Why is Oracle not resolving the variable? *I've seen this on many pages and it works fine there....... Oracle 10g R2. *Using ksh...... Many thanks! Oddly, this also works: yyymmdd=`date` user=xxx password=yyy echo $user echo $password echo $yyymmdd estimates=`sqlplus -s $user/${password} <<EOF * set heading off feedback off verify off timing off * SELECT count(*),'blorf','$yyymmdd' * FROM dual; * exit * EOF * ` echo $estimates The issue is that (per Unix Power Tools) white space and newlines both become argument separators when in backquotes. *That's why you can put a command that outputs things on separate lines in backquotes and they are treated as though they are parameters on the same line. *That's not the trick I thought I was about to remember. *That's not how I always thought putting quotes around a hereis delimiter worked - when I first started this second post, I had thought a backslash was necessary on the line before the EOF to force the newline not to be like whitespace. *Learn something new every day. jg -- @home.com is bogus.http://blog.mozilla.com/security/200...vascript-vulne... |
#6
| |||
| |||
|
|
I'm trying to accomplish this: estimates=`sqlplus -s $user/${password} << " EOF" set heading off feedback off verify off timing off SELECT count(*) FROM daily_estimates WHERE TO_CHAR(date_appended,'YYYYMMDD') = '$yyyymmdd'; exit EOF` I get nothing. If I hard code an actual date in there, it works fine. Why is Oracle not resolving the variable? I've seen this on many pages and it works fine there....... Oracle 10g R2. Using ksh...... |
![]() |
| Thread Tools | |
| Display Modes | |
| |