Heim > Datenbank > MySQL-Tutorial > Hauptteil

嵌入式的SQL程序设计

WBOY
Freigeben: 2016-06-07 17:37:20
Original
1313 Leute haben es durchsucht

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

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage