Here's another approach. Create a new function that acts similarly to Oracle's NVL function with a slight twist - it returns a character string. Notice that I'm returning the empty string "" for your character variables, and returning "NULL" for numeric values.
/*
nvl_char: convert number to a character. If missing return the second value
Arguments:
one_value Numeric value to convert to a character
value_if_null Character string to return if one_value is missing
*/
nvl_char = Function( {one_value, value_if_null},
{Default Local},
if (is missing(one_value),
// then
value_if_null,
// else
char(one_value);
);
);
// Test out the function
nvl_char(123, "NULL");
nvl_char(., "NULL");
nvl_char(., "");
for (i = 1, i <= nrows(dt), i++,
sql_statement =
"INSERT INTO TBL_COMBINED_STG " ||
"(Y_AXIS, PROD, LOT, TERM, BIAS, ESTIMATE, STD_ERROR, TRATIO, PROB_T) " ||
"VALUES(" ||
"'" || nvl_char(column(1)[i], "") || "', " ||
"'" || nvl_char(column(2)[i], "") || "', " ||
"'" || nvl_char(column(3)[i], "") || "', " ||
"'" || nvl_char(column(4)[i], "") || "', 0," ||
//char(column(5)) || ", " ||
nvl_char(column(6)[i], "NULL") || ", " ||
nvl_char(column(7)[i], "NULL") || ", " ||
nvl_char(column(8)[i], "NULL") || ", " ||
nvl_char(column(9)[i], "NULL") || ") ";
// JMP will add a commit to the insert statement.
Execute SQL(dbc, sql_statement);
);