Help needed with pl/sql table

This is a discussion on Help needed with pl/sql table within the Oracle Database forums in category; 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)) -- '...

Go Back   Database Forum > Oracle Database

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-23-2008, 10:05 AM
Default Help needed with pl/sql table

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)
Attached Files
File Type: txt plsql.txt (1.6 KB, 1 views)
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 07:56 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.