So, I know that I can return a SQL Error message from my SQL Procedure written in ObjectScript, with code like this
$ cat <<EOF | irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER
CREATE or REPLACE PROCEDURE test()
LANGUAGE OBJECTSCRIPT
{
SET %sqlcontext.%SQLCODE = 400
SET %sqlcontext.%ROWCOUNT = -1
SET %sqlcontext.%Message = "test error message"
};
CALL test();
EOF
[SQLCODE: <-400>:<Fatal error occurred>]
[Location: <SPFunction>]
[%msg: <test error message>]
But I did not find how to do it with Python. I can't find %sqlcontext
variable available there