Re: (ancient history) 668: System command cannot be executed, 255: Not in transaction
Posted in 2006
"Jonathan Leffler" <jleffler.iiug@gmail.com> wrote in message
news:1144442494.824377.268890@e56g2000cwe.googlegroups.com...
> In December 2005, "Frank" <fmor...@yahoo.com> asked:
>>I'm just trying to update a table and it's giving me the following
>>errors:
>>668: System command cannot be executed.
>>255: Not in transaction.>
> Back in December, people partially identified the problem - there was a
> stored procedure called from a trigger that used the SYSTEM statement
> and the SYSTEM statement was failing in some way.
>
> However, I ran across the problem again today, in a marginally
> different form, and realized that the problem was in part a misleading
> error message (668).
>
> Consider the stored procedure that follows:
> CREATE PROCEDURE exitfail(i INTEGER DEFAULT 0)
> DEFINE cmd VARCHAR(20);> DEFINE n VARCHAR(12);
> LET n = i;
> LET cmd = "exit " || TRIM(n);
> SYSTEM cmd;
> END PROCEDURE;
> * If you run it with no argument or with argument 0, you get success.
> * If you run it with argument 1, you get SQL -668 "System command
> cannot be executed" and ISAM -1 "Not owner".
> * If you run it with argument 255, you get SQL -668 and ISAM -255 "Not
> in transaction".
> * In other words, choose your poison error message!
> The problem is not that the system command cannot be executed, but
> that the command executed and returned a non-zero exit status.
>
> This is the top part of the PTS Bug number B176705. For the time
> being, you should be aware that error 668 could be better phrased as
> "System command cannot be executed or exited with non-zero status".
A work-around based on the above procedure follows below:
CREATE PROCEDURE system_test(result INTEGER DEFAULT 0)
DEFINE sql INTEGER;
DEFINE isam INTEGER;
DEFINE cmd CHAR(20);
ON EXCEPTION IN (-668) SET sql, isam
RAISE EXCEPTION -746, 0,
'System command returned ' || - isam;
END EXCEPTION
LET cmd = "exit " || result;
SYSTEM cmd;
END PROCEDURE;
EXECUTE PROCEDURE system_test(1);
This displays:
SQL Error (-746): System command returned 1
--
Regards,
Doug Lawry
www.douglawry.webhop.org