PLSQL: Possible to use BOOLEAN datatype in SQLPLUS? [duplicate]

徘徊边缘 提交于 2019-12-12 14:52:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!