-- run 1_datatype_data.sql before running this script
ALTER SESSION SET CURRENT_SCHEMA = SqlScriptDocumentation;
drop procedure dynamic_sql_proc;
CREATE PROCEDURE dynamic_sql_proc LANGUAGE SQLSCRIPT AS
v_sql1 VARCHAR(1024);
v_sql2 VARCHAR(1024);
v_msg VARCHAR(200);
BEGIN
init_proc();
v_sql1 := 'INSERT INTO "MESSAGE_BOX" VALUES (''First message from Dynamic SQL'', SYSTIMESTAMP)';
EXEC :v_sql1;
v_sql2 := 'INSERT INTO message_box VALUES (''Second message from Dynamic SQL'', SYSTIMESTAMP)';
EXEC :v_sql2;
v_sql1 := 'Third message from Dynamic SQL';
EXEC 'INSERT INTO message_box VALUES (''' || :v_sql1 || ''', SYSTIMESTAMP)';
END;
call dynamic_sql_proc();
select message from message_box;
专注于企业信息化,最近对股票数据分析较为感兴趣,可免费分享股票个股主力资金实时变化趋势分析工具,股票交流QQ群:457394862
分类:
SAP HANA
本文转自沧海-重庆博客园博客,原文链接:http://www.cnblogs.com/omygod/archive/2013/04/25/3043788.html,如需转载请自行联系原作者