首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

oracle小弟我以前的资料1.2

2012-08-25 
oracle我以前的资料1.2/**********************题目:新建10个用户***************/declareno_max numberb

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;

热点排行