Oracle nls length semantics
Jump to navigation
Jump to search
Questo breve script plsql converte tutte le colonne VARCHAR2 e CHAR da BYTE a CHAR:
begin
for c1 in (select owner,table_name,column_name,data_type,data_length
from dba_tab_columns where data_type in ('VARCHAR2','CHAR')
and char_used='B' and owner in ('USER1','USER2'))
loop
begin
execute immediate 'alter table ' || c1.owner || '.' || c1.table_name || ' modify ' ||
c1.column_name || ' ' || c1.data_type || '( ' || c1.data_length || ' char)';
exception
when others
then
null;
end;
end loop;
end;
/