PowerBuilder · Database exception

SQLDBCode 24347 (Oracle ORA-24347 Null in Aggregate)

What does SQLDBCode 24347 (Oracle ORA-24347 Null in Aggregate) mean in PowerBuilder?

SQLCA.SQLDBCode returns 24347, Oracle's ORA-24347 warning, when an embedded SQL or DataWindow query runs an aggregate such as SUM() over a column that contains NULL values. The same statement can run cleanly outside PowerBuilder (e.g. in SQL*Plus) while PowerBuilder surfaces it as a database error through SQLDBCode.

SQLDBCode 24347 (Oracle ORA-24347 Null in Aggregate)PowerBuilder Classic · Appeon PowerBuilder

Condition

SQLCA.SQLDBCode returns 24347, Oracle's ORA-24347 warning, when an embedded SQL or DataWindow query runs an aggregate such as SUM() over a column that contains NULL values. The same statement can run cleanly outside PowerBuilder (e.g. in SQL*Plus) while PowerBuilder surfaces it as a database error through SQLDBCode.

Fix

Wrap the aggregated column in NVL(column, 0) (or the equivalent COALESCE) so NULLs are converted before the aggregate runs, which eliminates the ORA-24347 warning PowerBuilder otherwise reports as a failure. Confirm this at the SQL level rather than trying to suppress it in PowerScript, since it originates from Oracle's aggregate semantics.

Pending source verification. Not yet checked against official documentation.

Related database exception