desktop_task_schedule/code/db/pkg/telsaler_reward_pkg.pck

60 lines
1.4 KiB
Plaintext

CREATE OR REPLACE PACKAGE telsaler_reward_pkg IS
-- Author : WANGWEI-202
-- Created : 2023/9/13 10:05:43
-- Purpose : ×øϯ½±ÀøÏà¹ØµÄ°ü
PROCEDURE save_telsaler_reward
(
a_rec_id INTEGER,
a_telsaler_name VARCHAR2,
a_reward_index VARCHAR2
);
PROCEDURE delete_telsaler_reward(a_rec_id INTEGER);
END telsaler_reward_pkg;
/
CREATE OR REPLACE PACKAGE BODY telsaler_reward_pkg IS
PROCEDURE save_telsaler_reward
(
a_rec_id INTEGER,
a_telsaler_name VARCHAR2,
a_reward_index VARCHAR2
) IS
BEGIN
MERGE INTO telsaler_reward r
USING (SELECT COUNT(*) COUNT
FROM telsaler_reward
WHERE rec_id = a_rec_id) a
ON (a.count > 0)
WHEN MATCHED THEN
UPDATE
SET r.reward_index = a_reward_index,
r.telsaler_name = a_telsaler_name
WHERE r.rec_id = a_rec_id
WHEN NOT MATCHED THEN
INSERT
(reward_index,
telsaler_name)
VALUES
(a_reward_index,
a_telsaler_name);
COMMIT;
END;
PROCEDURE delete_telsaler_reward(a_rec_id INTEGER) IS
BEGIN
DELETE telsaler_reward
WHERE rec_id = a_rec_id;
COMMIT;
END;
BEGIN
NULL;
END telsaler_reward_pkg;
/