select statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhaski
    New Member
    • Jun 2007
    • 2

    select statement

    i found a code like ----

    CURSOR check_options IS
    SELECT 1
    FROM PURCHASE_ORDER_ OPTION
    WHERE order_no = order_no_
    AND line_no = line_no_
    AND release_no = release_no_;

    i cannot understand why select 1 is taken

    simply by select 1 ony 1 is only selected though there are values in table.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    it might be the user want to show the number of records where these field sare matching.

    but there is nosense writing such a cursor.

    Comment

    • bhaski
      New Member
      • Jun 2007
      • 2

      #3
      but why generally 1 in select statement is used? i have seen it in many other statements.

      Comment

      • Saii
        Recognized Expert New Member
        • Apr 2007
        • 145

        #4
        Originally posted by bhaski
        but why generally 1 in select statement is used? i have seen it in many other statements.
        just to display that there are some rows in table for these filters

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by debasisdas
          it might be the user want to show the number of records where these field sare matching.

          but there is nosense writing such a cursor.
          Yep, this returns at least one record in the table because the fields being compared are the same anyway. It can be used perhaps to check if the table is empty ...

          Comment

          Working...