差不多。
declare
cursor cc is select * from tab where....;
c1 cc%rowtype;
begin
open cc;
loop
fetch cc into c1;
exit when cc%notfound;
......
end loop;
close cc;
end;
呵呵,我用的是dev6.0啊,如果是在oracle中,我不知道啊。
declare
cursor cc is select * from tab where....;
c1 cc%rowtype;
begin
open cc;
loop
fetch cc into c1;
exit when cc%notfound;
......
end loop;
close cc;
end;
呵呵,我用的是dev6.0啊,如果是在oracle中,我不知道啊。
v_FirstName VARCHAR2(20);
v_LastName VARCHAR2(20);
CURSOR c_Students IS
SELECT first_name, last_name
FROM students;
BEGIN
OPEN c_Students;
LOOP
FETCH c_Students INTO v_FirstName, v_LastName;
-- Exit the loop after all rows have been retreived.
EXIT WHEN c_Students%NOTFOUND;
END LOOP;
-- End processing.
CLOSE c_Students;
END;
/
也可以使用隐式游标
for BIANLIANG in CUR_NAME loop
...
END LOOP;
cursor temp_cursor is SELECT tele_number,card_number,amount_this_time FROM t_telephone_info where paid_type = 1;
begin
for v_temp_cursor in temp_cursor loop
dbms_output.put_line('telenumber=' || v_temp_cursor.tele_number);
dbms_output.put_line('cardnumber=' || v_temp_cursor.card_number);
dbms_output.put_line('fee=' || v_temp_cursor.amount_this_time);
end loop;
end;
多谢:bzszp(SongZip) !!!