首頁 > 資料庫 > mysql教程 > 嵌入式的SQL程序设计

嵌入式的SQL程序设计

WBOY
發布: 2016-06-07 17:37:20
原創
1342 人瀏覽過

嵌入式的SQL程序设计 RED_CURSOR red_CURSOR CONNECT TO servername.databasename AS connection_name USER LOGIN.PASSWORD CONNECTION connection_name DISCONNECT connection_name SQL CONNECT TO red.book AS con1 USER sa; 38 EXEC SQL CONNECT TO red.t

嵌入式的SQL程序设计

RED_CURSOR red_CURSOR CONNECT TO servername.databasename AS connection_name USER LOGIN.PASSWORD CONNECTION connection_name DISCONNECT connection_name SQL CONNECT TO red.book AS con1 USER sa; 38 EXEC SQL CONNECT TO red.test AS con2 USER sa; 39 EXEC SQL DISCONNECT CON1 40 EXEC SQL DISCONNECT CON2 SQL BEGIN DECLARE SECTION 47 INT CompanyID SQL END DECLARE SECTION "WHERE CompanyID=:CompanID" SQL SELECT FROM Company 58 WHERE Address=:ADDRESS stmt_name FROM :hvar SQL BEGIN DECLARE SECTION "insert into company values(?,?)" companynameSQL END DECLARE SECTION PRINTF("输入单位代码:") 81 SCANF("%S",COMPANYID) 82 PRINTF("输入单位名称:") 83 scanf("%s",companyname) 84 EXEC SQL PREPARE stmt FROM :stmtcon 85 EXEC SQL EXECUTE stmt USING:COMPANYID,:COMPANYNAME SQL BEGIN DECLARE SECTION SQL END DECLARE SECTION 91 EXEC SQL SELECT COMPANYNAME INTO :COMPANYNAME cursor_name INSENSITIVE SCROLL CURSOR FOR select_stmt column_list 定义游标,并打开SQL COMPANYID,COMPANYNAME SQL OPEN C1 SQL BEGIN DECLARE SECTION COMPANYNAMESQL END DECLARE SECTION (SQLCODE==0) 122 { 123 EXEC SQL FETCH C1 INTO :COMPANYID,:COMPANYNAME 124 PRINTF("%S,%S",COMPANYID,COMPANYNAME) 125 } SQL BEGIN DECLARE SECTION "SELECT COMPANYID FROM COMPANY WHERE COMPANYNAME=?"; "北京怡神公司"; SECTION SQL SELECT_STATEMENT; SQL 139 PREPARE SELECT_STATEMENT FROM :SZCOMMAND SQL OPEN CON_CURSOR USING:SZCOMPANYNAME; 142 EXEC SQL FETCH CON_CURSOR INTO:SZCOMPANYID;

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板