我想在存储过程里面查一个语句
传进的参数是不带单引号的。怎么加啊select * from table where  REPORT_MONTHLY in ('2008-05','2008-04','2008-06')
但是在传进去参数的时候是不带单引号的。
在存储过程里面怎么加上单引号啊

解决方案 »

  1.   

    不太明白你的意思。
    你是不是说传进去的是2008-05,然后在存储过程里变成'2008-05',再放到sql中?
    我很想说“不能”,又想问“何必要这样做呢?哪个架构师让你设计这样的解决方案?”。
    还是看看楼下怎么说吧!
      

  2.   

    假设你传进来的是thedate这个变量,在存储过程里你应该这样写:
    sqlstr:='select * from table where report_monthly in ('''||thedate||''')';也就是= select * from table where report_monthly in ('||thedate||');
      

  3.   

    再说下,多个变量用逗号隔开
    select * from table where report_monthly in (' ¦ ¦thedate ¦ ¦','||secdate||','||thirddate||');
      

  4.   

    select * from table where  REPORT_MONTHLY in (''2008-05'',''2008-04'',''2008-06'') 
      

  5.   

    select * from table where  REPORT_MONTHLY in ('''2008-05''','''2008-04''','''2008-06''') =>-------------------------REPORT_MONTHLY
    '2008-04'
    '2008-05'
    '2008-06'