0
votes

I want to update a first row of table base of date's field in oracle.

 update table1 set dfry = 9, ctxotb = 10000 where pan = '6363' AND
 dfry = 2 and rownum<=1  order by txdate;

error is : ORA-00933: SQL command not properly ended.

Thanks.

1

1 Answers

0
votes

You could try something like:

UPDATE table1
SET dfry = 9
   ,ctxotb = 10000
WHERE pan1 = '6363'
AND dfry = 2
AND txdate =
  (SELECT min(txdate)
   FROM table1
   WHERE pan1 = '6363'
   AND dfry = 2)

However, if there are multiple records with the same pan1, dfry and txdate this will update all of them, instead of randomly choosing one and updating this; which your attempt appears to want to do.