Put Handler
This example shows how to read the long varchar chapter_text from a text file and insert it into the database a segment at a time:
function Put_Handler(info: Hdlr_Rec) return Integer is
exec sql begin declare section;
seg_buf: String(1..1000);
seg_len: Integer;
data_end: Integer;
exec sql end declare section;
process information passed in via the info
record...
open file ...
data_end := 0;
while (not end-of-file) loop
read segment of less than 1000 chars from
file into seg_buf...
if (end-of-file) then
data_end := 1;
end if;
exec sql put data (segment = :seg_buf,
segmentlength = :seg_len,
dataend = :data_end);
end loop;
...
close file ...
set info record to return appropriate values...
...
return 0;
end Put_Handler;