Home » SQL & PL/SQL » SQL & PL/SQL » variable from shell to sqlplus
variable from shell to sqlplus [message #184006] Mon, 24 July 2006 18:10 Go to next message
mcarrasco
Messages: 2
Registered: July 2006
Junior Member
hello experts
Forgive if my question is silly.

My case is the following one..

I need to do a shell that allows me to capture a date in a variable, this variable I must use it as parameter in a query of sqlplus and it must to me throw some results.

But the problem is that i don't know how the variable of the shell uses or to assign in the query of sqlplus

mi code is..

_______________________
Ret.sh

echo Insert the date
read fecha2 this is the variable that i need in sqlplus
sqlplus user/pwd@inst<RETIROS.sql
exit
_______________________________

RETIROS.SQL

DEFINE fecha
fecha=$fecha2

SELECT LIMIT_WD_BASE AS BASE,LIMIT_WD_REAL AS REAL,LIMIT_WD_USED AS USADO,(LIMIT_WD_BASE+(LIMIT_WD_BASE-LIMIT_WD_USED)) AS REAL_PROX_MES FROM LIMIT_CARD WHERE DATE_LAST='&fecha';(here is that i need evaluate the variable from shell)

thank tou for you help.

[Updated on: Mon, 24 July 2006 18:11]

Report message to a moderator

Re: variable from shell to sqlplus [message #184008 is a reply to message #184006] Mon, 24 July 2006 18:25 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
http://www.faqs.org/docs/abs/HTML/here-docs.html
Re: variable from shell to sqlplus [message #184222 is a reply to message #184006] Tue, 25 July 2006 14:58 Go to previous message
mcarrasco
Messages: 2
Registered: July 2006
Junior Member
thank you Smile

[Updated on: Tue, 25 July 2006 14:58]

Report message to a moderator

Previous Topic: Sql error ORA-00904 invalid identifier
Next Topic: Decode, NVL or which do I use?
Goto Forum:
  


Current Time: Thu Dec 08 20:00:32 CST 2016

Total time taken to generate the page: 0.23069 seconds