SQL Programming Manual for TAL
Examples of Dynamic NonStop SQL Programs
HP NonStop SQL Programming Manual for TAL—527887-001
C-34
Detailed Dynamic SQL Program
Page 24 [1] $VOL1.S04.TALDYN 1991-10-15 13:42:28
sql^warning^handler
943. 000000 0 0 PROC sql^warning^handler;
944. 000000 1 0 !******************************************************!
945. 000000 1 0 ! Displays an SQL warning.
946. 000000 1 0 !******************************************************!
947. 000000 1 0 BEGIN
948. 000000 1 1 PRINT^BLANK^LINE;
949. 000011 1 1 call SQLCADISPLAY (sqlca);
950. 000023 1 1 END;
951. 000000 0 0
Page 25 [1] $VOL1.S04.TALDYN 1991-10-15 13:42:28
memory^error^handler
953. 000000 0 0 PROC memory^error^handler(rollback^flag);
954. 000000 1 0 !******************************************************!
955. 000000 1 0 ! Prints a message and either terminates or returns.
Called !
956. 000000 1 0 ! on failure of memory allocation for SQLDAs or names
buffers. !
957. 000000 1 0 !******************************************************!
958. 000000 1 0 INT rollback^flag;! IN: 0--no ROLLBACK WORK, program
should stop.
959. 000000 1 0 ! 1--ROLLBACK WORK, program will re-enter
960. 000000 1 0 ! the input loop (outside this
procedure).
961. 000000 1 0 BEGIN
962. 000000 1 1 PRINT^BLANK^LINE;
963. 000011 1 1 PUT^STR^MID ("**** memory allocation failure *** ");
964. 000025 1 1
965. 000025 1 1 if rollback^flag then
966. 000027 1 1 EXEC SQL ROLLBACK WORK ! when we return from here, the
967. 000027 1 1 ! program re-enters the input
loop.
968. 000027 1 1 else
969. 000075 1 1 begin
970. 000075 1 2 PRINT^LINE;
971. 000110 1 2 PUT^STR (" Process stopped.");
972. 000126 1 2 PRINT^LINE;
973. 000141 1 2 PRINT^BLANK^LINE;
974. 000151 1 2 PUT^STR^MID ("End of current session");
975. 000165 1 2 PRINT^LINE;
976. 000200 1 2 call STOP;
977. 000205 1 2 end;
978. 000205 1 1 END;
979. 000000 0 0
980. 000000 0 0