Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Location
    18 Sur 3917
    Posts
    17

    Unanswered: Update Query by sort Systade

    Hi!!!!

    I dont know is this is possible by only a simple query, I have a several register un a historial table, but a I need to add a sequence but order by Sysdate

    I try it this query:

    update rh_emp_plaza_hist set hist_id= HIST_EMP_PLAZA_ID_SEQ.nextval order by(timestamp)

    but dosen´t work send me:
    ORA-000933 SQL Command not properly endend

    whitout order by(timestamp) works not in order.

    Regards...

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool



    You could try something like this:
    Code:
    Update Rh_Emp_Plaza_Hist E
       Set Hist_Id = (
       Select Rk From (
       Select Hist_Pkey, Row_Number() Over(Order By Timestamp_Dt, Hist_Pkey) Rk
         From Rh_Emp_Plaza_Hist ) X
        Where X.Hist_Pkey = E.Hist_Pkey)
    /
    And afterwards create the sequence with MAX(Hist_Id).
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Mar 2003
    Location
    18 Sur 3917
    Posts
    17

    Talking

    Thanks.. a lot.

    Your answer has been helpful.

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    Glad to help, good luck!

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •