blob: eb5a38ea8320a26bb21f508e9545478a6751c070 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
-- Deploy kakeibo:insert_transaction to pg
-- requires: schema
-- requires: transactions
BEGIN;
CREATE OR REPLACE FUNCTION kakeibo.insert_transaction(
p_type_code INTEGER,
p_date DATE,
p_note TEXT
) RETURNS INTEGER AS $$
DECLARE
inserted_id INTEGER;
BEGIN
INSERT INTO kakeibo.transactions (
type_code, date, note
) VALUES (
p_type_code, p_date, p_note
) RETURNING id INTO inserted_id;
RETURN inserted_id;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
COMMIT;
|