在程序中使用ADO链接Oracle时候,传递以下SQL执行会出现错误。但是直接拷贝到SQLPlus中执行返回的结果又是正常的。什么原因,请指教。谢谢!
select case when refuse=1 then 'yes' else 'no' end temprefuse from userlog

解决方案 »

  1.   

    补充一下,以上开发环境是在Delphi6.0下进行的
      

  2.   

    建议采用ODBC方式。用ADO连接好象很难实现。并且我以前用ADO连接也出错!
      

  3.   

    我用ADO其他方面问题倒没有,就是问题中那种SQL,比较经常需要用到。以前用SQLServer 没问题,现在用Oracle就不行了,但是在SQLPlus中又可以,烦恼中。
      

  4.   

    好像不能这样写:你按如下格式改一下试试:
    SELECT *
       CASE state
          WHEN 'CA' THEN 'California'
          WHEN 'KS' THEN 'Kansas'
          WHEN 'TN' THEN 'Tennessee'
          WHEN 'OR' THEN 'Oregon'
          WHEN 'MI' THEN 'Michigan'
          WHEN 'IN' THEN 'Indiana'
          WHEN 'MD' THEN 'Maryland'
          WHEN 'UT' THEN 'Utah'
            END
    FROM table
      

  5.   

    select case when refuse=1 then 'yes' else 'no' end  AS<-----/*尝试加AS*/
     temprefuse from userlog
      

  6.   

    我的语句在SQLPlus中调试已经可以了。
    1。select case when refuse=1 then 'yes' else 'no' end temprefuse from userlog
    2。select case when refuse=1 then 100 else 101 end temprefuse from userlog
    两句都可以但是当用ADOQuery执行时候会弹出CPU什么错误来。
    TempSQL:='select case when refuse=1 then ''yes'' else ''no'' end temprefuse from userlog';
    With TempQuery do
    begin
      Close;
      SQL.Clear;
      SQL.Add(TempSQL);
      Open;//此处出现CPU什么东东错误了。但是如果把上方2。的SQL传递进去可以返回数据
    end;