>데이터 베이스 >MySQL 튜토리얼 > 嵌入式的SQL程序设计

嵌入式的SQL程序设计

WBOY
WBOY원래의
2016-06-07 17:37:201327검색

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

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.