本帖最后由 zj84604741 于 2012-02-28 18:15:11 编辑

解决方案 »

  1.   

       你的第二个问题  1、oracle 事务的语法是什么? 请详细说明 ,附带例子,只要能写出问题2就可以2、在oracle11g中 我用 存储过程写了个事务
    create or replace procedure my_pro
    as
    begin
     savepoint mypoint;
     exception  
     when others then
     rollback to mypoint;
     end;
     
    我在测试以上语句的时候 , 不存在问题所以你的问题 出在你的update或者insert里面 
      

  2.   

    推荐书的话 你可以去看三思笔记,那个侧重管理,比较适合初学看的,你若要看开发的有本《精通pl/sql 编程》 不过这个已经绝版,lz要的话 可以gmail 我
      

  3.   

    yes,语法没有问题。
    事务:
    多条insert/update/delete作为一个整体提交。
    而你的写法就是想整体提交,所以不用savepoint mypoint;
    直接
    begin
    insert/update/delete
    insert/update/delete
    commit;
    exception when others then 
    rollback;
    end;
    若你想非单条但不是全部的作为一个事务时,才使用savepoint 。
      

  4.   

    语法问题ROLLBACK TO SAVEPOINT mypoint;
      

  5.   

    create or replace procedure my_pro
    as
    begin
     update pet set owner_id = 0 where  id =14;
     exception   when others then
     rollback 
     end;
     
    --执行存储过程
    execute my_pro创建没有问题的。 而且里面sql文 拿出来没有问题 可以正确执行
    但是一执行存储过程就报错!  错误提示:ora-00900  无效sql语句
      

  6.   

    没有提示出在哪里啊。。 就提示:无效sql语句
    我就纳闷了。2楼说没问题。 可是为什么我一执行就 出问题。
    2楼 创建存储空间没问题的啊。     你调用存储过程了么? 
      

  7.   

      我在plsql 下执行没问题 , 你可以试试把你的update和insert去掉试试
      

  8.   

    使用 存储过程 execute my_pro 这句话 有错误么
    我就创建了一个空的 存储过程。 用上面那句话调用居然 还是报错  无效sql
      

  9.   

     你执行的地方估计不对  在command 里面是不能这样执行过程的
      

  10.   

    我直接 执行execute my_pro 这句话的
    你是如何执行的 
    能给我看下么
      

  11.   

     begin
     update pet set owner_id = 0 where  id =15;
    commit;
    exception when others then 
    rollback;
    end;
    原来  语句必须 有号结尾  ,上面这个sql文 居然好用了。
      

  12.   

    顺便加一个 ,如何调用存储过程啊。  
    为什么 上面写的存储过程 execute my_pro  这样调用就会报错
      

  13.   

    用 commandwindows 运行执行代码 oK , me is fuliang