NEXT_HTTP_HEADER function [Web service]

Returns the next HTTP header name.

Syntax

NEXT_HTTP_HEADER( header-name )

Parameters

Returns

LONG VARCHAR.

Note: The result data type is a LONG VARCHAR. If you use NEXT_HTTP_HEADER in a SELECT INTO statement, you must have an Unstructured Data Analytics Option license or use CAST and set HTML_DECODE to the correct data type and size.

Remarks

This function is used to iterate over the HTTP request headers returning the next HTTP header name. Calling it with NULL causes it to return the name of the first header. Subsequent headers are retrieved by passing the name of the previous header to the function. This function returns NULL when called with the name of the last header, or when not called from a web service.

Calling this function repeatedly returns all the header fields exactly once, but not necessarily in the order they appear in the HTTP request.

Standards and compatibility

Example

When used within a stored procedure that is called by an HTTP web service, the following example displays the name and values of the HTTP request headers in the database server messages window.

BEGIN
  declare header_name long varchar;
  declare header_value long varchar;
  set header_name  = NULL;
header_loop:        
  LOOP
    SET header_name = NEXT_HTTP_HEADER( header_name );
    IF header_name IS NULL THEN 
      LEAVE header_loop 
    END IF;
    SET header_value = HTTP_HEADER( header_name );
    MESSAGE 'HEADER: ', header_name, '=', 
            header_value TO CONSOLE;
  END LOOP;
END;