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

abdulazeez12
Active Contributor
0 Likes
599

hi friends, can anyone pls explain to me, when we use select single* and when we use select *...what are the differences in both of them..thanks all

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
579

SELECT SINGLE returns the first matching row for the given condition and it may not be unique, if there are more matching rows for the given condition.

The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.

It is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search.

Have a look at below link.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select_c.htm

SELECT * is generally used to get the values of all fields from the datbase table. Have a lok at below links.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select.htm

http://dev.mysql.com/doc/maxdb/en/b8/5ebdd7e252e542a0bde26a583a9980/content.htm

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

5 REPLIES 5
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
579

Hi,

SELECT SINGLE is used when you know what you want to get from the database, that is when you have the full Primary key of the table.

SLECT is used to get more data from the table based on some where clause.

In select single you take the data into a structure.

in select* you take the data into a internal table. using the INTO TABLE.

For SELECT SINGLE if you use full primary key in the WHERE clause there is chance that you get the data fastly if the table is buffered with single record buffering. Other wise every query hits the database.

Regards,

Sesh

Read only

Former Member
0 Likes
580

SELECT SINGLE returns the first matching row for the given condition and it may not be unique, if there are more matching rows for the given condition.

The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.

It is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search.

Have a look at below link.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select_c.htm

SELECT * is generally used to get the values of all fields from the datbase table. Have a lok at below links.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select.htm

http://dev.mysql.com/doc/maxdb/en/b8/5ebdd7e252e542a0bde26a583a9980/content.htm

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
579

Hi,

Select single * is used to get a "single value" for all the fields in the table based on the key fields.

But Select * is used to get all the values of the field based on the where condidtion on the table.

Regards,

George

Read only

abdulazeez12
Active Contributor
0 Likes
579

Thanks all and Vibha, urs was the most helpful answer, the links were also infomative, can u tell me when we use select endselect and select *....

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
579

Hi,

Select Endselect is a loop. You use this to read one row at a time from the database into your workarea. (This is less performance query).

Where as SELECT INTO TABLE is an array fetch. This is more performance query.

Example:

select * from tab into wa where <cond>.

  • do some processing here for all the rows that

satisfy the where clause.

append wa to itab.

endselect.

Avoid using slect endselect as you can get the data into a table using SELECT * INTO TABLE and then LOOP ENDLOOP over this internal table.

Regards,

Sesh