oracle怎么向多张表中插入数据?

解决方案 »

  1.   

    insert all when ...then ....
      

  2.   


    操作几个表,写几个sql 语句
      

  3.   

    INSERT ALL/FIRST 
       WHEN ottl < 100000 THEN 
          INTO small_orders VALUES(oid, ottl, sid, cid) 
       WHEN ottl > 100000 and ottl < 200000 THEN 
          INTO medium_orders VALUES(oid, ottl, sid, cid) 
       WHEN ottl > 200000 and ottl < 300000 THEN 
          INTO large_orders VALUES(oid, ottl, sid, cid) 
       ELSE 
          INTO special_orders 
       SELECT o.order_id oid, o.customer_id cid, o.order_total ottl, o.sales_rep_id sid, 
                  c.credit_limit cl, c.cust_email cem 
       FROM orders o, customers c 
       WHERE o.customer_id = c.customer_id;
      

  4.   

    http://hi.baidu.com/li_sunman/blog/item/9d97519ab395ceb2c8eaf43f.html
      

  5.   

    有两种方法!insert all
     when [condition] then
       into table_name1 values();
     when [condition] then
       into table_name2 values();
     else
       into others;
    ------------
    insert first
     when [condition] then
       into table_name1 values();
     when [condition] then
       into table_name2 values();
     else
       into others;/*两种区别在于当用insert all 的时候当数据对两个以上的[condition]
    都满足的时候数据会写入所有满足条件的表里。 当用 insert first 的时候
    出现这种情况的时候数据直插入第一次满足条件的表。*/
      

  6.   

    楼上的,condition这个条件是什么?
      

  7.   

    应该就是insert all when then else吧