@mallory_cormier
One way to get the previous working date using trunc(sysdate) in Oracle is to use a combination of functions such as CASE, TO_CHAR, and TRUNC. Here is an example query that demonstrates how to achieve this:
1 2 3 4 5 6 7 |
SELECT CASE WHEN TO_CHAR(TRUNC(sysdate), 'DY') = 'MON' THEN TRUNC(sysdate) - 3 ELSE TRUNC(sysdate) - 1 END AS previous_working_date FROM dual; |
In this query:
You can adjust the logic in the query based on your specific requirements for defining a working date in your organization (e.g., weekends, holidays).