修改字段长度:
declare
v_sql varchar2(10000);
v_table_name varchar(100);
cursor c1 is select table_name from user_tables where TABLE_NAME like 'GX_%' and TABLE_NAME not like '%ANNO' and TABLE_NAME not like '%_LX';
begin
open c1;
loop
fetch c1 into v_table_name;
exit when c1%notfound;
v_sql:='alter table '||v_table_name||' modify FCODE NVARCHAR2(8)';
execute immediate v_sql;
end loop;
close c1;
end;
修改值:
declare
v_sql varchar2(10000);
v_table_name varchar(100);
cursor c1 is select table_name from user_tables where TABLE_NAME like 'GX_%' and TABLE_NAME not like '%ANNO';
begin
open c1;
loop
fetch c1 into v_table_name;
exit when c1%notfound;
v_sql:='Update '||v_table_name||' set FCODE= concat(concat(substr(FCODE, 1, 1),'||chr(39)||'4'||chr(39)||'),substr(FCODE, 2)) where length(FCODE)=7';
execute immediate v_sql;
end loop;
close c1;
end;