where  ny=to_char(add_months(sysdate,-1),'yyyymm')-1

解决方案 »

  1.   

    不需要-1
    where  ny=to_char(add_months(sysdate,-1),'yyyymm')
      

  2.   

    ny=to_char(add_months(sysdate,-1),'yyyymm')
      

  3.   

    楼上的,用ny=to_char(add_months(sysdate,-1),'yyyymm'能实现上月的yyyymm的目的,可我是要放到串里去实现,也就是说原表也不是固定的,请帮我调试存储过程语句,sql_stmt := 'create table zl_temptab as select * from '||p_tabnam||' where ny=ny=to_char(add_months(sysdate,-1),'yyyymm')';
      

  4.   

    我把上面的句改成了,如下语句后,编译ok了,谢谢各位帮忙,我要结帖了。nyny :=to_char(add_months(sysdate,-1),'yyyymm');
       sql_stmt := 'create table zl_temptab as select * from '||p_tabnam||' where ny='||nyny;