fkjj.net
当前位置:首页 >> orAClE将查询到的数据插入到一个新表的存储过程 >>

orAClE将查询到的数据插入到一个新表的存储过程

很简单,代码如下 create or replace procedure test is begin --两个表字段一样 insert into 表名1 select * from 表名2; --字段不一样 insert into 表名1(字段1,字段2,字段3) select 字段1,字段2,字段3 from 表名2; COMMIT; end

不用存储过程,直接INSERT就行 insert into D (select * from A where mz not in(select mz from B) and jg not in(select jg from C)); 你要存储过程的话再加个壳 create or replace procedure XXX IS begin insert into D (select * from A wh...

看你的这两个用户是不是在同一个数据库中,如果不是同一个数据库,可以建立一个DBLINK来连接;如果是在同意个库内可以这样写: insert into A(column1,column2,column3) select bbb.B.columns1,bbb.B.columns2,bbb.B.columns3 from bbb.B where b...

简要代码如下,可根据实际情况适当修改: create or replace procedure pro_name asbegin insert into b select * from a t where (sysdate - t.时间字段)>30; delete from a where (sysdate - t.时间字段)>30; end pro_name;

不用存储过程,直接INSERT就行 insert into D (select * from A where mz not in(select mz from B) and jg not in(select jg from C)); 你要存储过程的话再加个壳 create or replace procedure XXX IS begin insert into D (select * from A wh...

PROCEDURE P1 IS BEGIN DELETE FROM A1; DELETE FROM B1; DELETE FROM C1; INSERT INTO A1 SELECT * FROM A; INSERT INTO B1 SELECT * FROM B; INSERT INTO C1 SELECT * FROM C; INSERT INTO A2 SELECT * FROM A; INSERT INTO B2 SELECT * FROM ...

create or replace procedure dataMove(in_date1 in date, in_date2 date) asBegin--根据时间查询数据放到备份表 insert into test2_bak (c_id, c_date, c_id2, c_job) select c_id, c_date, c_id2, c_job from test2 t where t.c_date > in_dat...

先把表创建起来,然后用insert语句插入。 create or replace procedure P_Insert(v_date in varchar2,v_cp varchar2) is begin INSERT INTO ora201301 SELECT * FROM bh WHERE 字段名1 BETWEEN v_date||'/01' AND v_date||'/31' AND 字段名2=v_c...

USER_SOURCE表没问题,这里面存储着存储过程的语法,你通过一个模糊查询like '%表名字%',就能查到存储过程名。 select distinct name from USER_SOURCE where type = 'PROCEDURE' and text like '%TABLE_A%' 这样应该能查到你的这个表涉及到的...

实际上存储过程向表中插入数据和sql执行的区别是不大的,只不过是存储过程是用loop等循环插入,之后顺序执行sql语句,不用命令行执行。 CREATE OR REPLACE PROCEDURE insert_data_4_pressure_3 is --Result1 VARCHAR2(50); VAR_num number;begin...

网站首页 | 网站地图
All rights reserved Powered by www.fkjj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com