INSERT ALL
INTO table_1 (id, name)
values(id,name)
INTO table_2 (id, name)
values(id,name)
INTO table_other (id, name)
values(id, name)
SELECT id,name
FROM a;

解决方案 »

  1.   

    可能我没说明白吧,我是要实现类似sql server中这样的功能:
    CREATE PROCEDURE xxxx
    (xx
     ..
     xx)
    ASBEGIN TRAN
    insert to table1 ....
    IF (@@ERROR <> 0)
    begin
        rollback tran
        return -1
    end
    insert into table2 ...
    IF (@@ERROR <> 0)
    begin
        rollback tran
        return -1
    end
    COMMIT TRANif @@Error <> 0
      Return -1
    Else
      Return 0
    GO类似这样的功能在oracle中怎么实现?
      

  2.   

    insert to table1 ....
    IF SQL%ROWCOUNT = 0   --sql影响记录数
    then
    ROLLBACK;
    en dif;
      

  3.   

    上面错了
    insert to table1 ....
    IF SQL%ROWCOUNT = 0   --sql影响记录数
    then
    ROLLBACK;
    end if;
      

  4.   

    --你试试看
    CREATE OR REPLACE procedure ll_04 is
    begin
         insert to table1 ....
        IF SQL%ROWCOUNT = 0   --sql影响记录数
        then
        ROLLBACK;
        end if;      insert to table2 ....
        IF SQL%ROWCOUNT = 0   --sql影响记录数
        then
        ROLLBACK;
        end if;    
          insert to table3 ....
        IF SQL%ROWCOUNT = 0   --sql影响记录数
        then
        ROLLBACK;
        end if;       
     COMMIT;    

       EXCEPTION
         WHEN OTHERS THEN
           -- Consider logging the error and then re-raise
           ROLLBACK;  
    end ll_04;
      

  5.   

    谢谢icedut的热心帮助,看来我还得多学学oracle语法啊,100分全给你