create or replace procedure test_yurui
(
    p_line in number
) is
    v_line number;
begin
    v_line:=p_line;
    if(v_line<1) then
        dbms_output.put_line('请输入>=1的整数');
    end if;

    for v in 1..p_line loop
        for m in 1..p_line-v loop
            dbms_output.put(' ');
        end loop;

        for n in 1..2*v-1 loop
            dbms_output.put('*');
        end loop;

        dbms_output.put_line('');
    end loop;
end test_yurui;

 

 

带异常处理

CREATE OR REPLACE PROCEDURE Write_Runreport(Vproc_Name VARCHAR2,
                                            Voperate_Desc VARCHAR2,
                                            Vproc_Info VARCHAR2,
                                            Vsys_Info VARCHAR2,
                                            Vuser_Account VARCHAR2,
                                            Vbegin_Time DATE) AS
BEGIN
  --写运行错误报告*****************************
  INSERT INTO SA_Run_Report
    (Run_Report_Id, Proc_Name, Operate_Desc, Proc_Info, Sys_Info,
     User_Account, Begin_Time, End_Time)
  VALUES
    (SEQ_SA.NEXTVAL, Vproc_Name, Voperate_Desc, Vproc_Info,
     Vsys_Info, NVL(Vuser_Account,'Admin'), Vbegin_Time, SYSDATE);
EXCEPTION
  WHEN OTHERS THEN
    NULL;
END;

 posted on 2011-02-28 16:07  umen  阅读(1682)  评论(0编辑  收藏  举报