EasyManua.ls Logo

HP NonStop SQL/MP

HP NonStop SQL/MP
331 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C429847-008
10-65
Detailed Dynamic SQL Program
1272 printf ("\n"); fflush( stdout );
1273 SQLCADISPLAY ((int *) &sqlca); /* display errors */
1274 exec sql close C1; /* close cursor */
1275 exec sql rollback work;
1276 goto enter_input;
1277 }
1278 } /* end: select stmt case */
1279 else
1280 { /*****************************************************/
1281 /* Not a SELECT statement. Perform EXECUTE with */
1282 /* USING DESCRIPTOR if there are input variables; */
1283 /* otherwise, perform EXECUTE */
1284 /*****************************************************/
1285 if (in_numvars > 0 )
1286 {
1287 exec sql execute S1 using descriptor :*sda_i ;
1288 }
1289 else
1290 {
1291 exec sql execute S1 ;
1292 }
1293
1294 if (sqlcode != 0)
1295 { /* display error/warnings */
1296 printf ("\n"); fflush( stdout );
1297 SQLCADISPLAY ( (int *) &sqlca );
1298 if (sqlcode < 0) /* errors present */
1299 {
1300 exec sql rollback work; /* abort transaction */
1301 goto enter_input; /* try again */
1302 }
1303 }
1304
1305 printf( "\n--- SQL Operation Complete.\n");
1306 fflush( stdout );
1307
1308 } /* end: not a select stmt case */
1309
1310 /* ----------------------------------------------------- */
1311 /* Successful execution of present query. Commit work. */
1312 /* Process next query */
1313 /* ----------------------------------------------------- */
1314 exec sql commit work;
1315
1316 goto enter_input;
1317
1318 exit:
1319 printf("\nEnd of current session\n");
1320 fflush (stdout);
1321 } /* end of main */
Example 10-8. Detailed Dynamic SQL Program (page 22 of 22)

Table of Contents

Related product manuals