Register a UDR that accesses a stream

To declare a stream as an argument or return value of a C UDR, use the MI_STREAM data type. When you register this UDR in the database, use the opaque data type stream to represent the stream descriptor.

The database server represents a stream with the stream opaque type. As for other opaque types, the database server stores information aboutstream in the sysxtdtypes system catalog table.

For example, suppose you have a C declaration for a UDR named get_data():
mi_lvarchar *get_data(strm_desc, nbytes)
   MI_STREAM *strm_desc;
   mi_integer nbytes;
The following CREATE FUNCTION statement registers the get_data() UDR, using the stream data type as its first argument:
CREATE FUNCTION get_data(data_source stream, nbytes INTEGER)
RETURNS VARCHAR
EXTERNAL NAME '/usr/local/udrs/stream/stream.so(get_data)'
LANGUAGE C;