首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > PowerDesigner >

oracle存储过程关于拼凑update语句

2013-03-26 
oracle存储过程关于拼接update语句create or replace procedure proc_updateuser(usid in user_info.useri

oracle存储过程关于拼接update语句
create or replace procedure proc_updateuser(
  usid in user_info.userid%type,
  uname in user_info.username%type,
  userpass in user_info.password%type,
  effect_rows out smallint) as
  basql varchar2(1000);
begin      
    update user_info set
    username = uname,
    password = userpass
    where userid = usid;
    --execute immediate basql;--执行动态sql
    effect_rows :=1;
    commit;
    exception
    when others then
    effect_rows :=0;
    rollback;    
end proc_updateuser;
上面是我写的一个存储过程,功能是完成用户的信息修改。但是如果用户没有输入其中的一个参数的话,调用并执行过程后就会出现在修改的用户的某些列什么数据都没有了,因此我想在存储过程中判断并拼接sql,如果传了的参数才去修改,没有传的就不修改 。我用if语句进行拼接,但是都弄了一天,都有问题,如果遇到过类似问题的可以帮助一下啊,不胜感激呀。
我的异常网推荐解决方案:oracle存储过程,http://www.myexception.cn/oracle-develop/177537.html

热点排行