Home > Database > Mysql Tutorial > 嵌入式的SQL程序设计

嵌入式的SQL程序设计

WBOY
Release: 2016-06-07 17:37:20
Original
1341 people have browsed it

嵌入式的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;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template