-
Notifications
You must be signed in to change notification settings - Fork 0
/
procedure.sql
33 lines (24 loc) · 876 Bytes
/
procedure.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
### get_rrclose
DELIMITER $$
CREATE DEFINER=`dev1`@`%` PROCEDURE `get_rrclose`()
NO SQL
SELECT rc.id, rc.rid, rb.name, rc.start_time, rc.end_time FROM cm_rr_close rc JOIN cm_rr_base rb ON rc.id = rb.rid ORDER BY start_time DESC LIMIT 30$$
DELIMITER ;
### insert_rrclose
DELIMITER $$
CREATE DEFINER=`dev1`@`%` PROCEDURE `insert_rrclose`(IN `iv_rid` INT(10), IN `iv_start_time` TIMESTAMP, IN `iv_end_time` TIMESTAMP)
NO SQL
INSERT INTO cm_rr_close(rid, start_time, end_time)
VALUES(iv_rid, iv_start_time, iv_end_time)$$
DELIMITER ;
### update_rrclose
DELIMITER $$
CREATE DEFINER=`dev1`@`%` PROCEDURE `update_rrclose`(IN `iv_rid` INT(10), IN `iv_start_time` TIMESTAMP, IN `iv_end_time` TIMESTAMP, IN `iv_close_id` INT(10))
NO SQL
UPDATE cm_rr_close
SET
rid = iv_rid,
start_time = iv_start_time,
end_time = iv_end_time
WHERE id = iv_close_id$$
DELIMITER ;