Showing posts from March, 2026
In Oracle, getting the first day of the month is very simple ✅ Basic Query SELECT TRUNC(SYSDATE, 'MM') FROM dual; 🔎 Explanation TRUNC(date, 'MM') → returns 1st day of that month Time will be 00:00:00 🧪 Examples 🔹 Current month f…
You can create a month-wise pivot using Oracle PIVOT . Since your period is FY 2025-26 (Apr-2025 to Mar-2026) , we first extract the month from CREATED_DATE and then pivot. Month-wise Pivot Query SELECT * FROM ( SELECT ZONE, INSTL_ADDR_STATE…
Here is a very useful production-style script to drop multiple tables automatically using a loop in Oracle. This is commonly used in data migration, backup cleanup, or refresh scripts . 1️⃣ Drop All Tables Matching a Pattern Example: Drop all backup…
PL/SQL block for dropping a table only if it exists. It safely ignores the error ORA-00942 (table or view does not exist) . Here is the clean version with proper formatting : BEGIN EXECUTE IMMEDIATE 'DROP TABLE CO_DATA_NZ_bkp PURGE'; EXCEPT…