Skip to content

Tag: oracle

Oracle SQL: ORA-01858 error on date fields

I have many tables with a date in their name. For example MY_TABLE_2021_06_01, MY_TABLE_2021_06_02, etc. I’m trying to extract the date from the table name and see if any tables are more than an year old. This is my code: The above code works fine if I don’t include the where clause where table_da…

HOW TO CHECK CONDITIONS FOR PREVIOUS MONTH

My table is like I am trying to get customer_ids where they didn’t do any transactions previous month and made transactions with at least 2 transaction_type at this_month.While doing this I am converting rundate to MM-YYYY format. What I’ve done for getting previous month and this month on MM-YYY …

Combine lead and lag function without overlap

I have this table: I need to get an output like this: I’ve tried a normal lead window function, but that would only show the first ‘Creation’ and not that last ‘Pending’ that I need. Answer Your table has N records (3 in the example provided) when query must return N + 1 (4); let…