create or replace procedure test_pro
as
dept_record dept%rowtype;
cursor dept_cursor is select * from dept;
begin
for dept_record in dept_cursor loop
dbms_output.put_line(dept_record.dname);
end loop;
end test_pro;
本文展示了一个使用PL/SQL编写的简单过程示例,该过程从DEPT表中读取所有部门名称并打印出来。此过程使用了游标进行记录的循环遍历,并通过DBMS_OUTPUT将每个部门名称输出到屏幕上。
create or replace procedure test_pro
as
dept_record dept%rowtype;
cursor dept_cursor is select * from dept;
begin
for dept_record in dept_cursor loop
dbms_output.put_line(dept_record.dname);
end loop;
end test_pro;
1万+

被折叠的 条评论
为什么被折叠?