%Get() method on result set can i set a default value if column return empty string
Hi all,
I am using ExecDirect() method to get SQL resultset of type %SQL.StatementResult.
now I am fetch a column something like this rs.%Get("Amount") but if amount column is empty then it is return me empty string. If There is any way to set something like this in IRIS rs.%Get("Amount",0.00) if that is possible.
Product version: IRIS 2023.2
Discussion (2)2
Comments
%Get()in %SQL.StatementResult. does NOT act like $Get() in ObjectScript
You have to resolve the NULL value issue in your SQL statement using NVL() function with 2nd parameter.
More NULL Handling Functions
I commonly will use COALESCE in my SQL statements when I want to define an default value, as an example I would do
SELECTCOALESCE(Amount,0.00)