I have a delete statement:
My original Delete:
DELETE FROM TableName A
WHERE SCHED_SURGERY_TM >= TRUNC(sysdate)-90
Now I need to delete based upon either START_TM or SCHED_SURGERY_TM :
DELETE FROM TableName A
WHERE
( case
when A.START_TM IS not NULL THEN
A.START_TM >= TRUNC(sysdate)-90
else
A.SCHED_SURGERY_TM >= TRUNC(sysdate)- 90
end
)
What I'm trying to accomplish is use START_TM ( if not null ) else use SCHED_SURGERY_TM and delete the last 90 days of data. I know this example doesn't work. Any suggestions on how this can be accomplished or can it?
Thank you.
My original Delete:
DELETE FROM TableName A
WHERE SCHED_SURGERY_TM >= TRUNC(sysdate)-90
Now I need to delete based upon either START_TM or SCHED_SURGERY_TM :
DELETE FROM TableName A
WHERE
( case
when A.START_TM IS not NULL THEN
A.START_TM >= TRUNC(sysdate)-90
else
A.SCHED_SURGERY_TM >= TRUNC(sysdate)- 90
end
)
What I'm trying to accomplish is use START_TM ( if not null ) else use SCHED_SURGERY_TM and delete the last 90 days of data. I know this example doesn't work. Any suggestions on how this can be accomplished or can it?
Thank you.