Skip to content

Tag: oracle

groupby to check each of their date in oracle sql

I have a table ISIN_TBL which has two fields IDENTIFIER and ALLT_DATE which are of datatype varchar and Date respectively. There are many ALLT_DATE for each IDENTIFIER in the table. Normally for each IDENTIFIER the ALLT_DATE should be the same. But just to confirm i want to write a sql query to list IDENTIFIE…

Use select inside ‘filename’ property of utl_file.fopen

I have a procedure that extracts data from a view and stores it on disc in CSV format. I’d like a name of the file to contain the most recent timestamp from table MY_TIMESTAMPS. For now it looks like this: The part with (select to_char(max(EVENT_TS)) from MY_TIMESTAMPS) throws an error. How can I set th…

Count the number of times word appears in a single column

I’m attempting to count the number of times apples and oranges appear in my fruit column. The table looks like this: Expected output: My code thus far. I’m not sure how to do it when both appear and how to add them to the totals. I’m sure there is an easier way that this. Cheers Answer If th…

default rows from select query

I have a select query (Oracle database) with group by clause that needs to return 4 rows if all required data exist. It works perfectly. How can I write a select query that returns same 4 rows even if …