-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_transaction_by_task_id.sql
64 lines (56 loc) · 1.52 KB
/
delete_transaction_by_task_id.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- FUNCTION: code_src.delete_transaction_by_task_id(numeric)
-- DROP FUNCTION code_src.delete_transaction_by_task_id(numeric);
CREATE OR REPLACE FUNCTION code_src.delete_transaction_by_task_id(
taskid numeric)
RETURNS text
LANGUAGE 'plpgsql'
COST 100
VOLATILE SECURITY DEFINER
AS $BODY$
DECLARE
o_status text;
o_message text;
o_json text;
BEGIN
/*
Summary:
Delete a transaction by a task id.
Testing:
SELECT delete_transaction_by_task_id(123);
*/
o_status = 'OK';
o_message = '';
DELETE FROM ige_transaction
WHERE task_id = $1;
-- disable ige_transaction sync for now
/*-- Beginning of updating Oracle
IF get_configuration_bool('anchorTO', 'ANCHORTO', 'sync_with_oracle') THEN
DELETE FROM imaint_anchor.ige_transaction
WHERE task_id = $1;
END IF;
-- End of updating Oracle */
SELECT row_to_json(c) INTO o_json
FROM
(
SELECT o_status status,
o_message message
) c;
RETURN o_json;
EXCEPTION
WHEN OTHERS THEN
o_status = SQLSTATE;
o_message = SQLERRM;
SELECT row_to_json(c) INTO o_json
FROM
(
SELECT o_status status,
o_message message
) c;
RETURN o_json;
END;
$BODY$;
ALTER FUNCTION code_src.delete_transaction_by_task_id(numeric)
OWNER TO network;
GRANT EXECUTE ON FUNCTION code_src.delete_transaction_by_task_id(numeric) TO anchorto_run;
GRANT EXECUTE ON FUNCTION code_src.delete_transaction_by_task_id(numeric) TO network;
REVOKE ALL ON FUNCTION code_src.delete_transaction_by_task_id(numeric) FROM PUBLIC;