The following lines contain the word 'select', 'insert', 'update' or 'delete':
ayedubat 11-JUN-2001 modified the BeforeRowInsertUpdateDelete1 to add a
new validation according to the DLD,PSP001-US */
l_rowid VARCHAR2(25);
x_last_update_date IN DATE DEFAULT NULL,
x_last_updated_by IN NUMBER DEFAULT NULL,
x_last_update_login IN NUMBER DEFAULT NULL
) AS
CURSOR cur_old_ref_values IS
SELECT *
FROM igs_ps_ref_cd
WHERE ROWID = x_rowid;
IF (cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT','VALIDATE_INSERT')) THEN
CLOSE cur_old_ref_values;
fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
IF (p_action = 'UPDATE') THEN
new_references.creation_date := old_references.creation_date;
new_references.last_update_date := x_last_update_date;
new_references.last_updated_by := x_last_updated_by;
new_references.last_update_login := x_last_update_login;
PROCEDURE beforerowinsertupdatedelete1(
p_inserting IN BOOLEAN DEFAULT FALSE,
p_updating IN BOOLEAN DEFAULT FALSE,
p_deleting IN BOOLEAN DEFAULT FALSE
) AS
v_description igs_ps_ref_cd.description%TYPE;
ELSE -- p_inserting or p_updating
v_course_cd := new_references.course_cd;
IF p_inserting OR
(p_updating AND
(old_references.reference_cd_type <> new_references.reference_cd_type)) THEN
IF igs_ps_val_crfc.crsp_val_ref_cd_type(
new_references.reference_cd_type,
v_message_name) = FALSE THEN
fnd_message.set_name('IGS',v_message_name);
SELECT decode(NVL(old_references.description,'NULL'),
NVL(new_references.description,'NULL'),
NULL,old_references.description)
INTO v_description
FROM dual;
old_references.last_update_date,
new_references.last_update_date,
old_references.last_updated_by,
v_description);
old_references.last_update_date,
SYSDATE,
old_references.last_updated_by,
old_references.description);
END beforerowinsertupdatedelete1;
PROCEDURE afterrowinsertupdate2(
p_inserting IN BOOLEAN DEFAULT FALSE,
p_updating IN BOOLEAN DEFAULT FALSE,
p_deleting IN BOOLEAN DEFAULT FALSE
) AS
v_message_name VARCHAR2(30);
IF p_inserting THEN
NULL;
END afterrowinsertupdate2;
fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
SELECT ROWID
FROM igs_ps_ref_cd
WHERE course_cd = x_course_cd
AND version_number = x_version_number
AND reference_cd_type = x_reference_cd_type
AND reference_cd = x_reference_cd
FOR UPDATE NOWAIT;
SELECT ROWID
FROM igs_ps_ref_cd
WHERE course_cd = x_course_cd
AND version_number = x_version_number
AND reference_cd_type = x_reference_cd_type
AND (l_rowid IS NULL OR ROWID <> l_rowid)
FOR UPDATE NOWAIT;
SELECT ROWID
FROM igs_ps_ref_cd
WHERE course_cd = x_course_cd
AND version_number = x_version_number ;
SELECT ROWID
FROM igs_ps_ref_cd
WHERE reference_cd_type = x_reference_cd_type ;
SELECT ROWID
FROM igs_ps_ref_cd
WHERE reference_cd_type = x_reference_cd_type
AND reference_cd = x_reference_cd ;
x_last_update_date IN DATE DEFAULT NULL,
x_last_updated_by IN NUMBER DEFAULT NULL,
x_last_update_login IN NUMBER DEFAULT NULL
) AS
BEGIN
set_column_values (
p_action,
x_rowid,
x_course_cd,
x_version_number,
x_reference_cd_type,
x_reference_cd,
x_description,
x_creation_date,
x_created_by,
x_last_update_date,
x_last_updated_by,
x_last_update_login
);
IF (p_action = 'INSERT') THEN
-- Call all the procedures related to Before Insert.
beforerowinsertupdatedelete1 ( p_inserting => TRUE );
ELSIF (p_action = 'UPDATE') THEN
-- Call all the procedures related to Before Update.
beforerowinsertupdatedelete1 ( p_updating => TRUE );
ELSIF (p_action = 'DELETE') THEN
-- Call all the procedures related to Before Delete.
beforerowinsertupdatedelete1 ( p_deleting => TRUE );
ELSIF (p_action = 'VALIDATE_INSERT') THEN
IF get_pk_for_validation(
new_references.course_cd ,
new_references.version_number ,
new_references.reference_cd_type ,
new_references.reference_cd ) THEN
fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
ELSIF (p_action = 'VALIDATE_UPDATE') THEN
check_uniqueness;
IF (p_action = 'INSERT') THEN
-- Call all the procedures related to After Insert.
afterrowinsertupdate2 ( p_inserting => TRUE );
ELSIF (p_action = 'UPDATE') THEN
-- Call all the procedures related to After Update.
afterrowinsertupdate2 ( p_updating => TRUE );
PROCEDURE insert_row (
x_rowid IN OUT NOCOPY VARCHAR2,
x_course_cd IN VARCHAR2,
x_version_number IN NUMBER,
x_reference_cd IN VARCHAR2,
x_reference_cd_type IN VARCHAR2,
x_description IN VARCHAR2,
x_mode IN VARCHAR2 DEFAULT 'R'
) AS
CURSOR c IS SELECT ROWID FROM igs_ps_ref_cd
WHERE course_cd = x_course_cd
AND version_number = x_version_number
AND reference_cd = x_reference_cd
AND reference_cd_type = x_reference_cd_type;
x_last_update_date DATE;
x_last_updated_by NUMBER;
x_last_update_login NUMBER;
x_last_update_date := SYSDATE;
x_last_updated_by := 1;
x_last_update_login := 0;
x_last_updated_by := fnd_global.user_id;
IF x_last_updated_by IS NULL THEN
x_last_updated_by := -1;
x_last_update_login :=fnd_global.login_id;
IF x_last_update_login IS NULL THEN
x_last_update_login := -1;
p_action => 'INSERT',
x_rowid => x_rowid,
x_course_cd => x_course_cd,
x_version_number => x_version_number,
x_reference_cd_type => x_reference_cd_type,
x_reference_cd => x_reference_cd,
x_description => x_description,
x_creation_date => x_last_update_date ,
x_created_by => x_last_updated_by ,
x_last_update_date => x_last_update_date ,
x_last_updated_by => x_last_updated_by ,
x_last_update_login => x_last_update_login
);
INSERT INTO igs_ps_ref_cd (
course_cd,
version_number,
reference_cd_type,
reference_cd,
description,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login)
VALUES (
new_references.course_cd,
new_references.version_number,
new_references.reference_cd_type,
new_references.reference_cd,
new_references.description,
x_last_update_date,
x_last_updated_by,
x_last_update_date,
x_last_updated_by,
x_last_update_login
);
p_action => 'INSERT',
x_rowid => x_rowid
);
END insert_row;
CURSOR c1 IS SELECT
description
FROM igs_ps_ref_cd
WHERE ROWID = x_rowid
FOR UPDATE NOWAIT;
fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
PROCEDURE update_row (
x_rowid IN VARCHAR2,
x_course_cd IN VARCHAR2,
x_version_number IN NUMBER,
x_reference_cd IN VARCHAR2,
x_reference_cd_type IN VARCHAR2,
x_description IN VARCHAR2,
x_mode IN VARCHAR2 DEFAULT 'R'
) AS
x_last_update_date DATE;
x_last_updated_by NUMBER;
x_last_update_login NUMBER;
x_last_update_date := SYSDATE;
x_last_updated_by := 1;
x_last_update_login := 0;
x_last_updated_by := fnd_global.user_id;
IF x_last_updated_by IS NULL THEN
x_last_updated_by := -1;
x_last_update_login :=fnd_global.login_id;
IF x_last_update_login IS NULL THEN
x_last_update_login := -1;
p_action => 'UPDATE',
x_rowid => x_rowid,
x_course_cd => x_course_cd,
x_version_number => x_version_number,
x_reference_cd_type => x_reference_cd_type,
x_reference_cd => x_reference_cd,
x_description => x_description,
x_creation_date => x_last_update_date ,
x_created_by => x_last_updated_by ,
x_last_update_date => x_last_update_date ,
x_last_updated_by => x_last_updated_by ,
x_last_update_login => x_last_update_login
);
UPDATE igs_ps_ref_cd SET
course_cd = new_references.course_cd,
version_number = new_references.version_number,
reference_cd_type = new_references.reference_cd_type,
reference_cd = new_references.reference_cd,
description = new_references.description,
last_update_date = x_last_update_date,
last_updated_by = x_last_updated_by,
last_update_login = x_last_update_login
WHERE ROWID = x_rowid ;
p_action => 'UPDATE',
x_rowid => x_rowid);
END update_row;
CURSOR c1 IS SELECT ROWID FROM igs_ps_ref_cd
WHERE course_cd = x_course_cd
AND version_number = x_version_number
AND reference_cd = x_reference_cd
AND reference_cd_type = x_reference_cd_type ;
insert_row (
x_rowid,
x_course_cd,
x_version_number,
x_reference_cd,
x_reference_cd_type,
x_description,
x_mode);
update_row (
x_rowid,
x_course_cd,
x_version_number,
x_reference_cd,
x_reference_cd_type,
x_description,
x_mode);
PROCEDURE delete_row (
x_rowid IN VARCHAR2
) AS
BEGIN
before_dml (
p_action => 'DELETE',
x_rowid => x_rowid
);
DELETE FROM igs_ps_ref_cd
WHERE ROWID = x_rowid;
p_action => 'DELETE',
x_rowid => x_rowid);
END delete_row;