Updating table with Modified date/time when updating any row
632909Feb 24 2010 — edited Feb 25 2010Hi guys,
What I am trying to do is this. I have a several rows in my table, alongwith the field 'Modified_date'. I want to insert a modified_date if and when I update the row in the table. Here's my code, but it's not working:
PROCEDURE ip_maint_save (p_submit IN VARCHAR2 DEFAULT NULL ,
p_user_no IN varchar_array_type,
p_user_id IN varchar_array_type,
p_ip_first IN varchar_array_type,
p_ip_last IN varchar_array_type,
p_user_type IN varchar_array_type,
p_user_language IN varchar_array_type,
p_blue_jays IN varchar_array_type,
p_created_by IN varchar_array_type,
p_modified_by IN varchar_array_type,
p_modified_date IN DATE := SYSDATE
)
IS
v_count_rec PLS_INTEGER := 0;
BEGIN
FOR i IN NVL (p_user_no.FIRST, 1) .. NVL (p_user_no.LAST, 0) LOOP
IF p_user_id (i) IS NOT NULL THEN
BEGIN
UPDATE IP_MAP
SET IP_FIRST = p_ip_first (i),
IP_LAST = p_ip_last (i),
USER_ID = p_user_id (i),
USER_TYPE = p_user_type (i),
USER_language = p_user_language (i),
IP_FIRST_number = Mr_Ip_Maint.ip_to_number (p_ip_first (i)),
IP_LAST_number = Mr_Ip_Maint.ip_to_number (p_ip_last (i)),
MODIFIED_DATE = p_modified_date (i)
WHERE USER_NO = p_user_no (i);
.....rest of the code/exceptions follow....
It's not working. Although, I am able to update a row, but it's not inserting/updating the modified_date field in the table for which the row is updated.
Thanks in advance.