Get Handler
This example shows how to get the long varchar chapter_text from the database and write it to a text file:
function Get_Handler(info: Hdlr_Rec) return Integer is
exec sql begin declare section;
seg_buf: String(1..100);
seg_len: Integer;
data_end: Integer;
max_len: Integer;
exec sql end declare section;
...
process information passed in via the
info record....
open file...
-- Set a maximum segment length of 2000 bytes
data_end := 0;
while (data_end = 0) loop
exec sql get data (:seg_buf = segment,
:seg_len = segmentlength,
:data_end = dataend)
with maxlength = :max_len;
write segment to file ...
end loop;
. . .
set info record to return appropriate values...
. . .
return 0;
end Get_Handler;