Greetings from a first time forum poster. I’ve created a stored procedure via the SC database builder interface. I’ve tested it there and it works without issue. However, when calling it via an sc_exec_sql macro it fails with an error message (debug mode):
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘proc_insert_company(30)’ at line 1.
The procedure is as follows:
proc_insert_company | IN usrid int 11
BEGIN
INSERT INTO tbl_company(create_user_id) VALUES (usrid);
INSERT INTO tbl_user_company
(user_co_user_id, user_co_co_id, create_user_id)
SELECT create_user_id, id, create_user_id
FROM tbl_company
WHERE create_user_id = usrid;
END
The event I’m calling it from is the OnAfterInsert.
The code used is:
sc_exec_sql(“proc_insert_company($usrid)”);
$usrid is based on a lookup and as you can see from the above error, it’s passing the correct value of 30. Any suggestions would be great.
Cheers