oracle 在已有表新增列内批量加数据

创建每列随机值的语句

create table TEST_ZHAA01A_03 as
select rownum as id,
to_char(sysdate + rownum/24/3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
trunc(dbms_random.value(0, 999999999999)) as random_id,
dbms_random.string('x', 20) random_string
from dual
connect by level <= 25036;

将A表与B表合并,然后建立C表的语句
create table TEST_ZHAA01A_03 as (select * from
(select rownum rn1, TEST_ZHAA01A_01.* from TEST_ZHAA01A_01),
(select rownum rn2, TEST_ZHAA01A_03.* from TEST_ZHAA01A_03)
where rn1 = rn2);

 

将A表数据写入B表

insert into TEST_ZHAA01B_01(ZHAA01B010,ZHAA01B020,ZHAA01B030,ZHAA01B070,ZHAA01B110) 

select ZHAA01A010,ZHAA01A010,ZHAA01A025,ZHAA01A040,ZHAA01A050 from TEST_ZHAA01A_01;

 

insert into TEST_ZHAA01B_01(ZHAA01B010,ZHAA01B020,ZHAA01B030,ZHAA01B070,ZHAA01B110) 
select ZHAA01B010,ZHAA01A010,ZHAA01A025,ZHAA01A040,ZHAA01A050 from TABLE1;

 

更新A表中时间属性字段语句
update TEST_ZHAA01B set ZHAA01B050=to_date('2017-07-19 12:00:00','yyyy-mm-dd hh24:mi:ss')

 

posted @ 2017-07-19 13:05  一个勤奋的胖子  阅读(1715)  评论(0编辑  收藏  举报