Column “TRUE” cannot be found or is not specified for query

Posted by Pierre Blitzkow on 09-Jan-2017 13:58

Hello,

I am try to do a query using the WHERE with a field logical but recived the error: 

Column “TRUE” cannot be found or is not specified for query

If I take the logical field my query execute fine, look how I do:

"select \"usuario\", \"senha\", \"nome\", \"e-mail\", \"setor\", \"sca\" from PUB.\"scq-usuario\" where (PUB.\"scq-usuario\".\"sca\" = true) with (nolock)"

I ever try many ways but without success.

My program is build with java and DB OpenEdge 11.3.

Thanks for help!

Posted by steve pittman on 09-Jan-2017 14:30

Hi Pierre,
 
OE sql does not currently support the Boolean datatype as defined in the sql standard and as found in some other databases.
 
The ABL datatype “logical” is supported in OE sql as the type ‘bit” with value 0 or 1.  0 == False,  1 == True.
Please change your query to compare to 1 and it should run OK.
For example:

               "select \"usuario\", \"senha\", \"nome\", \"e-mail\", \"setor\", \"sca\"

            from PUB.\"scq-usuario\" where (PUB.\"scq-usuario\".\"sca\" = 1)   with (nolock)"

 
Hope this helps,       ….steve pittman  [sql dev software architect]
 
 

Posted by Brian K. Maher on 09-Jan-2017 14:24

ABL LOGICAL fields map to the SQL BIT data type so I believe you would need to use 1 for true and 0 for false.

All Replies

Posted by Brian K. Maher on 09-Jan-2017 14:10

Why do you have the left parentheses after “where “ and before “PUB” with no closing parentheses?
 
Brian

Posted by Brian K. Maher on 09-Jan-2017 14:18

I have been informed that there is a right parenthesis.  It was missing from the email I received in Outlook.  No idea why.

Posted by Brian K. Maher on 09-Jan-2017 14:24

ABL LOGICAL fields map to the SQL BIT data type so I believe you would need to use 1 for true and 0 for false.

Posted by steve pittman on 09-Jan-2017 14:30

Hi Pierre,
 
OE sql does not currently support the Boolean datatype as defined in the sql standard and as found in some other databases.
 
The ABL datatype “logical” is supported in OE sql as the type ‘bit” with value 0 or 1.  0 == False,  1 == True.
Please change your query to compare to 1 and it should run OK.
For example:

               "select \"usuario\", \"senha\", \"nome\", \"e-mail\", \"setor\", \"sca\"

            from PUB.\"scq-usuario\" where (PUB.\"scq-usuario\".\"sca\" = 1)   with (nolock)"

 
Hope this helps,       ….steve pittman  [sql dev software architect]
 
 

Posted by Pierre Blitzkow on 10-Jan-2017 03:55

Thank you very much for your help, this way query worked:

select \"usuario\", \"senha\", \"nome\", \"e-mail\", \"setor\", \"sca\" from PUB.\"scq-usuario\"  where (PUB.\"scq-usuario\".\"sca\" = 1) with (nolock)

This thread is closed