a. Firebird can sometimes convert between data types automatically. However BIN_AND is overloaded function - it can return either INTERGER or BIGINT depending on its arguments, so it needs to know the types during statement prepare (conversion string->number would be done during execution, which is too late in this case)
b. even if it is legal to override internal functions, I do not think it is good idea. Ivan -----P?vodni zprava----- From: Keisuke Kumakura Sent: Tuesday, October 29, 2013 1:34 AM To: [email protected] Subject: [firebird-support] bin_and() in Firebird 2.5.2 Hello, The SQL statement: select some from foo where bin_and(bar, '2')<>0; results in the error: Arguments for BIN_AND must be integral types or NUMERIC/DECIMAL without scale But if we omit single quote around 2(i.e., bin_and(bar, 2)<>0), the statement is executed fine. If we declare the following function, the statement is executed fine irrespective of bin_and(bar, '2') or bin_and(bar, 2). DECLARE EXTERNAL FUNCTION bin_and INTEGER, INTEGER RETURNS INTEGER BY VALUE ENTRY_POINT 'IB_UDF_bin_and' MODULE_NAME 'ib_udf'; a. Is it illegal to single-quote numeric(e.g., '2') ? b. Does overriding internal bin_and, bin_or functions pose any problems for firebird utilities like gbak, nbackup and others ? regards, K. Kumakura ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links
