Home » SQL & PL/SQL » SQL & PL/SQL » Re: How do i populate a LOV with values from a cursor?
Re: How do i populate a LOV with values from a cursor? [message #685] Tue, 26 February 2002 07:45
Greg Horton
Messages: 37
Registered: February 2002
Member
Im about to finish for the day, but im really stuck on the following 2 points and would really appreciate some feedback :-)

The code below is for a cursor that im using. What i want it to do is use the value stored in :mine_data.table_name_list as the table name.
When ive tried to code it, as shown below but commented out, it comes back with error 103. Can you see what im doing wrong?

DECLARE
CURSOR c_frequent_items IS
SELECT distinct honours_points, count(*) count_star
from students /*:mine_data.table_name_list*/
group by honours_points
having count(*) >= :mine_data.support_value_text;
--
BEGIN
go_block('frequent_items');
FOR cursor_rec IN c_frequent_items
LOOP
create_record;
:frequent_items.honours_points:=cursor_rec.honours_points;
:frequent_items.count_star:=cursor_rec.count_star;
END LOOP;
END;

The second thing that im confused with is the count(*) function. I have the following piece of code below, and when executed id like to assign the count(*) value of distinct honours_points into a different variable. Ive attempted to answer my own question using the code below:

DECLARE
v_records_found NUMBER;
--
BEGIN
select count(*) distinct honours_points
into v_records_found
from students
group by honours_points
having count(*) >= :mine_data.support_value_text;
--
go_block('frequent_items');
--
:frequent_items.records_found_text:=v_records_found;
--
END;

The form complains about the reserved word distinct appearing after the count(*). Can you suggest where i may have gone wrong?

Thank you..

Greg
Previous Topic: How do i populate a LOV with values from a cursor?
Next Topic: Passing strings to cursors
Goto Forum:
  


Current Time: Fri Apr 26 06:14:46 CDT 2024