Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

DML Handler for update - need help

Sharas VitalapuramDec 12 2005 — edited Jan 16 2006
Hi,
I am trying a simple DML handler to INSERT all the column values in a target table (CHANNELS_DML)..which are sourced from an updated table (CHANNEL). Both of these tables are in the same database.

Here is the procedure I'm using for this purpose..
+++++++++++++++++
CREATE OR REPLACE PROCEDURE chn_dml_handler(in_any IN ANYDATA) IS
lcr SYS.LCR$_ROW_RECORD;
rc PLS_INTEGER;
command VARCHAR2(30);
old_values SYS.LCR$_ROW_LIST;
old_pk_val sys.anydata;
new_values SYS.LCR$_ROW_LIST := NULL;
BEGIN
rc := in_any.GETOBJECT(lcr);
command := lcr.GET_COMMAND_TYPE;
old_values := lcr.GET_VALUES('old');
new_values := lcr.GET_VALUES('new');

IF command = 'UPDATE' THEN
old_values := lcr.GET_VALUES('old','y');
lcr.SET_VALUES('new', old_values);
lcr.ADD_COLUMN('new', 'TIMESTAMP', ANYDATA.ConvertDate(SYSDATE));
lcr.ADD_COLUMN('new', 'OPERATION', ANYDATA.Convertvarchar2('UPDATE'));
lcr.SET_COMMAND_TYPE('INSERT');
lcr.SET_OBJECT_NAME('CHANNELS_DML');
ELSIF command = 'DELETE' THEN
lcr.SET_COMMAND_TYPE('INSERT');
lcr.SET_OBJECT_NAME('CHANNELS_DML');
lcr.SET_VALUES('new', old_values);
lcr.SET_VALUES('old', NULL);
lcr.ADD_COLUMN('new', 'TIMESTAMP', ANYDATA.ConvertDate(SYSDATE));
lcr.ADD_COLUMN('new', 'OPERATION', ANYDATA.Convertvarchar2('DELETE'));
ELSE
lcr.SET_COMMAND_TYPE('INSERT');
lcr.SET_OBJECT_NAME('CHANNELS_DML');
lcr.ADD_COLUMN('new', 'TIMESTAMP', ANYDATA.ConvertDate(SYSDATE));
lcr.ADD_COLUMN('new', 'OPERATION', ANYDATA.Convertvarchar2('INSERT'));
END IF;
lcr.EXECUTE(true);
END;
/
++++++++++++++++++++

INSERT, DELETE are working fine. However, when it comes to UPDATE I encounter "ORA-23605: invalid value "" for STREAMS parameter command_type".

Would appreciate, if you can point me to any missed steps!

Both source, target tables have the pk and supplemental logging is enabled for all the source tbl columns. (BTW, is it mandatory to enable supplemental logging ?)


Thanks,
Sharas

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 13 2006
Added on Dec 12 2005
2 comments
799 views