急急急!从一个用户的表中提取所需字段到另一个用户下面建立表的问题。
declare
tablenames varchar2(2000);
var_sql varchar2(2000); --------200好像不够
Cursor tablename_cursor is
select t.table_name from user_tab_comments t where t.table_name like 'EXIT2012%';
begin
open tablename_cursor;
loop
fetch tablename_cursor into tablenames;
exit when tablename_cursor%notfound;
if tablename_cursor%found then
var_sql:='create table dataanalysis2012.'||tablenames||' as select vehiclelicenseAuto,vehiclelicense,EntryStation,ExitStation,EntryTime,ExitTime,VehicleType,VehicleClass,TotalWeight from DBBASE2012.'||tablenames;
execute immediate var_sql;
end if;
end loop;
close tablename_cursor;
end;
------解决方案--------------------表名重复了吧,建议先用dbms_output.put_line把表名打印出来看看
------解决方案--------------------你的用户下已经有同名对象了 弟弟
确认一下。
select * from user_objectes;