PDA

View Full Version : table type, table of number is slow when selected from


Guest
03-24-2005, 02:23 PM
I have created a table type called num_tab as table of numbers.
(create type num_tab as table of number)
I use this table type in a function to temporary store a list of
numbers which is used in a where clause of a separet query. It works
fine, but it is slow. Can the type be indexed? Is there something
better to use? Thanks.
Here is how I use it:
select dbctr bulk collect into v_numtab
from custom_list_d
where dbkey = dbctr_passedin;

select sum(dbsand)
into v_count
from usage_summary
where dbtype = 's'
and dbctr IN (select * from table(v_numtab))
and dbweek > 0
and dbyearperweek >= v_start_year_period
and dbyearperweek <= v_end_year_period;

Sybrand Bakker
03-26-2005, 02:49 AM
On 24 Mar 2005 14:23:28 -0800, jeffchirco@gmail.com wrote:
I have created a table type called num_tab as table of numbers.(create type num_tab as table of number)I use this table type in a function to temporary store a list ofnumbers which is used in a where clause of a separet query. It worksfine, but it is slow. Can the type be indexed? Is there somethingbetter to use? Thanks.Here is how I use it: select dbctr bulk collect into v_numtab from custom_list_d where dbkey = dbctr_passedin; select sum(dbsand) into v_count from usage_summary where dbtype = 's' and dbctr IN (select * from table(v_numtab)) and dbweek > 0 and dbyearperweek >= v_start_year_period and dbyearperweek <= v_end_year_period;

Any reason why you can't use an ordinary subquery. Right now you are
splitting up one statement into two! How would that be efficient?
Rather tune the original statement!


--
Sybrand Bakker, Senior Oracle DBA


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service