INFORMIX IDS11.5 动态存储过程(DYNAMIC SPL) - INFORM...
来源:百度文库 编辑:神马文学网 时间:2024/10/06 00:17:59
INFORMIX IDS11支持 动态存储过程。本文通过举例的方法演示如何在INFORMIX中创建动态存储过程。EXAMPLE 1 说明 EXECUTE IMMEDIATE 语句可以通过参数名来动态执行不同的表DATABASE stores_demo;
CREATE PROCEDURE create_tab (table_name CHAR(128), column_list CHAR(512)) DEFINE l_crtstmt CHAR(1024); LET l_crtstmt = "CREATE TABLE " || table_name ||"("|| column_list || " )"; --动态语句,存放到一个变量中 EXECUTE IMMEDIATE l_crtstmt; --动态执行SQLEND PROCEDURE;执行存储过程EXECUTE PROCEDURE create_tab ("tmp_cust","cust_num INTEGER,cust_fname CHAR(30)");
--------------------------------------------------------------------------------EXAMPLE 2说明在SPL中如何利用游标和动态语句DATABASE stores_demo;-- Procedure to dynamically constructs query `cust_qry' using supplied
-- table_name and returns all rows whose first name is the supplied
-- first_nameCREATE PROCEDURE customer_details(table_name CHAR(30),first_name CHAR(30))
RETURNING INTEGER, CHAR(30), CHAR(30), CHAR(30); DEFINE cust_qry VARCHAR(250);
DEFINE l_cust_num INTEGER; DEFINE l_fname CHAR(30);
DEFINE l_lname CHAR(30);
DEFINE l_state CHAR(30); -- Construct a Dynamic query using SPL argument table_name LET cust_qry = "select customer_num, fname, lname, state from "
||table_name || " where fname = ?"; -- Prepare the above constructed query
-- Get the statement handle "statement_id" PREPARE stmt_id FROM cust_qry;-- Declare the cursor for the prepared "statement_id"
-- get the cursor handle "cust_cur"DECLARE cust_cur cursor FOR stmt_id; -- Open the declared cursor using handle "cust_cur"
-- Supply the first_name as an input. This will be
-- substituted in the place of "?" in the query 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ibminformix/archive/2009/11/19/4833481.aspx
CREATE PROCEDURE create_tab (table_name CHAR(128), column_list CHAR(512)) DEFINE l_crtstmt CHAR(1024); LET l_crtstmt = "CREATE TABLE " || table_name ||"("|| column_list || " )"; --动态语句,存放到一个变量中 EXECUTE IMMEDIATE l_crtstmt; --动态执行SQLEND PROCEDURE;执行存储过程EXECUTE PROCEDURE create_tab ("tmp_cust","cust_num INTEGER,cust_fname CHAR(30)");
--------------------------------------------------------------------------------EXAMPLE 2说明在SPL中如何利用游标和动态语句DATABASE stores_demo;-- Procedure to dynamically constructs query `cust_qry' using supplied
-- table_name and returns all rows whose first name is the supplied
-- first_nameCREATE PROCEDURE customer_details(table_name CHAR(30),first_name CHAR(30))
RETURNING INTEGER, CHAR(30), CHAR(30), CHAR(30); DEFINE cust_qry VARCHAR(250);
DEFINE l_cust_num INTEGER; DEFINE l_fname CHAR(30);
DEFINE l_lname CHAR(30);
DEFINE l_state CHAR(30); -- Construct a Dynamic query using SPL argument table_name LET cust_qry = "select customer_num, fname, lname, state from "
||table_name || " where fname = ?"; -- Prepare the above constructed query
-- Get the statement handle "statement_id" PREPARE stmt_id FROM cust_qry;-- Declare the cursor for the prepared "statement_id"
-- get the cursor handle "cust_cur"DECLARE cust_cur cursor FOR stmt_id; -- Open the declared cursor using handle "cust_cur"
-- Supply the first_name as an input. This will be
-- substituted in the place of "?" in the query 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ibminformix/archive/2009/11/19/4833481.aspx
INFORMIX IDS11.5 动态存储过程(DYNAMIC SPL) - INFORM...
存储过程
Fix list for Informix Dynamic Server 11.50.xC5
Java调用存储过程
Mysql 存储过程
Oracle存储过程学习
asp + oracle 分页方法 (不用存储过程)
存储过程中如何用表名作为输入参数?动态SQL语句的一些常见写法
[百万级]通用存储过程.分页存储过程.
[百万级]通用存储过程.分页存储过程. - wellknow
存储过程入门与提高
存储过程游标的使用
JDBC 驱动程序调用存储过程
存储过程精解2
mysql存储过程与函数
Oracle定时执行存储过程
oracle存储过程精解
存储过程和触发器优缺点
JSP调用MySQL存储过程(带参数) - 代码发芽网
存储过程与函数的区别(转) - 寒光2008 - JavaEye技术网站
DB2 存储过程开发最佳实践
存储过程的一点相关资料
DB2 存储过程开发最佳实践
DB2 存储过程开发最佳实践