添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact [email protected].
  • Subject : Re: SQL: CASE WHEN EXISTS Problem
  • From : "Lennon_s_j@xxxxxxxxxxx" <lennon_s_j@xxxxxxxxxxx>
  • Date : Fri, 18 Mar 2011 18:31:54 -0400
  • List-archive : < http://archive.midrange.com/midrange-l >
  • List-help : < mailto:[email protected]?subject=help >
  • List-id : Midrange Systems Technical Discussion <midrange-l.midrange.com>
  • List-post : < mailto:[email protected] >
  • List-subscribe : < http://lists.midrange.com/mailman/listinfo/midrange-l >, < mailto:[email protected]?subject=subscribe >
  • List-unsubscribe : < http://lists.midrange.com/mailman/listinfo/midrange-l >, < mailto:[email protected]?subject=unsubscribe >
  • On 3/18/2011 3:12 PM, Tom E Stieger wrote:
    I have an SQL view that is basically doing the following, in addition to a bunch of other stuff:
    SELECT
    CASE WHEN (SELECT 1 FROM SYSIBM.SYSDUMMY1) IS NOT NULL
    THEN 'I am awesome'
    ELSE 'The computer has won' END
    FROM SYSIBM.SYSDUMMY1
    This was working fine until the subselect ended up being 2 rows such as this:
    SELECT
    CASE WHEN (SELECT 1 FROM SYSIBM.SYSDUMMY1
    UNION SELECT 2 FROM SYSIBM.SYSDUMMY1 ) IS NOT NULL
    THEN 'I am awesome'
    ELSE 'The computer has won' END
    FROM SYSIBM.SYSDUMMY1
    This gives the following Message: [SQL0811] Result of SELECT more than one row.
    It looks like I should be able to use an EXISTS predicate, but I can't seem to get that to work either.
    SELECT
    CASE WHEN EXISTS (SELECT 1 FROM SYSIBM.SYSDUMMY1)
    THEN 'I am awesome'
    ELSE 'The computer has won' END
    FROM SYSIBM.SYSDUMMY1
    This gives the follwing Message: [SQL0104] Token EXISTS was not valid. Valid tokens:<IDENTIFIER> <INTEGER> <CHARSTRING> <GRAPHSTRING>
    Using IN didn't work either, giving the following Message: [SQL0115] Comparison operator IN not valid.
    I'm not quite sure what else to try, any help would be appreciated. Thanks.
    -Tom Stieger
    California Fine Wire
    [javascript protected email address] .

    Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.