Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Can you tell how to Sort in Oracle DB?

Can you tell how to Sort in Oracle DB?

Scheduled Pinned Locked Moved Database
databaseoracletutorialquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    openboy2010
    wrote on last edited by
    #1

    using RowNum? who can tell me the RowId in last Column? what's effect?

    B 1 Reply Last reply
    0
    • O openboy2010

      using RowNum? who can tell me the RowId in last Column? what's effect?

      B Offline
      B Offline
      badprog
      wrote on last edited by
      #2

      openboy2010 wrote:

      using RowNum?

      SELECT ROWNUM, T.*
      FROM TEST_TABLE T
      ORDER BY ROWNUM

      openboy2010 wrote:

      who can tell me the RowId in last Column?

      SELECT C.ROWYOURBOAT
      FROM
      (SELECT COUNT(*) AS ROWCOUNT
      FROM TEST_TABLE T
      ) A,
      (SELECT ROWNUM AS ROWCOUNT, ROWID AS ROWYOURBOAT
      FROM TEST_TABLE T
      ORDER BY ROWNUM
      ) C
      WHERE A.ROWCOUNT = C.ROWCOUNT

      openboy2010 wrote:

      what's effect?

      I don't know what your are asking here...

      :)

      modified on Thursday, December 30, 2010 11:03 AM

      O 1 Reply Last reply
      0
      • B badprog

        openboy2010 wrote:

        using RowNum?

        SELECT ROWNUM, T.*
        FROM TEST_TABLE T
        ORDER BY ROWNUM

        openboy2010 wrote:

        who can tell me the RowId in last Column?

        SELECT C.ROWYOURBOAT
        FROM
        (SELECT COUNT(*) AS ROWCOUNT
        FROM TEST_TABLE T
        ) A,
        (SELECT ROWNUM AS ROWCOUNT, ROWID AS ROWYOURBOAT
        FROM TEST_TABLE T
        ORDER BY ROWNUM
        ) C
        WHERE A.ROWCOUNT = C.ROWCOUNT

        openboy2010 wrote:

        what's effect?

        I don't know what your are asking here...

        :)

        modified on Thursday, December 30, 2010 11:03 AM

        O Offline
        O Offline
        openboy2010
        wrote on last edited by
        #3

        the last sentence means what's the RowId's effect?

        B 1 Reply Last reply
        0
        • O openboy2010

          the last sentence means what's the RowId's effect?

          B Offline
          B Offline
          badprog
          wrote on last edited by
          #4

          The RowID's affect on what?

          :)

          O 1 Reply Last reply
          0
          • B badprog

            The RowID's affect on what?

            :)

            O Offline
            O Offline
            openboy2010
            wrote on last edited by
            #5

            if we sort a table ,can we using the RowID sort ? I'm a Chinese Student,My Written English is not very well.

            B 1 Reply Last reply
            0
            • O openboy2010

              if we sort a table ,can we using the RowID sort ? I'm a Chinese Student,My Written English is not very well.

              B Offline
              B Offline
              badprog
              wrote on last edited by
              #6

              openboy2010 wrote:

              My Written English is not very well.

              That's ok it is good enough, I just wanted clarification so I can answer your homework question appropriately. RowID is a column generated by oracle to map to that particular row. If you sort by RowID instead of RowNum, the results may not be the same. RowNum is a column generated by Oracle from the RESULTS of the Select Query.

              :)

              O 1 Reply Last reply
              0
              • B badprog

                openboy2010 wrote:

                My Written English is not very well.

                That's ok it is good enough, I just wanted clarification so I can answer your homework question appropriately. RowID is a column generated by oracle to map to that particular row. If you sort by RowID instead of RowNum, the results may not be the same. RowNum is a column generated by Oracle from the RESULTS of the Select Query.

                :)

                O Offline
                O Offline
                openboy2010
                wrote on last edited by
                #7

                thank you

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups