Home » SQL & PL/SQL » SQL & PL/SQL » Urgent Help needed.....
Urgent Help needed..... [message #191939] Fri, 08 September 2006 15:45 Go to next message
Jolanda
Messages: 68
Registered: September 2004
Member
Hello you all,

I just can't find a way to solve this problem:

I have a couple of tables

my_table_a
my_table_b
my_table_c

These tables have a date field. I need to loop through all the tables and find the newest Date.

example:
my_table_a

10-06-2006
12-06-2006
13-06-2006

my_table_b

11-06-2006

my_table_c

12-06-2006
15-06-2006



In this case I need the 10-06-2006

However...unfortenately this is not the only problem.

I have the same tables, but temporary tables which also have date fields.

t_my_table_a


08-06-2006
09-06-2006
12-06-2006

t_my_table_b

07-06-2006
11-06-2006
13-06-2006
15-06-2006
16-06-2006

t_my_table_c

12-06-2006
15-06-2006
18-06-2006

What I need is this:

I need the minimum date from the t_ tables, but this date has to be greater than the newest date in the other tables


the newest in the first tables is: 15-06-2006
the minimum date in the t_ tables, which is greater that 15-06-2006 is 16-06-2006.

And this is what I need...A function which returns this date.

What I have so far is:

all the tables in an array...and I loop through the tables:



FOR r_index IN tables.FIRST .. tables.LAST
    LOOP
v_date := func_GetDate(tables(r_index);
	    END LOOP;





Can someone please help me out with the unimplemented func_GetDate function?

Thanks...and i really do hope someone comes up with a usefull idea.....
Re: Urgent Help needed..... [message #191941 is a reply to message #191939] Fri, 08 September 2006 16:09 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
> i really do hope someone comes up with a usefull idea.....
My idea is that the homework tutor is down the hall & 2nd door on the left.
Solve the problem one piece at a time & then combine the individual solutions into a single function.
Re: Urgent Help needed..... [message #191942 is a reply to message #191941] Fri, 08 September 2006 16:18 Go to previous message
Jolanda
Messages: 68
Registered: September 2004
Member
Anacedent,

I know how to come there...so your idea is not very usefull.

You could come up with better ideas.

For example: to find a min or max of columns in a table I can use the MIN or MAX function. I pretty aware of that. I can do this for every table and compare the the result. But if you have 100 tables, you don't wanna do that.
So, my thought was that maybe someone could come up with an idea about how to do something like that on a lot of tables.

So, if you have comment which is usefull, you're welcome...otherwise don't take the effort to write in the first place!!

but, anyway...have a nice weekend and thanks for the tip!
Previous Topic: FUNCTION not returns desired result - ?
Next Topic: ORA-12560: TNS:protocol adapter error
Goto Forum:
  


Current Time: Sat Dec 03 07:48:27 CST 2016

Total time taken to generate the page: 0.09468 seconds