Ok, I found the bug. Just re-read ch 5 page 5-4 Understanding Associative Arrays (Index-By Tables).
The problem was here: if rdt_type.exists(c1_rec.rdt) then null; else rdt_type(ctr) := c1_rec.rdt; end if; This should have been: if rdt_type.exists(c1_rec.rdt) then null; else rdt_type(c1_rec.rdt) := c1_rec.rdt; end if; Now my hash works and has unique values. mohammed --- mkb <[EMAIL PROTECTED]> wrote: > I've been trying to create a hash table using PL/SQL > but I seem to be running into some trouble. Hoping > someone can point me in the right direction. I've > been using PL/SQL Users Guide and Reference Ch 5 as > a > guide. > > I have the following piece of code: > > declare > > cursor c1_cur is > select * from load_tab; > > type rdt_rec_type is table of varchar2(30) index > by > varchar2(30); > rdt_type rdt_rec_type; > > begin > open c1_cur; > loop > fetch c1_cur into c1_rec; > exit when c1_cur%notfound; > > if rdt_type.exists(c1_rec.rdt) > then > null; > else > rdt_type(ctr) := c1_rec.rdt; > end if; > > end loop; > > end; > / > > My goal is to have only those values in the hash > table > (rdt values) that are not dups. I was hoping that > object.exists(value) would work, but apparently I > seem > to be getting everything in my hash. > > Any ideas how I can code this? > > thanks > > mohammed > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to > Outlook(TM). > http://calendar.yahoo.com > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > -- > Author: mkb > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > San Diego, California -- Mailing list and web > hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: mkb INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).