Format query output from a
select
statement.For an overview see page Miscellaneous SQL Functions
Prototype
format( fmt, val);Arguments
fmt The format string val The value to be formatted Description
This function formats the value
val
according to the format specified by the format stringfmt
. If val is of typedatetime
, thenfmt
must be a string suitable forstrftime()
. For numeric and string valuesfmt
must be a string suitable forprintf()
. Values of other types are converted to string. (Note that the format string must be enclosed in single quotes.)Example
create table t(c char); insert into t(c) values('comment'); select c, format('A parenthetic (%s :)', c) from t; c #2 ----------------------------------------------------- comment (A parenthetic comment :)