UTL_TCP Package
UTL_TCP allows communication with external TCP Services.

With the UTL_TCP package and its procedures and functions, PL/SQL applications can communicate with external TCP/IP-based servers using TCP/IP. Because many Internet application protocols are based on TCP/IP, this package is useful to PL/SQL applications that use Internet protocols and e-mail. The UTL_TCP package provides TCP/IP client-side access functionality in PL/SQL. The API provided in the package only allows connections to be initiated by the PL/SQL program. It does not allow the PL/SQL program to accept connections initiated outside the program.

UTL_TCP.CONNECTION

A PL/SQL record type used to represent a TCP/IP connection.

UTL_TCP.CRLF

The character sequence carriage-return line-feed, it is the newline sequence commonly used many communication standards.

UTL_TCP.OPEN_CONNECTION

Opens a TCP/IP connection to a specified service.

UTL_TCP.AVAILABLE

Determines the number of bytes available for reading from a TCP/IP connection.

UTL_TCP.READ_RAW

Receives binary data from a service on an open connection.

UTL_TCP.WRITE_RAW

Transmits a binary message to a service on an open connection.

UTL_TCP.READ_TEXT

Receives text data from a service on an open connection.

UTL_TCP.WRITE_TEXT

Transmits a text message to a service on an open connection.

UTL_TCP.READ_LINE

Receives a text line from a service on an open connection.

UTL_TCP.WRITE_LINE

Transmits a text line to a service on an open connection.

UTL_TCP.FLUSH

Transmits all data in the output buffer, if a buffer is used, to the server immediately.

UTL_TCP.CLOSE_CONNECTION

Closes an open TCP/IP connection.

UTL_TCP.CLOSE_ALL_CONNECTIONS

Closes all open TCP/IP connections.

UTL_TCP.GET_RAW, UTL_TCP.GET_TEXT, UTL_TCP.GET_LINE functions are convenient forms or read functions, which return the data read instead of the amount of data read.

UTL_TCP EXCEPTIONS

  • BUFFER_TOO_SMALL : This is raised when the buffer is too small for input that requires look-ahead.
  • END_OF_INPUT : Raised when no more data is available to read from the connection.
  • NETWORK_ERROR : This is a Generic network error.
  • BAD_ARGUMENT : When bad argument passed in an API call (for example, a negative buffer size) this type of exception is raised.
  • TRANSFER_TIMEOUT : When no data is read and a read time-out occurred this exception is raised.
  • PARTAL_MULTIBYTE_CHAR : This exception is raised when no complete character is read and a partial multibyte character is found at the end of the input.