我在一个存储过程写如下的语句:if ls_dblink is not null then                                                                         
   ls_sql := 'insert into t_dsdzmx' || ls_dblink ||                                                   
             '(dspc, dzlsh, sbpc, sblsh, fsrq, dzrq, tbsdm, sbbm, dwmc, tzny, ssrq,xzdm,              
               zmdm, je, hdfs, jffs, jfzt, jflx, zbz)||
             values                                               
            (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19)';
  execute immediate ls_sql                                                                            
    using (ln_dspc, ln_dzlsh, rec_data.dz_sbpc, rec_data.ys_sblsh, ld_sysdate, ld_jysj,               
           rec_data.dz_tbsdm, rec_data.dz_sbbm, rec_data.dj_dwmc, rec_data.dz_tzny,                   
           rec_data.dz_ssrq, rec_data.dz_xzdm, rec_data.dz_zmdm, rec_data.dz_je, rec_data.ys_hdfs,    
           rec_data.ys_jffs, rec_data.ys_jfzt, rec_data.ys_jflx, '2');                                
end if;         然后编译时报错:Error: PLS-00320: 此表达式的类型声明不完整或格式不正确
Line: 505
Text: using (ln_dspc, ln_dzlsh, rec_data.dz_sbpc, rec_data.ys_sblsh, ld_sysdate, ld_jysj, rec_data.dz_tbsdm, rec_data.dz_sbbm, rec_data.dj_dwmc, rec_data.dz_tzny, rec_data.dz_ssrq, rec_data.dz_xzdm, rec_data.dz_zmdm, rec_data.dz_je, rec_data.ys_hdfs, rec_data.ys_jffs, rec_data.ys_jfzt, rec_data.ys_jflx, '2');Error: PL/SQL: Statement ignored
Line: 504
Text: execute immediate ls_sql请帮忙看看这是为什么呢?应该怎么修改?

解决方案 »

  1.   

    PLS-00320 the declaration of the type of this expression is incomplete or malformedCause: In a declaration, the name of a variable or cursor is misspelled or the declaration makes a forward reference. Forward references are not allowed in PL/SQL. A variable or cursor must be declared before it is referenced it in other statements, including other declarative statements. For example, the following declaration of dept_rec raises this exception because it refers to a cursor not yet declared:DECLARE dept_rec  dept_cur%ROWTYPE; CURSOR dept_cur IS SELECT ...  ...
    Action: Check the spelling of all identifiers in the declaration. If necessary, move the declaration so that it makes no forward references.
      

  2.   

    using后面应用变量。你的那些是变量吗?是字段吧,还有最后一个‘2’是字符串吧要先声明再赋值
      

  3.   


    using后面的变量都已经声明的了,而且其余的cur_data是一个游标来的,rec_data是游标的当前记录值来的,在using后面不可以使用的么???
    还有‘2’要先声明一个字符串再赋值才可以的么?谢谢~
      

  4.   

    using (ln_dspc, ln_dzlsh, rec_data.dz_sbpc, rec_data.ys_sblsh, ld_sysdate, ld_jysj,              
              rec_data.dz_tbsdm, rec_data.dz_sbbm, rec_data.dj_dwmc, rec_data.dz_tzny,                  
              rec_data.dz_ssrq, rec_data.dz_xzdm, rec_data.dz_zmdm, rec_data.dz_je, rec_data.ys_hdfs,    
              rec_data.ys_jffs, rec_data.ys_jfzt, rec_data.ys_jflx, '2');  
    把USING中的括号去掉试试。