vendredi 10 août 2018

how to write parametrised query in oracle db

I have a basic requirement where I need to query database multiple time with same parameters i.e

Select * from Table1 where ID1 in (1,2,3,4,5) ;
Select * from Table2 where ID2 in (1,2,3,4,5) ;
Select * from Table3 where ID3 in (1,2,3,4,5) ;
Select * from Table4 where ID4 in (1,2,3,4,5) ;
Select * from Table5 where ID5 in (1,2,3,4,5) ;

Here I want something where I can declare variables and assign the values 1,2,3,4,5 and instead of changing the value again just need to change the variable values.

something like ..

Select * from Table1 where ID1 in (x,y,z,a,b);

it may turn up a very basic questions for you but can save my lot of rework.

Aucun commentaire:

Enregistrer un commentaire