title: Teradata REGEXP_SPLIT_TO_TABLE Input Parameter
body: <p>I'd like to be able to define an input parameter in a CTE and then use it within a REGEXP_SPLIT_TO_TABLE function, like so:</p>
  
  <pre><code>WITH PARAMS (INPUT_PARAMS) AS
  (SELECT
      '?InputParams' AS INPUT_PARAMS
  )
  SELECT
      TEST_TABLE.SPLIT_PARAMS
  FROM
      TABLE (REGEXP_SPLIT_TO_TABLE(1, PARAMS.INPUT_PARAMS, '\|', 'i')
          RETURNS (outkey INTEGER, TOKENNUM INTEGER, SPLIT_PARAMS VARCHAR(8192) CHARACTER SET UNICODE)) AS TEST_TABLE
      CROSS JOIN PARAMS
  </code></pre>
  
  <p>However this yields the following error:</p>
  
  <blockquote>
    <p>SELECT Failed.  [3706] Syntax error: Joined table is not supported in
    conjuction with table operators or table function invoked with
    variable input argument.</p>
  </blockquote>
  
  <p>Putting the parameter right in the function works, as below:</p>
  
  <pre><code>SELECT
      TEST_TABLE.SPLIT_PARAMS
  FROM
      TABLE (REGEXP_SPLIT_TO_TABLE(1, '?InputParams', '\|', 'i') --
          RETURNS (outkey INTEGER, TOKENNUM INTEGER, SPLIT_PARAMS VARCHAR(8192) CHARACTER SET UNICODE)) AS TEST_TABLE
  </code></pre>
  
  <p>But I'm wondering if there's a way to do something more like the first example above.</p>