Dario
Dario

Reputation: 9

What's wrong in this query?

UPDATE AC01_FILE_BLOB
SET AC01_FILE_BLOB.DATA_CONTROLLO=(TO_DATE(SELECT TO_CHAR(SYSDATE, 
                                                  'yyyy/mm/dd hh24:mi:ss') 
                                              FROM DUAL))
WHERE AC01_FILE_BLOB.DATA_CONTROLLO = (SELECT DATA_CONTROLLO 
                                         FROM AC01_FILE_BLOB 
                                        WHERE ROWNUM = 1 
                                     ORDER BY DATA_CONTROLLO desc)

[Error Code: 936, SQL State: 42000] ORA-00936

Upvotes: 0

Views: 66

Answers (1)

Dario
Dario

Reputation: 9

That's the solution:

 UPDATE AC01_FILE_BLOB
 SET AC01_FILE_BLOB.DATA_CONTROLLO = (SYSDATE)
 WHERE AC01_FILE_BLOB.DATA_CONTROLLO = (SELECT max(DATA_CONTROLLO)
 FROM AC01_FILE_BLOB where ROWNUM = 1 );

The problem was about the SYSDATE value, when i have to INSERT a record, i've to specify the date format plus the value, instead, in the SYSDATE i dont have to. Plus the "order by" command was useless cause i must use max(DATA_CONTROLLO), and that's the problem [SOLVED] about i had to be sure about the date updated was the MAX one, thank you all!

Upvotes: 1

Related Questions