desktop_task_schedule/code/db/pkg/telsaler_reward_pkg.pck

90 lines
2.1 KiB
Plaintext
Raw Normal View History

2023-09-14 10:42:23 +00:00
CREATE OR REPLACE PACKAGE telsaler_reward_pkg IS
-- Author : WANGWEI-202
-- Created : 2023/9/13 10:05:43
-- Purpose : <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صİ<D8B5>
2023-09-21 08:56:34 +00:00
PROCEDURE add_telsaler_reward
(
a_reward_index VARCHAR2,
a_telsaler_name VARCHAR2
);
2023-09-14 10:42:23 +00:00
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
2023-09-21 08:56:34 +00:00
PROCEDURE add_telsaler_reward
(
a_reward_index VARCHAR2,
a_telsaler_name VARCHAR2
) IS
BEGIN
BEGIN
INSERT INTO telsaler_reward
(reward_index,
telsaler_name)
VALUES
(a_reward_index,
a_telsaler_name);
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE = -00001
THEN
raise_application_error(-20001,
<>ظ<EFBFBD>');
END IF;
END;
COMMIT;
END;
2023-09-14 10:42:23 +00:00
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;
/