日期:2014-05-17  浏览次数:20769 次

问下,我这个存储过程执行结果不对,,,在线等!!!
PROCEDURE UPDATE_PROCEDURE_NAME
(
 V_ID IN NUMBER,
 V_VALUE IN VARCHAR2
)
IS BEGIN
  UPDATE TEST SET VALUE=V_VALUE WHERE ID=V_ID;
END UPDATE_PROCEDURE_NAME;


这个存储过程创建的时候没有报错,,, 我执行这个存储过程, 为什么表里面的数据不能改变

------解决方案--------------------
SQL code

set serveroutput on;
/
create or replace PROCEDURE UPDATE_PROCEDURE_NAME
(
 V_ID IN NUMBER,
 V_VALUE IN VARCHAR2
)
IS 
val varchar(50):='';
cou int:=0;
BEGIN
    select count(1) into cou from TEST where ID=V_ID;
    if cou<>0 then
      select VALUE into val from TEST where ID=V_ID;
        dbms_output.put_line(val);
      UPDATE TEST SET VALUE=V_VALUE WHERE ID=V_ID;
      select VALUE into val from TEST where ID=V_ID;
        dbms_output.put_line(val);
        commit;
    end if;
END UPDATE_PROCEDURE_NAME;
/
--这样建立就可以看清了