当前位置: 代码迷 >> Oracle管理 >> 新手,求存储过程,多谢
  详细解决方案

新手,求存储过程,多谢

热度:100   发布时间:2016-04-24 05:47:27.0
新手,求存储过程,在线等,谢谢!
存储过程功能要求:
从一张表里面获取N个字段值,然后把这些值,插入到另一张表对应的字段,两张表对应的字段数据类型是一样的。

请了解的兄弟,给解一下,谢谢!

------解决方案--------------------
insert into table2 select * from table1
------解决方案--------------------
CREATE OR REPLACE PROCEDURE 存储过程名(a_number out number,其他参数,其他参数...) is
begin
INSERT INTO /*APPEND*/
表名 nologging
(字段1, 字段2,。。。)
SELECT 字段1,
字段2,
。。。
FROM 表名
WHERE 条件。。
a_number := sql%rowcount;
if a_number > 0 then
commit;
end if;
exception
when others then
rollback;
a_number := sqlcode;
end;
  相关解决方案