oracle存储过程含参数的插入数据


create or replace
procedure proczipcodebyzipinsert(
  i_zipcode  in  zipcode.zip%type,
  i_city in zipcode.city%type,
  i_state in zipcode.state%type
)
as
  v_zipcode zipcode.zip%type;
  v_city zipcode.city%type;
  v_state zipcode.state%type;
  v_dummy zipcode.zip%type;
begin
 v_zipcode:=i_zipcode;
 v_city:=i_city;
 v_state:=i_state;
 select zip into v_dummy from zipcode where zip=v_zipcode;
 dbms_output.put_line('数据存在您不能插入');
exception
  when no_data_found then
  insert into zipcode values(v_zipcode,v_city,v_state,user,sysdate,user,sysdate);
  dbms_output.put_line('数据插入成功');
  when others then
  dbms_output.put_line('数据错误');
end;



set   serveroutput on

set serveroutput on
begin
 proczipcodebyzipinsert('046000','山西长治','cz');
end;
rollback


阅读更多
个人分类: oracle
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

oracle存储过程含参数的插入数据

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭