bolean result in SQL (always odbc client access) - IBM AS400

This is a discussion on bolean result in SQL (always odbc client access) - IBM AS400 ; How can I make the following simple SELECT with AS400 SELECT a,(a=100 or a=50 or a=250) FROM mydb AS400 SQL not let me put conditions Boolean, It's possible? Thanks....

+ Reply to Thread
Results 1 to 3 of 3

Thread: bolean result in SQL (always odbc client access)

  1. bolean result in SQL (always odbc client access)


    How can I make the following simple SELECT with AS400

    SELECT a,(a=100 or a=50 or a=250) FROM mydb

    AS400 SQL not let me put conditions Boolean, It's possible?


    Thanks.

  2. Re: bolean result in SQL (always odbc client access)

    There is no Boolean data type in the DB2 for i5/OS SQL, so what is
    expressed for a Boolean result is of your choosing. The simplest
    solution for the given, with '1' used to represent true and '0' to
    represent false:

    select A
    , case when A in (50, 100, 250) then '1'
    else '0'
    end Bool /* this AS BOOL gives nicer column heading */
    from MYDB

    Regards, Chuck

    Xisco wrote:
    > How can I make the following simple SELECT with AS400
    >
    > SELECT a,(a=100 or a=50 or a=250) FROM mydb
    >
    > AS400 SQL not let me put conditions Boolean, It's possible?


  3. Re: bolean result in SQL (always odbc client access)



    CRPence ha escrito:
    > There is no Boolean data type in the DB2 for i5/OS SQL, so what is
    > expressed for a Boolean result is of your choosing. The simplest
    > solution for the given, with '1' used to represent true and '0' to
    > represent false:
    >
    > select A
    > , case when A in (50, 100, 250) then '1'
    > else '0'
    > end Bool /* this AS BOOL gives nicer column heading */
    > from MYDB
    >
    > Regards, Chuck
    >

    many, many thanks
    > Xisco wrote:
    > > How can I make the following simple SELECT with AS400
    > >
    > > SELECT a,(a=100 or a=50 or a=250) FROM mydb
    > >
    > > AS400 SQL not let me put conditions Boolean, It's possible?


+ Reply to Thread