PLSQL:可以在SQLPLUS中使用BOOLEAN数据类型吗? [英] PLSQL: Possible to use BOOLEAN datatype in SQLPLUS?
问题描述
可能重复:
如何在SELECT语句中使用BOOLEAN类型
Possible Duplicate:
How to use BOOLEAN type in SELECT statement
我尝试在我编写的返回BOOLEAN数据类型的函数上运行SQLPLUS.有什么方法可以从SQLPLUS运行这些BOOLEAN函数吗?似乎根本无法从SQLPLUS访问BOOLEAN数据类型.
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.
我应该提到我仅使用SQLPLUS绑定变量,而不使用标准的DECLARE ... PLSQL变量.
I should have mentioned I was only working with SQLPLUS bind variables, not the standard DECLARE... PLSQL variables.
推荐答案
BOOLEAN
数据类型是在PL/SQL中定义的,但不是在SQL中定义的.如果您正在编写PL/SQL,则可以在SQL * Plus或任何其他工具中愉快地使用BOOLEAN
类型.
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;
但是,如果您正在编写SQL,则无论使用哪种工具,都不能使用BOOLEAN
类型,因为SQL语言无法识别该类型.例如,不能在SQL语句中调用返回BOOLEAN
的函数.
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.
这篇关于PLSQL:可以在SQLPLUS中使用BOOLEAN数据类型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!