I got ORA-01810 error in SQL with Oracle.
Question

I'm using Oracle in my on-premise environment.

I tried this SQL statement but I got ORA-018010 error and it doesn't work.

I can't figure out why it's happening here. 

Do you have any ideas on the cause?  It'd be nice if you could give me the solution.

DELETE FROM {BDDTestSuiteRun} WHERE ({BDDTestSuiteRun}.[StartedOn] < to_date(@CleanUpBeforeDate,'YYYY-mm-DD HH:MM:SS'))

*In Oracle, it seems like we don't need semicolon at the last so I'm removing it here.



Best,

Solution

Can you write your query simply:

DELETE FROM {BDDTestSuiteRun}

WHERE {BDDTestSuiteRun}.[StartedOn] < @CleanUpBeforeDate


Thanks!

Hi Tsubasa,

in Oracle, minutes are represented with MI, not MM

YYYY-MM-DD hh:mi:ss

Thank you.

I tried that, but I'm having this ORA error.

I wonder where I'm missing.

Do you have any ideas?

Hi Tsubasa,

Can I confirm if the data type of 'StartedOn' is dateTime?


Thanks!

Hi Angel,

I checked it's dateTime. Um...I wonder where the issue is.. 

Ok on my end its working perfectly fine.

Can try to remove to_date and check.

If that doesn't works, please check if your 'BODTestSuiteRun' has some bad data which is preventing the comparison of dateTime

Also try running your query against some other table and see if you get the same error.

I suspect its mostly due to some bad data in your 'BODTestSuiteRun' table.


Thanks!

I removed to_date and got this error. I'm actually using Oracle in my environment.


Solution

Can you write your query simply:

DELETE FROM {BDDTestSuiteRun}

WHERE {BDDTestSuiteRun}.[StartedOn] < @CleanUpBeforeDate


Thanks!

Thanks,

I got the right answer, I guess.


* TestInputs is #2021-12-23 23:14:23#



For now, this should be fine. Thanks.

If the issue comes out here, I might post .


Best,

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.