问题
Possible Duplicate:
How to use BOOLEAN type in SELECT statement
I have tried running SQLPLUS on functions I've written which return the BOOLEAN data type. Is there any way to run these BOOLEAN functions from SQLPLUS? It seems that the BOOLEAN data type is not accessible at all from SQLPLUS.
EDIT: I should have mentioned I was only working with SQLPLUS bind variables, not the standard DECLARE... PLSQL variables.
回答1:
The BOOLEAN
data type is defined in PL/SQL but not SQL. If you are writing PL/SQL, you can happily use BOOLEAN
types from within SQL*Plus or any other tool.
DECLARE
l_some_bool BOOLEAN := true;
BEGIN
IF( l_some_bool )
THEN
dbms_output.put_line( 'true' );
END IF;
END;
If you are writing SQL, however, you cannot use BOOLEAN
types regardless of the tool you are using because the SQL language doesn't recognize the type. A function that returns a BOOLEAN
, for example, cannot be called in a SQL statement.
来源:https://stackoverflow.com/questions/11848559/plsql-possible-to-use-boolean-datatype-in-sqlplus