The customer has created a new custom field based on another custom field in the same entity.

The sql query is validated successfully. But when publishing, it gives the following error.

In other posts which has reported the similar error had mentioned about the query returning null values could cause this error. Hence I’ve modified the query as below (PRIORITY is a NUMBER column).
SELECT nvl(PRIORITY, 0)
FROM ifsapp.CUSTOMER_ORDER_CFV
WHERE ORDER_NO=SUBSTR(:CF$_ALIMEX_ORDER_NO, 1, INSTR(:CF$_ALIMEX_ORDER_NO, '-') - 1)
But it still causes the error.
Could someone please assist what could be the issue here?