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;
你是對的我的朋友...我不得不將檢查添加到類型主體...我們在這裏做的事情真奇怪...謝謝 –