Subject mysterious error 335544347
Author Uwe Sander
Hi,

we have trouble with the following procedure:

ALTER PROCEDURE INSERT_NEW_THEME (
THM_NAME VARCHAR(128),
CLASS_ID SMALLINT,
OBJ_ID INTEGER,
PARAM_ID INTEGER,
USER_COUNT INTEGER)
RETURNS (
NEW_ID INTEGER)
AS
DECLARE VARIABLE NEW_UHI INTEGER;
BEGIN
new_id = gen_id (gen_thm_id, 1);
INSERT INTO thm (id, name) values (:new_id, :thm_name);

SELECT * FROM search_or_insert_rsp (:param_id, :user_count) INTO :new_uhi;

INSERT INTO guilt (thm_id, cls_id, obj_id) values (:new_id, :class_id,
:obj_id);
INSERT INTO guilt (thm_id, cls_id, obj_id) values (:new_id, 2, :new_uhi);

suspend;
END

The error mentioned in the subject line occurs, complaining that the value for
the field 'obj_id' would be NULL. We are sure that this is never the case and
the error disappears if we modify the line before 'suspend' to:

INSERT INTO guilt (thm_id, cls_id, obj_id) values (:new_id, cast (2 as
SMALLINT), :new_uhi);

Indeed, the column cls_id is defined as SMALLINT, but is this cast really
necessary?


Thanks

Uwe