Application Development and Automation 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: 
Read only

Select for a hashed table

Former Member
0 Likes
2,204

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
Read only

Former Member
0 Likes
1,309

[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
Read only

Former Member
0 Likes
1,310

[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.

Read only

0 Likes
1,309

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

Read only

0 Likes
1,309

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