The sample tpf_blob is included in a precompiled dynamic library called libv4apiex (extension is platform-dependent). Its implementation is in the samples directory in tpf_blob.cxx.
Declare the TPF to the server:
CREATE OR REPLACE PROCEDURE tpf_blob( IN tab TABLE( num INT,
s long varchar ),
IN pattern char(1) )
RESULT( num INT, s long varchar )
EXTERNAL NAME 'tpf_blob@libv4apiex';
Declare a table to use as input to the TPF:
CREATE TABLE test_table( val INT, str LONG VARCHAR );
Insert rows into the table:
INSERT INTO test_table VALUES(1, 'aaaaaaaaaabbbbbbbbbb');
INSERT INTO test_table VALUES(2, 'aaaaaaaaaaabbbbbbbbbbb');
INSERT INTO test_table VALUES(3, 'aaaaaaaaaaaabbbbbbbbbbbb');
INSERT INTO test_table VALUES(4, 'aaaaaaaaaaaaabbbbbbbbbbbbb');
INSERT INTO test_table VALUES(5, 'aaaaaaaaaaaaaabbbbbbbbbbbbbb');
COMMIT;
Select rows from the TPF:
SELECT * FROM tpf_blob( TABLE( SELECT val,str FROM test_table ), 'a' );
The table test_table has three rows with an even number of as. Row 1 has 10, row 3 has 12, and row 5 has 14.