varcontinue_handler_1=function (error) { {V_SQL_VALUE=SQLSTATE;V_EXCEPTION_FLAG=`Y`; }};// Main error-handling routinevarERROR_HANDLERS=function (error) {switch(error.state) {//Conversion Warning - handlers for the switch default (SQLWARNING/SQLEXCEPTION/NOT FOUND) can be the followingdefault:continue_handler_1(error); }};
INSERT_TEMP
This helper has been deprecated in stored procedures since version 2.0.15.
A function to create a temporary table using the argument query with the given parameters.
A function that validates when a SELECT returns no values or a sentence affects zero rows. This is done in order to emulate the same behavior as Teradata, when there are exits or continue handlers for NOT FOUND EXCEPTIONS.
letIS_NOT_FOUND= (stmt) => {let n =-1;let cmd =stmt.getSqlText().replace(newRegExp("\\/\\*.*\\*\\/","gsi"),"").replace(newRegExp("--.*?\\n","gsi"),"");let matched =cmd.match(newRegExp("\\s*(\\w+)\\s+"),"");if (matched) { cmd = matched[1].toUpperCase();switch(cmd) {case"CALL":case"DROP":case"CREATE":case"ALTER":case"SELECT": n =stmt.getRowCount();break;default:n =stmt.getNumRowsAffected();break; } }return n ==0; };
HANDLE_NOTFOUND()
This function uses the above IS_NOT_FOUND function to validate when an artificial error 'NOT FOUND' is being thrown.