create procedur chaxun as
v_line tbname%rowtype;
begin
select * into v_line from tbname where rownum<2;
end chaxun;
/
v_line tbname%rowtype;
begin
select * into v_line from tbname where rownum<2;
end chaxun;
/
AS
TYPE Test_CURSOR IS REF CURSOR;
END Test;(2)过程:CREATE OR REPLACE PROCEDURE GetCategoryBooks
(
p_CURSOR out Test.Test_CURSOR, -- 这里是上面包中的类型,输出参数
p_CatogoryID INTEGER
)
AS
BEGIN
OPEN p_CURSOR FOR
SELECT * FROM Books
WHERE CategoryID=p_CatogoryID;
END GetCategoryBooks;
myrow 表%rowtype;
Cursor Mycursor is
select *
from 表;
begin
open MyCursor;
loop
Fetch MyCursor into Myrow ;
Exit when Mycursor%notfound;
Dbms_Output.put_line(Myrow.ID||' '||Myrow.Pwd);
end loop;
Close MyCursor;
end;