Updated on 2026-11-06 GMT+08:00

printf

The printf function is used to format and print the input according to a specific format.

Syntax

printf(String format, Obj... args)

Parameters

Parameter

Mandatory

Type

Description

format

Yes

STRING

Defines the output format.

Obj

No

STRING

Other input parameters.

Return Values

Returns a value of type STRING.

Fills the parameters from Obj into format and prints the output.

Example Code

Returns the string name: user1, age: 20, gender: female, place of origin: city 1.

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