How to use BOOLEAN type in SELECT statement

后端 未结 10 1373
鱼传尺愫
鱼传尺愫 2020-11-29 01:43

I have a PL/SQL function with BOOLEAN in parameter:

function get_something(name in varchar2, ignore_notfound in boolean);

This function is

10条回答
  •  悲&欢浪女
    2020-11-29 02:23

    From documentation:

    You cannot insert the values TRUE and FALSE into a database column. You cannot select or fetch column values into a BOOLEAN variable. Functions called from a SQL query cannot take any BOOLEAN parameters. Neither can built-in SQL functions such as TO_CHAR; to represent BOOLEAN values in output, you must use IF-THEN or CASE constructs to translate BOOLEANvalues into some other type, such as 0 or 1, 'Y' or 'N', 'true' or 'false', and so on.

    You will need to make a wrapper function that takes an SQL datatype and use it instead.

提交回复
热议问题