View previous topic :: View next topic
|
Author |
Message |
ravikumar15
New User
Joined: 27 Mar 2006 Posts: 68
|
|
|
|
I am using SEARCH ALL in one of my program. For SEARCH ALL, the data should be in Ascending or decending order. I just want to know, if we dont sort the data, will we get any error or the SEARCH ALL does not function properly. |
|
Back to top |
|
|
dnreddy
New User
Joined: 08 Dec 2006 Posts: 8 Location: chennai
|
|
|
|
Hi ravi
SEARCH - is a serial search.
SEARCH ALL - is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) before using SEARCH ALL.
What should be the sorting order for SEARCH ALL
It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).
|
|
Back to top |
|
|
ravikumar15
New User
Joined: 27 Mar 2006 Posts: 68
|
|
|
|
I know that. My question is, suppose if the data is not sorted, will we get error. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
From the Language Reference
Quote: |
The results of a SEARCH ALL operation are predictable only when:
v The data in the table is ordered in ASCENDING/DESCENDING KEY order
v The contents of the ASCENDING/DESCENDING keys specified in the WHEN clause provide a unique table reference. |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Follow the Search rules or possibly get invalid results - it may not actually fail, just give the wrong result. There is no suppose the data is not sorted. |
|
Back to top |
|
|
|