复制一张新表(无数据):create table aaa as select * from bbb;
select * from table where intime > to_date ('2018-11-28 00:00:00','yyyy-mm-dd hh24:mi:ss');
从表取数据并赋值
declare
stra varchar2(1000):='JACK';
strb varchar2(1000):='JACK';
begin
select WKLINEMHLINKNO,WKLINEMHWBLINKNO into stra, strb from pd.TPNWKLINEMHWB where rownum = 1;
dbms_output.put_line('WKLINEMHLINKNO变量的值为:'||stra);
dbms_output.put_line('WKLINEMHWBLINKNO变量的值为:'||strb);
FOR L_RECORD IN (select WKLINEMHLINKNO,WKLINEMHWBLINKNO from pd.TPNWKLINEMHWB where rownum = 1)
LOOP
update pd.TPNWKLINEMHWB set WKLINEMHLINKNO = '1' where WKLINEMHLINKNO = 'abcccc';
END LOOP;
end;
遍历表读取数据(类似游标)
declare
cursor all_data is select WKLINEMHLINKNO from pd.TPNWKLINEMHWB where rownum <= 10;
row_data all_data%ROWTYPE;
begin
open all_data;
loop
fetch all_data
into row_data;
dbms_output.put_line('WKLINEMHLINKNO变量的值为:'||row_data.WKLINEMHLINKNO);
exit when all_data%notfound;
end loop;
close all_data;
end;