Missing ")" bracket in generated code

i have my onAfterInsert event coded

sc_exec_sql("INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, ‘pay’, 998 ) ; ");

But in the generated SC code (i grabbed in server) it missed the “)” (as below, AFTER 998) in file “EmployeeHistory_apl.php”
$nm_select ="INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( $this->person_id , $this->person_type , $this->effective , ‘pay’, 998;

It’s a serious bug and kindly fix it ASAP.

I am not able to proceed…

Maybe ; is not necesary.

what do you mean?

Or probably you can tell me what’s the next step? :slight_smile:

I have re-verified and run in DB tool, it’s a valid SQL statement, and sc_exec_sql is vaid to run in onAfterInsert event
sc_exec_sql("INSERT INTO hcm_emp_salary (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, ‘pay’, 998 ) ; ");

i really don’t know what else to do to fix the issue.

Plz help & thanks :slight_smile:

i can confirmed it’s a BUG
coz i tried following statement and it worked !

sc_exec_sql("INSERT INTO hcm_emp_salary set person_id = {person_id} , person_type = ‘{person_type}’ , effective = ‘{effective}’, pay_cd = ‘pay’ , amount = 12345 ; ");

says well alvagar.
the ‘;’ NOT must be added if the statement is a parameter of a function.
sc_exec_sql (“INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, ‘pay’, 998 )”);
is equivalent to:
sSql = “INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, ‘pay’, 998 )”;
sc_exec_sql (sSql);
hello
Henry

The fact that the other statement with the ‘;’ works is the real bug as it shouldn’t. You don’t close sql statements with a ‘;’ within a variable, which is standard to embedded sql drivers. So leave that out your original code should work. Feature request would be that SC will generate an errorlist while parsing. These problems are hard to find sometimes, especiallly when you have a lot of custom code.