现在三张表分表为 A表:auto_call   B表:auto_temp  C表:auto_sms_call现在我需要实现如下的功能比如 A表中的数据为
id  number(列名)11    hello
22    hello
33    hello
55    helloB表中的数据为
id1
33
22
2
22
11C表中的数据为
id     number5        hi
6        hi
22       hi
现在我要执行一个存储过程,将A表中存在且B表中存在相应id为11、22的数据抽取出来,插到C表中
,执行完存储过程后,C表中的数据应该为
id     number11       hello
22       hello
33       hello
5        hi
6        hi
22       hi
!!!!!!!!!!!!
这个存储过程该如何写呢?我对ORACLE不是很熟悉,每接触过存储过程和触发器,希望大虾指教!
谢谢了 
不会帮我顶一下 大家共同学习

解决方案 »

  1.   

    insert into c select a.id,a.number from a,b where a.id=b.id(+) and b.id in (11,22) and b.id is not null
      

  2.   

    晕,是说A和表都有的数据id,如果是
    insert into c select a.id,a.number from a,b where a.id=b.id(+) and b.id is not null
      

  3.   

    insert into c select a.id,a.number from a,b where a.id=b.id(+) and b.id in(select distinct id from b)
    这样试一试