I am using 11g.
I have a task that requires to go thru over 2,000 records. It is 1 SQL and 1 Function. The SQL returns job ID, start date and end date. So the SQL looks something like this.
Select job_id as Job,
min(job_date) as Start_Date,
max(job_date) as End_date
From Job_table
Group by job_id
The above SQL will return the job, the day it started and date it ended. I want to use those 3 pieces of data and get the grand total returned to me from a function. Why a function? Because the function is already written by someone else.
The final production should look something like this . . .
Job Start Date End Date Total Spent
A12 1/1/2020 12/31/2020 1,000,000
My question is how to do this. I will not be given a temp table by the DBA. So the SQL will give me all the job ID numbers, the start and end date. I need the grand total for each job.