The following lines contain the word 'select', 'insert', 'update' or 'delete':
x_last_update_date VARCHAR2,
x_force_edits VARCHAR2 ) IS
v_creation_date date;
vf_ludate DATE := to_date(x_last_update_date, 'DD-MM-YYYY HH:MI:SS');
select creation_date, last_update_date
from JAI_RGM_DEFINITIONS
where regime_code = x_regime_code ;
/* Check if the row exists in the database. If it does, retrieves the creation date for update_row. */
OPEN cur_creation_date ;
/* Removed the check for userid and added check using last_update_date
for bug 4967445 */
/* Update only if force_edits is 'Y' or if vf_ludate > vd_ludate */
if ( vf_ludate > vd_ludate or X_Force_Edits = 'Y' ) then
-- update row if present
jai_rgm_defs_pkg.Update_Row(
X_Rowid => v_rowid,
X_regime_code => X_regime_code ,
x_description => x_description ,
x_creation_date => v_creation_date,
X_last_update_date => vf_ludate,
X_last_updated_by => v_user_id,
X_last_update_login => 0);
jai_rgm_defs_pkg.Insert_Row(
X_Rowid => v_rowid,
X_regime_code => X_regime_code ,
x_description => x_description ,
X_last_update_date => vf_ludate,
X_last_updated_by => v_user_id,
X_creation_date => sysdate,
X_created_by => v_user_id,
X_last_update_login => 0) ;
PROCEDURE Insert_Row(
X_Rowid IN OUT NOCOPY ROWID,
X_regime_code VARCHAR2,
x_description VARCHAR2,
X_last_update_date DATE,
X_last_updated_by NUMBER,
X_creation_date DATE ,
X_created_by NUMBER,
X_last_update_login NUMBER) IS
CURSOR C_REGIME_ID IS SELECT JAI_RGM_DEFINITIONS_S.nextval FROM dual;
INSERT INTO JAI_RGM_DEFINITIONS(
regime_id ,
regime_code ,
description ,
creation_date ,
created_by ,
last_update_date ,
last_updated_by ,
last_update_login
)
SELECT
x_regime_id ,
X_regime_code ,
x_description ,
X_creation_date ,
X_created_by ,
X_last_update_date ,
X_last_updated_by ,
X_last_update_login
FROM DUAL ;
END Insert_Row;
PROCEDURE Update_Row(X_Rowid IN OUT NOCOPY ROWID,
X_regime_code VARCHAR2,
x_description VARCHAR2,
x_creation_date DATE,
X_last_update_date DATE,
X_last_updated_by NUMBER,
X_last_update_login NUMBER)
IS
BEGIN
UPDATE JAI_RGM_DEFINITIONS
SET
regime_code = x_regime_code ,
description = x_description ,
creation_date = x_creation_date ,
last_update_date = x_last_update_date ,
last_updated_by = x_last_updated_by ,
last_update_login = x_last_update_login
WHERE
regime_code = x_regime_code;
END Update_Row;