declare strSql varchar2(2000);
begin
   strSql:='select t1.channel_name,(';
   strSql:=strSql||'select count(*) from cms_channel t where t.channel_id like ''substr(t1.channel_id,0,1)%''';
   strSql:=strSql||')num from cms_channel t1 where t1.channel_level = 1';
   execute immediate strSql;
end;
再帮我看一下这条数据那里有问题,看不到执行结果.java.sqlException 报无效索引列

解决方案 »

  1.   


    declare strSql varchar2(2000);
    begin
      strSql:='select t1.channel_name,(';
      strSql:=strSql||'select count(*) from cms_channel t where t.channel_id like substr(t1.channel_id,0,1)||''%''';
      strSql:=strSql||')num from cms_channel t1 where t1.channel_level = 1';
      execute immediate strSql;
    end;
      

  2.   

    like后面的单引号太乱了吧,
    strSql:=strSql||'select count(*) from cms_channel t where t.channel_id like substr(t1.channel_id,0,1)||'%'';