
create or replace procedure test_1
is
begin
for res in 1..5
loop
dbms_output.put_line('haha:'||res);
end loop;
end test_1;
执行时:
SQL> set serveroutput on
SQL> exec test_1
另外oracle拼接字符时是用||来进行拼接
----------------test2---------------------
create or replace procedure xsxxgl_test_2 is
ss varchar2(100);
begin
select xh into ss from xsxxgl_xsjbxx_test WHERE xh='20120246837';
if sql%found then
update xsxxgl_xsjbxx_test set xm='ccc' WHERE xh='20120246837';
commit;
end if;
end;
-------------------test3----------------------
create or replace procedure xsxxgl_test_3 is
l_date varchar2(10);
begin
l_date := sysdate;
dbms_output.put_line(l_date);
exception
when value_error then
dbms_output.put_line('ddd');
end;