doc-exports/docs/dli/sqlreference/dli_spark_printf.html
Su, Xiaomeng 76a5b1ee83 dli_sqlreference_20240227
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2024-03-27 22:02:33 +00:00

4.7 KiB

printf

This function is used to print the input in a specific format.

Syntax

printf(String format, Obj... args)

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

format

Yes

STRING

Output format

Obj

No

STRING

Other input parameters

Return Values

The return value is of the STRING type.

The value is returned after the parameters that filled in Obj are specified for format.

Example Code

The string name: Zhang San, age: 20, gender: female, place of origin: city 1 is returned.

SELECT printf('Name: %s, Age: %d, Gender: %s, Place of origin: %s', "Zhang San", 20, "Female", "City 1");