Home » Developer & Programmer » Reports & Discoverer » Can you use cursors and if so, how?
Can you use cursors and if so, how? [message #419646] Mon, 24 August 2009 13:45 Go to next message
csphard
Messages: 8
Registered: February 2009
Junior Member
I have a report where I need to count the following.

I need to check 2 dates from 2 separate fields aand pick the latest date.
The one with the latest date I need to count the information that is associated with it.

Is that possible?

I have been thinking about creating a cursor and counting the information as I loop through the
table. I just do not know how do I print out each line of information with its count as I
loop through.

Howard
Re: can you use cursors and if so how [message #420054 is a reply to message #419646] Wed, 26 August 2009 14:36 Go to previous messageGo to next message
raavi_13
Messages: 12
Registered: June 2009
Location: MUMBAI
Junior Member
Hi,

I did not understand your question.Please elaborate it.


Regards
Ravi.
Re: can you use cursors and if so how [message #420380 is a reply to message #419646] Fri, 28 August 2009 15:34 Go to previous message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Looping (i.e. row by row) is slow. Do you really want/need to do that? It is easy to find out which value is larger (use Oracle GREATEST function). Then, perhaps you could do something like
SELECT COUNT(*)
FROM your_table
WHERE date_column = GREATEST (date_1, date_2)

If you, however, want to do that in a loop, create a formula column - it accepts PL/SQL code so it is possible to use cursors and loops in there.
Previous Topic: can't pass parameter through cgicmd.dat key
Next Topic: How to know whether the table is in the process of updating records
Goto Forum:
  


Current Time: Fri Apr 26 06:21:12 CDT 2024