create or replace procedure qincy(x in number) is
-- 变量赋值
y number(4, 2);
dept varchar2(2000);
-- 游标定义
Cursor cursor is
select * from eip_dept_jbxx;
-- 执行语法
begin
if x > 0 then
begin
y := 9;
dbms_output.put_line(x || '> 0' || 'y=' || y);
end;
end if;
if x < 0 then
begin
dbms_output.put_line(x || '<0');
end;
end if;
-- Loop name 引用cursor里的变量,要用'cursor名.字段名'的形式.
for dept in cursor LOOP
begin
dbms_output.put_line('bmmc='||dept.bmmc||'bz =='||dept.bz);
end;
end LOOP;
end;