Skip to content

Tag: oracle

How to save data after using With Clause?

I want to save the data I have after With Clause. Maybe saving into TEMP table or some other data set. WITH TASKLIST AS (SELECT * FROM IC_V_NEWSKUSTASKLIST WHERE MSTID IS NULL), RESULTS AS (SELECT *…

Average price based on dates

I am trying to calculate a weekly average, and add it as a new column along side what I already have. I have added week starting dates and week ending dates as I thought that would be useful (and how I found do it in a more familiar MS Excel environment). This code returns a table with 4 columns. I

Issue in a function that converts a string into a valid date

I have been using this function for last few years that converts an input string into a valid date in decided format. The above query will return, 28-02-2002 00:58:15 However starting 29/02/2020, if the input string to the function changes to ‘20200229005947354241’, it returns a null! I am not sur…

Improve query performance and maintainability

I have a query like this: The output of the query will be something like this, basically a CODE and the respective COUNT, for example: After this first query, I have a foreach that will iterate the result of the query above. Inside the foreach, for each result of the query above, I want to get some informatio…

max, over partition by, oracle, take max rownum record

I am trying to pull the maximum rownum in a partition. I am getting the below error message, so I need help to fix my SQL Query. I added in a row number and a row number in a partition in my SQL query. Code is below. I want to take the maximum over this partition and have tried changing