insert,delete,update操作和事务操作可以在存储过程中完成,为什么要在函数中进行,函数一般被用在查询语句中。

解决方案 »

  1.   

    例如,请大虾诊断CREATE OR REPLACE  FUNCTION GETOUID                 
                         (classid IN NUMBER)
       RETURN NUMBER
       IS ouid NUMBER(10,0);
     BEGIN
        set transacntion read write;
        update tt set bb = bb + 1 where aa = classid;
        select bb into ouid from tt where aa = classid;
        commit;
        RETURN(ouid);
      END;
      

  2.   

    创建函数时,oracle显示
    警告: 创建的函数带有编译错误。
      

  3.   

    呵呵!上面说错了!该存储过程为
    CREATE OR REPLACE  procedure GETOUID                 
                         (classid IN NUMBER,
                         ouid out NUMBER)
    is
     BEGIN
        set transacntion read write;
        update tt set bb = bb + 1 where aa = classid;
        select bb into ouid from tt where aa = classid;
        commit;
      END;
      

  4.   

    你的set transacntion read write;写错了
      

  5.   

    含有dml语句的函数不能用于select,这是oracle的规定
      

  6.   

    你把这句set transacntion read write去掉