0
我有一个INSERT/UPDATE过程,只会在更改现有“名称”时更新。需要帮助理解和插入/更新程序
我向java添加了一个代码字段,并且希望将代码更新到现有表,而不必修改“名称”,因为它已经存在。如果我修改“名称”,则“代码”将更新到表格中的那一行。
有人可以帮助我了解最新进展或我需要修改的内容吗?
感谢
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;
你是对的我的朋友...我不得不将检查添加到类型主体...我们在这里做的事情真奇怪...谢谢 –