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 single * or SELECT * UP TO 1 ROWS

Former Member
0 Likes
3,995

hello,

can any one tell me using a query with

SELECT single *

into workarea

from DBtable

where < all fields in the index >

is better or

SELECT *

UP TO 1 ROWS

into warkarea

from DBtable

where < all fields in the index >

Thanks in advance

4 REPLIES 4
Read only

Former Member
0 Likes
808

performancewise they are identical

Use them for better understanding of the coding

SELECT SINGLE, if all keys of an unique index are specified with equal conditions,

i.e. 1 record expected one record read. Works still, if table is buffered.

SELECT UP TO 1 ROWS, special case of UP TO n ROWS, use it when more

rows could, but you are satisfied with one!

Does not work with buffers, but WHERE-condition does also not work with

a single record buffer.

Siegfried

Read only

Former Member
0 Likes
808

Hi,

Refer to this link..

Read only

Former Member
0 Likes
808

Performence wise both statements are not same.

The Major difference between Select Single and Select UPTO 1 rows is The Usage Of Buffer for each.

Select Single will search for all the satisfied data and bring all that data into Buffer and later it will give to that data to the program.

Select UPTO 1 Rows will end the search after getting the 1st satisfied record and gives that record to the program.

Thus Select Single will take much processing time when compare with Select UPTO 1 rows.

So performrnce wise it is always better to use select up to 1 rows.

Syntax.

select single * from mara into table itab

where condition.

select * from mara up to 1 rows into table itab

where condition.

Read only

Former Member
0 Likes
808

Please search before asking.

Rob