function sometime returns a NULL value
Posted by:
Phong C
Date: April 05, 2024 01:20AM
I have the following query with a custom function. The get_test() function simply return the input variable. There are no complex calculations in the function.
Sometimes the query just return a NULL value while at other times it return the correct number(243). Not sure if anyone else is experiencing the same issue like this.
-------------
Query:
-------------
SELECT
dl.account_id AS 'accountId',
get_test(dl.account_id) AS 'test'
FROM document_line dl
JOIN document d
USING (document_id)
WHERE d.document_id = _document_id AND dl.line_amount != 0
-------------
Results:
-------------
"checks": [
{
"accountId": 243,
"test": null
},]
-------------
Function:
-------------
CREATE FUNCTION get_test(
_account_id SMALLINT UNSIGNED
)
RETURNS SMALLINT UNSIGNED
DETERMINISTIC
BEGIN
RETURN _account_id;
END
Subject
Written By
Posted
function sometime returns a NULL value
April 05, 2024 01:20AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.