I have an INSERT/UPDATE Procedure that will only seem to update when I change the existing “name”.
I added a code field to the java, and want to update the code to the existing table without having to modify the “name” because it already exists. If I modify the “name” then the “code” will get updated to that row in the table.
Can someone help me understand whats going or what I need to modify?
thanks
PROCEDURE update_things
(things IN OUT things_bean, user_id IN NUMBER)
IS
t_things things_bean;
BEGIN
-- If there is already an id set ... this is an update
IF things.ID <> 0
THEN
SELECT things_bean (ID, NAME, code, work, foo)
INTO t_things
FROM things
WHERE things.ID = ID;
IF NOT things.equals (t_things)
THEN
things.foo:= t_things.foo;
things.foo.modified_date := SYSDATE;
things.foo.modified_by := user_id;
UPDATE things
SET NAME = things.NAME,
code = things.code,
foo= things.foo
WHERE ID = things.ID;
END IF;
END update_things;
looks to me like you should check this call:
to make sure your code value is part of the equality check.