If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I have a simple script that pipes a query to SQL*Plus like this:
ne=`<< END_SQL
SELECT
Names
FROM
MyTable
;
EXIT
END_SQL`
nq=`echo "$ne" |sqlplus -s usr/pwd`
now I'm trying to modify the script in order to use a parameter in the query but I haven't found out a way to do it. Is it possible? Basically the problem is how to pipe into sqlplus a query like the following:
ne=`<< END_SQL
SELECT
Names
FROM
MyTable
WHERE
Names = '&1'
;
EXIT
END_SQL`
thanks for the reply, that works but I'd like to avoid saving the script to a file. Is it possible to have the sql statement stored in a variable and pass it to sqlplus together with the parameter?