《第11讲2--通讯机制.pdf》由会员分享,可在线阅读,更多相关《第11讲2--通讯机制.pdf(20页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、An Introduction to Database System Video 11-2? An Introduction to Database System ?SQL? ?SQL? ? PL DB ? ? ? ? An Introduction to Database System ?SQL? ? ?1?SQL? ?SQL? ?2?SQL? ?3?SQL? ? An Introduction to Database System ?SQL? PLer DBer ? ?/? ?SQLCA? An Introduction to Database System 1. SQL? ? SQLCA
2、? ? SQL? ? ? ? ? ? ?SQL? ? ?SQL? ? An Introduction to Database System 1. SQL?2? ?SQLCA? SQL Communication Area ?SQLCA? An Introduction to Database System 1. SQL?3? ?SQLCA? ?SQLCA ? ?EXEC SQL INCLUDE SQLCA? ?SQLCA ?SQLCA?SQL? ?SQLCODE ?SQLCODE?SUCCESS? SQL? ?SQL ? SQLCODE?SQL? ? An Introduction to Da
3、tabase System 2. ? ? ?SQL? ? ?SQL? ?Host Variable? An Introduction to Database System ? ? ? ?SQL? ? ?SQL? An Introduction to Database System ? ? ? ?Indicator Variable? ? ? ? An Introduction to Database System SELECT? ? ?8.3 ? ?givensno? ?givencno? EXEC SQL SELECT Sno,Cno,Grade INTO :Hsno,:Hcno,:Hgra
4、de:Gradeid /*?Gradeid*/ FROM SC WHERE Sno=:givensno AND Cno=:givencno? ?Gradeid 0?Hgrade? An Introduction to Database System ? ? ?8.5 ?SC ?stdno? ?couno? gradeid=-1? /*gradeid?*/ EXEC SQL INSERT INTO SC(Sno,Cno,Grade) VALUES(:stdno,:couno,:gr :gradeid)? /*:stdno?:couno?:gr?*/ ? An Introduction to Da
5、tabase System ? ? ?SQL? ? BEGIN DECLARE SECTION . . ? . END DECLARE SECTION An Introduction to Database System ? ?SQL? ? ?SQL? ? ?SQL? ?:? ? ? ? An Introduction to Database System ? ? ?SQL? ? ? ? ? ? An Introduction to Database System 3 ? ? ? ? ?SQL? ? ? ? ? ?SQL? ? An Introduction to Database Syste
6、m 3 ? ? ?DECLARE? EXEC SQL DECLARE CURSOR FOR ; ? ? ?SELECT? ?select? ? An Introduction to Database System 3. ? ? ? ? SQL? ? SQL?SQL? ? ? ? ? ?SQL? ? ? ?SQL? An Introduction to Database System 4. ? EXEC SQL BEGIN DECLARE SECTION; /*?*/ char deptname20; EXEC SQL END DECLARE SECTION; /*?*/ long SQLCOD
7、E; EXEC SQL INCLUDE SQLCA; /*?SQL?*/ int main(void) /*C?*/ printf(Please choose the department name(CS/MA/IS): ); scanf(%s,deptname); /*?deptname?*/ EXEC SQL CONNECT TO TESTlocalhost:54321 USER SYSTEM/MANAGER; /*?TEST*/ EXEC SQL DECLARE SX CURSOR FOR /*?SX*/ SELECT Sno,Sname,Ssex,Sage /*SX?*/ FROM Student WHERE SDept = :deptname; EXEC SQL OPEN SX; /*?SX?*/ An Introduction to Database System ? 1 ? 2 ? 3 SQL?