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!

select * from table where comumn in (string)?

Status
Not open for further replies.

nzcam

Programmer
Mar 5, 2003
36
NZ
Hi,

I have a select statement that is currently doing this

Select *
from product
where product_reference in ('prod1','prod2');

What I would like to do is change the ('prod1','prod2') to a single string (or even better an array ) that holds all the product codes that I require?

can anyone help?

Thanks

cam
 
Several Options

1. Use Dynamic cursor , so u can make ur full statement in string and opem it later

2. make a function which checks the prod_reference in array

Select *
from product
where if_exists(product_reference, array) =1

so the function if exists can be

function if_exists ( ar_prod, array) return number
as
begin
--search the ar_prod in array and return 1 if found else ----return 0
end ;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top