Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select for a hashed table

Former Member
0 Kudos

Hi All,

This is a repost but this time Ill be specific.

How do I select from a table into a hashed table faster without using "select distinct"? my primary concern is the speed of the select statement, and im afraid I cannot get rid of the hashed table destination.

Thanks,

Kenny

1 ACCEPTED SOLUTION

Former Member
0 Kudos

[code]select field1 field2 into table itab

from dbtab where cond.

Hashed tables don't take any duplicate record,

hence, we have to specify all the KEY FIELDS,when declaring the table.

3 REPLIES 3

Former Member
0 Kudos

[code]select field1 field2 into table itab

from dbtab where cond.

Hashed tables don't take any duplicate record,

hence, we have to specify all the KEY FIELDS,when declaring the table.

0 Kudos

Thanks Kishan,

Problem is Im only after one field from the dbtab. And this is not a unique key, thats why Im using select distinct now. Therefore, I am limited to it for selecting Unique rows. Please help.

Thanks.

Kenny

0 Kudos

HI Kenny,

HASHED TABLE:

There is no default setting for hashed tables. However, you must define a UNIQUE key. The NON-UNIQUE addition is not permitted.

You cannot avoid this statement. May be the alternative is You have to use SORTED table with NON-UNIQUE option and then apply DELETE ADJACENT DUPLICATES, in this way you can have unique values for your itab.

Regards,

Raghav