create or replace procedure shiwu
as
sql_t  VARCHAR2(5000);
begin 
 
sql_t:='       analyze table tbl_trans_inter_data_ict compute statistics  ';
sql_t:=sql_t || '       FOR TABLE';
sql_t:=sql_t || '       FOR ALL  INDEXES';
sql_t:=sql_t || '        FOR ALL  COLUMNS;';
execute  immediate  sql_t;
    commit;
end 上面是一个表分析的存储过程错误如下:
PROCEDURE NC35.SHIWU 编译错误错误:PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
        ; <an identifier>
          <a double-quoted delimited-identifier> delete exists prior
          <a single-quoted SQL string>
       符号 ";" 被替换为 "end-of-file" 后继续。
行:12
文本:end请问哪里错了,谢谢

解决方案 »

  1.   

    end 后面少了分号!
    end;
      

  2.   

    create or replace procedure shiwu
    as
    sql_t VARCHAR2(5000);
    begin  
     
    sql_t:=' analyze table tbl_trans_inter_data_ict compute statistics ';
    sql_t:=sql_t || ' FOR TABLE';
    sql_t:=sql_t || ' FOR ALL INDEXES';
    sql_t:=sql_t || ' FOR ALL COLUMNS;';
    execute immediate sql_t;
      commit;
    end  这里execute immediate sql_t;
    sql_t:=sql_t || ' FOR TABLE';
    sql_t:=sql_t || ' FOR ALL INDEXES';
    sql_t:=sql_t || ' FOR ALL COLUMNS;';
    最后的sql_t是什么啊!
      

  3.   

    sql_t:='analyze table tbl_trans_inter_data_ict compute statistics FOR TABLE FOR ALL INDEXES FOR ALL COLUMNS;';就是这样的,'||'这个是Oracle 的字符连接符。