常见问题1000例Oracle(四)

2014-11-24 09:14:11 · 作者: · 浏览: 23
--DBMS_OUTPUT.put_line(test.emailaddress);
-- DBMS_OUTPUT.put_line(test.introduce);
exit when cursor%notfound;
DBMS_OUTPUT.put_line(gary_name.name);
end;
end loop;
if cursor%isopen then
close cursor;
end if;
for test in cursor LOOP
begin
DBMS_OUTPUT.put_line(test.id);
DBMS_OUTPUT.put_line(test.name);
DBMS_OUTPUT.put_line(test.password);
DBMS_OUTPUT.put_line(test.emailaddress);
DBMS_OUTPUT.put_line(test.introduce);
end;
end LOOP;
end gary_test1;
create or replace procedure gary_test1 (student_id in number,
student_name out varchar2
)
IS
--student_name:='kevin_xiong';
x number:=1;
Cursor cursor is select name from test_gary1 where test_gary1.id=student_id;
--name varchar2(20);
gary_name varchar2(20);
cur_gary cursor%rowtype;
begin
open cursor;
loop
begin
fetch cursor into cur_gary;
-- DBMS_OUTPUT.put_line(test.id);
-- DBMS_OUTPUT.put_line('teeesttt------stesrt');
-- DBMS_OUTPUT.put_line(test.password);
--DBMS_OUTPUT.put_line(test.emailaddress);
-- DBMS_OUTPUT.put_line(test.introduce);
exit when cursor%notfound;
DBMS_OUTPUT.put_line(cur_gary.name);
end;
end loop;
if cursor%isopen then
close cursor;
end if;
end gary_test1;
-- write a research procedure to search all data from test_gary1 with loop 1
create or replace procedure gary_test2 (student_id in number,
student_name out varchar2
)
IS
--student_name:='kevin_xiong';
x number:=1;
Cursor cursor is select id,name,password,account,emailaddress,introduce from test_gary1 where test_gary1.id=student_id;
--name varchar2(20);