Here is the Package Header:
create or replace
PACKAGE PACKAGEUPDATE
IS
-- Procedure that updates values in the table
PROCEDURE ProcUpdate
(
id IN TABLE_NAME.FIELD_ID%TYPE,
in_field_one IN TABLE_NAME.FIELD_ONE%TYPE,
in_field_two IN TABLE_NAME.FIELD_TWO%TYPE
);
END PACKAGEUPDATE;
Here is the Package Body:
create or replace
PACKAGE BODY PACKAGEUPDATE
IS
PROCEDURE ProcUpdate
(
id IN TABLE_NAME.FIELD_ID%TYPE,
in_field_one IN TABLE_NAME.FIELD_ONE%TYPE,
in_field_two IN TABLE_NAME.FIELD_TWO%TYPE
)
IS
BEGIN
UPDATE MODAL_REQUEST
SET
FIELD_ONE = in_field_one,
FIELD_TWO = in_field_two
WHERE
FIELD_ID = id;
EXCEPTION
WHEN OTHERS THEN
PACKAGEERR.ERR_STOP;
RAISE;
END ProcUpdate;
END PACKAGEUPDATE;
The update procedure takes in 3 parameters, an id, and two fields. The procedure updates the columns FIELD_ONE and FIELD_TWO with the values passed in in_field_one and in_field_two respectively. It does this where the FIELD_ID column equals the value passed in to id.
The EXCEPTION is just a call to a general exception procedure (PACKAGEERR.ERR_STOP), if anyone wants to see an example let me know. Also, if anyone has any other questions or concerns feel free to leave me a comment.
Shane
No comments:
Post a Comment