xp_scanf system procedure

Extracts substrings from an input string and a format string.

Syntax
xp_scanf(
  input_buffer,
  format,
  parm [, parm2, ... ]
)
Arguments
  • input_buffer   Use this CHAR(254) parameter to specify the input string.

  • format   Use this CHAR(254) parameter to specify the format of the input string, using placeholders (%s) for each parm argument. There can be up to fifty placeholders in the format argument, and there must be the same number of placeholders as parm arguments.

  • parm   Use one or more of these CHAR(254) parameters to specify the substrings extracted from input_buffer. There can be up to 50 of these parameters.

Remarks

The xp_scanf system procedure extracts substrings from an input string using the specified format, and puts the results in the specified parm values.

Permissions

None

See also
Example

The following statements extract the substrings Hello and World! from the input buffer Hello World!, and put them into variables string1 and string2, and then selects them:

CREATE VARIABLE string1 CHAR(254);
CREATE VARIABLE string2 CHAR(254);
CALL xp_scanf( 'Hello World!', '%s %s', string1, string2 );
SELECT string1, string2;