WRITE_TEXT v14

The WRITE_TEXT function sends a text string to a remote host through an established connection.

WRITE_TEXT (
  c      IN connection,
  data   IN TEXT,
  len    IN INTEGER
) RETURN INTEGER;

Parameters

c

The connection handle of the active session, originally returned by OPEN_CONNECTION.

data

The text data to be transmitted to the remote host.

len

The number of characters from the data string to be written.

Return value

TypeDescription
INTEGERThe actual number of characters successfully written to the connection buffer.

Notes

  • Partial writes: If the output buffer is full, the function may return a value smaller than len. It is best practice to check the return value and handle any remaining data in a subsequent call.

  • Timeouts: This operation is subject to the tx_timeout value defined during the connection setup.

Example

DECLARE
  c      UTL_TCP.CONNECTION;
  count  INT;
BEGIN
  c := UTL_TCP.OPEN_CONNECTION('mail-arts.enterprisedb.com', 25);
  count := UTL_TCP.WRITE_TEXT(c, 'Hello', 5);
  count := UTL_TCP.WRITE_TEXT(c, 'World', 5);
  UTL_TCP.CLOSE_CONNECTION(c);
END;