Boolean type in SELECT statement

Boolean type in SELECT statement

Post by earthlin » Fri, 16 Apr 1999 04:00:00



Hi,
can any tell me how to apply boolean type in SELECT statement?

e.g.

SELECT *
FROM my_table
WHERE my_boolean_func(my_table.applied_field) = true

 " my_boolean_func " will return either true or false.

TIA

Phil

 
 
 

Boolean type in SELECT statement

Post by Jonathan Genni » Sat, 17 Apr 1999 04:00:00


Phil,

SQL doesn't recognize BOOLEAN as a valid datatype. Even
though you can write a PL/SQL function to return true or
false, you can't use that return value in a SQL query. You
might try returning 0 or 1 instead.

Jonathan

---------------------------------------------------------------------
Jonathan Gennick

http://gennick.com

On Thu, 15 Apr 1999 18:44:43 -0700, "earthlink"


>can any tell me how to apply boolean type in SELECT statement?

>e.g.

>SELECT *
>FROM my_table
>WHERE my_boolean_func(my_table.applied_field) = true

> " my_boolean_func " will return either true or false.


 
 
 

1. Problems with JDBC and a DISTINCT Boolean Type in a Row Type

Hello,
I have problems with receiving a named ROW TYPE with a Distinct
Boolean Type as Attribute. I am using JDBC 2.11 and IDS 2000
Version 9.20.UC2 under Solaris 7.

I got the error message:
 -79716 System or internal error java.sql.SQLException: Type requested
 (boolean) doesn't match row type information (udt fixed) type.

Receiving the Distinct Boolean type directly works fine.
And using a Distinct Int in the named row type instead of Boolean
works fine, too.

Are there any known problems about using Distinct Boolean Types
in named Row Types?
I haven't found anything in the documentation and the release notes.

I have tried it with SQLData and Struct and always got the same
error message.

Here is some SQL-code:

CREATE DISTINCT TYPE boolean_ty AS boolean;

CREATE ROW TYPE boolean_row( value boolean_ty);

CREATE TABLE boolean_ta OF TYPE boolean_row;

INSERT INTO boolean_ta VALUES('t');
INSERT INTO boolean_ta VALUES('f');

And an excerpt from the Java-Code where the error occurred:

...
// getting connection ... etc
...
// Setting up typemap
   customtypemap.put("boolean_ty", Class.forName("boolean_ty"));
   customtypemap.put("boolean_row", Class.forName("boolean_row"));
// Both classes generated with ClassGenerator
...
   stmt = conn.createStatement();
   ResultSet rs = stmt.executeQuery("select boolean_ta from
boolean_ta");
   while (rs.next())
    {
        boolean_row val = (boolean_row)rs.getObject(1);
        System.out.println("Value : " + val);
    }
    stmt.close();
...

Is this a known problem or does anybody has a solution for this problem?

                                Wolfgang

--
No-one ever thinks of themselves as one of Them. We're always one of Us.
It's Them that do the bad things. (Sir Vimes of Ankh-Morpork City Watch)

2. Wanted - Info on how to specify database server

3. USING A FIELD FROM MAIN SELECT STATEMENT IN SUB SELECT STATEMENT

4. Help: Closing FPWin in an application

5. Formatting of DATETIME data type in SELECT statement

6. Using ADO with MS-Access and Excel 2000

7. Field Data Types in SELECT...INTO statements

8. ALTER TABLE ON MSSQL!?!?!?!

9. dynamic data-typing in OPENXML select statement

10. Problem with number data type in ADO Select SQL statement

11. Null type in SQL Select Statement

12. Boolean DATA type exist SQL server 7?

13. Is there a boolean data type?