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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run SQL plus in batch mode whith parameter entries 1

Status
Not open for further replies.

outis

Programmer
Jun 20, 2001
21
MX
I all, I need to run a query to convert in csv but
I need to ask entry parameters. and then i need to manipulate those entries like this:

if the entry value= 0 then someVariable=""
else someVariable= "productType in("+1,2,3+")"

...
then
select fields from table where
&productType

I will apreciate if anyone can tellme how to do these or
tellme where to find tutorials to work whith sql files and command line extension.
I will apreciate your responese. Thanks
 
Hi Outis,

I believe you are asking something like this

Pseudocode ********
Get some value from user
If value is 'X' then
Condition 1
Elseif value is 'Y'
Condition 2
endif

Now the select query is
select <something>
from <some table>
where <condition 1 or codition 2>
End ******************

If this is the scenario then the code should be

Code:
accept var1 prompt 'Enter value for something : '
col a new_val cond1
select decode ('&var1', 0, '',
               'where productType in (<IN VALUES>)') a
from   dual;

select fields
from   table
&&cond1;

I could not get the meaning of ("+1,2,3+") so left it to you to fill it up.

Let us know if this works.

Regards,
Gunjan
 
Thanks Gunjan. for your help. yes this solutions is working now

I would like if you can give me a link or recomend me a book to learn about those type of scripts

 
Hi Outis,

You can get the ref material from


You can check the documentation from there. For example Oracle 8i SQLPLUS user guide
SQL*Plus User's Guide and Reference (book) you can refer.

Regards,
Gunjan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top