Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run sql and pass variables..??

Status
Not open for further replies.

Vandy02

Programmer
Jan 7, 2003
151
US
Select wonum.....
WHERE......

I need to be able to do this as I have several processess that are similar....
I do not want to just modify the main sql....


MINSQL="SELECT NVL(MAX(TO_NUMBER(last_rowstamp)),0) FROM esmaximo.wdw_incr_rowstamp_pull
WHERE table_name = 'WOSTATUS' AND pull_status = 'C'"

MINRS=

MAXSQL="SELECT esmaximo.maxseq.nextval FROM dual"

MAXRS=


#MAIN SQL...

sqlplus esmaxbat/imagine >${ERRTMP} 2>&1 <<-sulplqs


spool /var/opt/oracle/mp4/maximart/wostatus.dat;
set linesize 110
select WONUM||'|'||
STATUS||'|'||
to_char(CHANGEDATE, 'yyyy-mm-dd hh24:mi')||'|'||
CHANGEBY||'|'||
MEMO||'|'||
GLACCOUNT||'|'||
FINCNTRLID||'|'||
ROWSTAMP
from WOSTATUS
WHERE TO_NUMBER(rowstamp) BETWEEN ${MINRS} AND ${MAXRS};
spool off;
 
Hi Vandy.
Have a look at FAQ 186-2220 (Oracle 8i) where a solution is given.
An easier way would be to put your code in a SQL*Plus commandfile and call that. You can pass parameters to such commandfiles too (if needed).

Stefan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top