当前位置:Gxlcms >
数据库问题 >
HANA SQL Script学习(1):Orchestration Logic
HANA SQL Script学习(1):Orchestration Logic
时间:2021-07-01 10:21:17
帮助过:66人阅读
PROCEDURE orchestrationProc
LANGUAGE SQLSCRIPT
READS SQL DATA AS
BEGIN
DECLARE v_id
BIGINT;
DECLARE v_name
VARCHAR(
30);
DECLARE v_pmnt
BIGINT;
DECLARE v_msg
VARCHAR(
200);
DECLARE CURSOR c_cursor1 (p_payment
BIGINT)
FOR
SELECT id, name, payment
FROM control_tab
WHERE payment
> :p_payment
ORDER BY id
ASC;
OPEN c_cursor1(
250000);
FETCH c_cursor1
INTO v_id, v_name, v_pmnt;
v_msg = :v_name
|| ‘ (id ‘ || :v_id
|| ‘) earns ‘ || :v_pmnt
|| ‘ $.‘;
CALL ins_msg_proc(:v_msg);
CLOSE c_cursor1;
END
procedure :ins_msg_proc
--创建message表
CREATE TABLE message_box (p_msg VARCHAR(200), tstamp TIMESTAMP);
--创办procedure
CREATE PROCEDURE ins_msg_proc (p_msg VARCHAR(200))
LANGUAGE SQLSCRIPT AS
BEGIN
INSERT INTO message_box VALUES (:p_msg, CURRENT_TIMESTAMP);
END;
HANA SQL Script学习(1):Orchestration Logic
标签:values sele varchar reads ati RoCE procedure where nbsp