Result set is forward array.but iwant reverse array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shivapadma
    New Member
    • Mar 2007
    • 40

    Result set is forward array.but iwant reverse array

    Result set contains the records of database in forward.But,i want to retrieve records in reverse order.
    what should i do?
    please someone help me to solve this problem.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Oracle does not support this .

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      Originally posted by shivapadma
      Result set contains the records of database in forward.But,i want to retrieve records in reverse order.
      what should i do?
      please someone help me to solve this problem.
      What is that result set (java prepared statement, or oracle cursor??) and could you please provide your query here for our expert's reference??

      Can you also look at using ORDER BY DESC clause hat would reverse the data as required??

      Comment

      • shivapadma
        New Member
        • Mar 2007
        • 40

        #4
        ResultSet rs=st.executeQu ery("select name from table");

        (suppose)the table is:

        name rollno
        abc 1a12
        pqr 212




        After executing the query the results are going to be stored in rs(ResultSet).

        The results are going to be stored : (abc) as first record and (pqr) as second record.


        But I want (pqr) as first record and (abc) as second record,then what should i do?


        please reply to this...

        Comment

        • amitpatel66
          Recognized Expert Top Contributor
          • Mar 2007
          • 2358

          #5
          Originally posted by shivapadma
          ResultSet rs=st.executeQu ery("select name from table");

          (suppose)the table is:

          name rollno
          abc 1a12
          pqr 212




          After executing the query the results are going to be stored in rs(ResultSet).

          The results are going to be stored : (abc) as first record and (pqr) as second record.


          But I want (pqr) as first record and (abc) as second record,then what should i do?


          please reply to this...
          Try something like :

          Code:
          ResultSet rs=st.executeQuery("select name from table ORDER BY name DESC");

          Comment

          • shivapadma
            New Member
            • Mar 2007
            • 40

            #6
            ResultSet rs=st.executeQu ery("select name from table ORDER BY name DESC");



            if we execute this query it will display the names in descending order i.e.,it will arrange the records in alphabetical order(z to a).

            but, i want the record which is last in the table as first record in my resultset and the record which is first in the table as last .

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              Go to the last record and keep moving to the previous record till BOF .

              Comment

              Working...