17. 亳仄亠 EXEC SQL BEGIN DECLARE SECTION; char name[100][100]; int n[100]; Float sal[100]; EXEC SQL END DECLARE SECTION; .. EXEC SQL SELECT fio,id into :name,:n FROM personal; // ok! EXEC SQL SELECT fio,id into :name,:n FROM personal WHERE many = :sal; // 仆亠于亠仆亶 仂仗亠舒仂 EXEC SQL INSERT INTO personal(fio,id,many) VALUES(:name, :n, :sal); // ok! EXEC SQL UPDATE SET many = :sal WHERE id = :n; //ok! EXEC SQL UPDATE SET many = :sal WHERE id = :n[0]; // no!
18. 仗亠舒仂 COMMIT WORK 亰舒于亠舒亠 舒仆亰舒从亳 EXEC SQL COMMIT WORK; 仗亠舒仂 COMMIT WORK RELEASE 仂亠于仍磳 DISCONNECT EXEC SQL COMMIT WORK RELEASE;
19. 亳仄亠 仗仂亞舒仄仄, 从仂仂舒 仗仂亰于仂仍磳 亰舒亟舒 ( 从仍舒于亳舒 ) 仆仂仄亠舒 仂亟仆亳从仂于 亳 亳 仂从仍舒亟, 舒 亰舒亠仄 亟仂弍舒于仍磳 亳 亟舒仆仆亠 于 舒弍仍亳 #include <stdio.h> #include <string.h> EXEC SQL BEGIN DECLARE SECTION; varchar log_pass[40]; int loop,n[100]; float many[100]; EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE sqlca.h; main() { int i,ret; strcpy(log_pass.arr,o01/o01@stud); log_pass.len = strlen(log_pass.arr); EXEC SQL CONNECT :log_pass; for(i=0;i<100;i++) { ret=scanf(%d %f
, &n[i],&many[i]); if(ret == EOF|| ret ==0|| n[i]==0) break; } loop=i; EXEC SQL FOR :loop INSERT INTO sotrud (Tnum,okl) VALUES(:n,:many); EXEC SQL COMMIT WORK RELEASE; }