Skip to Content
author's profile photo Former Member
Former Member

select single and select upto

what is the difference of select single and select upto statements

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

22 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 15, 2007 at 04:56 AM

    > what is the difference of select single and select

    > upto statements

    The difference between select single and select upto 1 row is usage of buffer area.

    select single will search all the match records and bring it to buffer, form there we get it. Processing time is large here. If we use select upto 1 row, it will fetch the particular single record and move it to the buffer .Processing time is less compared to select single statement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 04, 2007 at 02:17 PM

    In select single * the primary key is must in where clause

    while this is not the case with upto 1 row

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 19, 2007 at 06:29 PM

    SELECT SINGLE selects only single record from the databasetable depending on your where clause.

    where as select upto n rows selects all the records from the database but displays only n records.

    so its better to use select single.

    reward points if useful.

    sagarika

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2007 at 01:39 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2007 at 01:40 PM

    Hi anjali,

    have a look in search forum u will get that

    regards

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 03, 2007 at 01:41 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 03, 2007 at 01:42 PM

    Hi,

    SELECT SINGLE is an option we use only when we know the full key of the table, not when we know that there will be only one record. So if you are selecting from MARA and your WHERE condition has MATNR in it, then you should use SELECT SINGLE. But if your WHERE condition has BISMT(old material number) and even if you know that it will result in one record only, you should not use SELECT SINGLE. It is not that it will give you an error but if you do an extended check, there it will show it as a warning saying that you didn't use the full key and that there is a possibility that there could be more than one record.

    SELECT UP TO 1 ROWS is used when you are not passing the key field, but you know 1)there will be only one record or 2)all records will have the same value for the selected field. Let us say you are selecting from MARC and you are interested in the value of the field ABC indicator. You know, based on your business process, that this indicator will have the same value even though, it is extended to 10 plants. Then you can use SELECT ABCIN FROM MARC UP TO 1 ROWS WHERE MATNR = P_MATNR. ENDSELECT. Here, even though you are not supplying the second key field WERKS, since you know there will only be one value(even though there are multiple records fetched with this clause), you are using SELECT UP TO 1 ROWS. In the other example where you select from MARA using BISMT, there it might fetch you just one record and so you will still use SELECT UP TO 1 ROWS.

    SELECT UP TO 1 ROWS introduces a loop to fetch one record from your database, where as SELECT SINGLE doesn't.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2007 at 01:42 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2007 at 03:46 PM

    select single - displays a single record matching your condition in the where statement

    select upto - you can make any number of records to be selected

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 04, 2007 at 12:54 PM

    Hi,

    SELECT UP TO 1 ROWS introduces a loop to fetch one record from your database, where as SELECT SINGLE doesn't.

    and in SELECT SINGLE query it is not mandatory to mention primary key fields in where condition , where as in SELECT UPTO 1 ROW query it is mandatory to use primary key fields in where clause...

    Hope u got my point...

    Regards,

    kishor.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.