日期:2014-05-16  浏览次数:20373 次

oracle我以前的资料1.2
/**********************题目:新建10个用户***************/
declare
    no_max number;
begin
    select max(empno) into no_max from nemp;
    dbms_output.PUT_LINE(no_max);
    for i in no_max..no_max+9
    loop
      insert into nemp values(i,'newEmploee'||i,'养猪',2000);
    end loop;
end;
/****************题目:做个除零异常并处理******************/
declare
  dividend number;
  divisor number;
begin
  dividend:=&被除数;
  divisor:=&除数;
  dbms_output.put_line(dividend/divisor);
exception
  when zero_divide then
  dbms_output.put_line('ERROR:divisor cannot be zero!');
  when others then
  dbms_output.put_line('ERROR:plesse input again or contact the Adminisrator!');
end;