sprintf returns a new string formed by "printing" a variable number of arguments arg_1 - arg_x according to the format string format, that is, exactly the same way as with the sprintf function of C language. However the sprintf function enforces some additional limitations over the sprintf C function. It does not allow for single value output to take more than 2000 characters. It does support the following additional format characters:
diouxXeEfgcs - as in the C language printf
S - as 's' but escapes the single quotes by doubling them (as per SQL/92). This is suitable for constructing dynamic SQL statements with string literals inline.
sprintf ('insert into testit (data) values ('%S')', 'Test ''Real'' data') -> insert into testit (data) values ('Test ''Real'' data')
I - as 's' but escapes the string value to form a valid identifier name (will double the double quotes). This is suitable for constructing dynamic SQL statements with identifiers inline.
sprintf ('select * from "%I"', 'Big "Table" Name') -> select * from "Big ""Table"" Name"
U - as 's' but escapes the string value as an HTTP URL (same as http_url() function). Useful for making dynamic VSP content
sprintf ('<a href="%U">', 'day & night') -> <a href="day+%26+night">
V - as 's' but escapes the string value as an HTTP Value (same as http_value). Useful for making dynamic VSP content
sprintf ('<INPUT name="test" value="%V">', 'day & night') -> <INPUT name="test" value="day & night">
Note that the sprintf format length and precision modifiers do not apply to the extension format characters
sprintf('Int=%d/%o/%x, String=%s, Character=%c', 42798,42798,42798,'la cadena',65) -> 'Int=42798/123456/a72e, String=la cadena, Character=A'