| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
|
| Hi, im somewhat weak at pl/sql i usually do web programming but ive been asked to create a report which i think should be done in pl/sql to avoid killing the Database.basically, i need to run this query: select distinct ei.ID , ci.SOCIAL_INSURANCE_NUMBER , a.ADDRESS_TEXT , a.MUNICIPALITY_NAME , p.ENGLISH_ABBREVIATED_NAME P_Code , a.POSTAL_CODE , ei.CREATION_DATE , a.ADDRESS_TYPE__ID Residential_Code2 from ei_application ei , ei_client_individual ci , address a , province p Where ei.EI_CLIENT_INDIVIDUAL__ID = ci.id and ci.ADDRESS__ID_RESIDENTIAL = a.ID -- Residential and p.ID = a.PROVINCE__ID and ei.application_status__id <> 4 -- not deleted and a.POSTAL_CODE in (select * from table(pcArray)) -- 'B2T1H1'-- from excel file and ei.creation_date >= to_date('06/10/2008:12:00:00AM', 'mm/dd/yyyy:hh:mi:ssam') and ei.creation_date <= to_date('07/16/2008:05:59:00PM', 'mm/dd/yyyy:hh:mi:sspm')--5:59 Atantic = 4:59 ET order by ei.CREATION_DATE desc ; the "a.postal_code in (select. ..." is the problem. i don't want to use an in clause because i know its slow and ugly and also because the postal code list i have to match has close to 700 items. so im trying to use either a plsql table or a varray, whatever works. but its important that it can be included in the select statement attached, is the whole code i have made thus far, but it doesn't work, i have tried variations of it but never succeeded. in the sample i gave, im using a cursor, but i would really prefer doing a direct select (easier to export )im not asking for someone to type the code for me but if someone could point me in the right direction, id really appreciate it. (btw, the list of postal code is much smaller than my list because the forum would only let me upload 1.6kb text file) |
![]() |
| Thread Tools | |
| Display Modes | |