page219
305
sql_stmt += " AND s.operation = 'I'\n"
sql_stmt += " AND s.region_name = '" + P_REGION + "' THEN\n"
sql_stmt += " INSERT ( customer_key,\n"
sql_stmt += " customer_name,\n"
sql_stmt += " order_key,\n"
sql_stmt += " order_date,\n"
sql_stmt += " nation_name,\n"
sql_stmt += " region_name )\n"
sql_stmt += " VALUES ( s.customer_key,\n"
sql_stmt += " s.customer_name,\n"
sql_stmt += " s.order_key,\n"
sql_stmt += " s.order_date,\n"
sql_stmt += " s.nation_name,\n"
sql_stmt += " s.region_name );\n"
stmt = snowflake.createStatement( { sqlText: sql_stmt } );
try
{
stmt.execute();
result = "Success: Rows Affected: " + stmt.getNumRowsAffected()
+ " Deleted: " + stmt.getNumRowsDeleted() + " Updated: " + stmt.
getNumRowsUpdated() + " Inserted: " + stmt.getNumRowsInserted();
}
catch(err)
{
err_state += "\nFail Code: " + err.code;
err_state += "\nState: " + err.state;
err_state += "\nMessage: " + err.message;
err_state += "\nStack Trace:" + err.StackTraceTxt;
err_state += "\nSQL Statement:\n\n" + sql_stmt;
result = err_state;
}
return result;
$$;
Chapter 8
parallelization