数据库空格问题
declare
tablenames varchar2(50);
var_sql varchar2(200);
Cursor tablename_cursor is
select t.table_name from user_tab_comments t where t.table_name like 'EXIT2010010500%';
begin
open tablename_cursor;
loop
fetch tablename_cursor into tablenames;
exit when tablename_cursor%notfound;
if tablename_cursor%found then
var_sql:='update test.'||tablenames||' t set t.vehiclelicense=t.vehiclelicenseauto where t.vehiclelicense=||' '; execute immediate var_sql;
end if;
end loop;
close tablename_cursor;
end;
问题:
var_sql:='update test.'||tablenames||' t set t.vehiclelicense=t.vehiclelicenseauto where t.vehiclelicense=||' ';这句中的空格一直显示错误。用了vehiclelicense is null也不行,用length(vehiclelicense)=0也不行,请大家帮忙看看!
[解决办法]
先对vehiclelicense字段trim一下,length(trim(vehiclelicense))=0
[解决办法]