小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

INFORMIX IDS11.5 動(dòng)態(tài)存儲(chǔ)過(guò)程(DYNAMIC SPL) - INFORM...

 snowlewolf 2009-11-19
INFORMIX IDS11支持 動(dòng)態(tài)存儲(chǔ)過(guò)程。本文通過(guò)舉例的方法演示如何在INFORMIX中創(chuàng)建動(dòng)態(tài)存儲(chǔ)過(guò)程。
EXAMPLE 1 
說(shuō)明 EXECUTE IMMEDIATE 語(yǔ)句
可以通過(guò)參數(shù)名來(lái)動(dòng)態(tài)執(zhí)行不同的表
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 || " )";  --動(dòng)態(tài)語(yǔ)句,存放到一個(gè)變量中
   EXECUTE IMMEDIATE l_crtstmt;          --動(dòng)態(tài)執(zhí)行SQL
END PROCEDURE;
執(zhí)行存儲(chǔ)過(guò)程
EXECUTE PROCEDURE create_tab ("tmp_cust","cust_num INTEGER,cust_fname CHAR(30)");

--------------------------------------------------------------------------------
EXAMPLE 2
說(shuō)明在SPL中如何利用游標(biāo)和動(dòng)態(tài)語(yǔ)句
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_name
CREATE 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
 
本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/ibminformix/archive/2009/11/19/4833481.aspx

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多