Available in versions: Dev (3.16) | Latest (3.15) | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | 3.7

SPACE

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The SPACE() function repeats a space character a number of times. This is convenience for REPEAT, as available natively in SQL Server, for example.

SELECT 'a' || space(3) || 'b';
create.select(val("a").concat(space(3)).concat(val("b")).fetch();

The result being

+-------+
| space |
+-------+
| a   b |
+-------+

Dialect support

This example using jOOQ:

space(3)

Translates to the following dialect specific expressions:

-- ASE, AURORA_MYSQL, DB2, EXASOL, H2, MARIADB, MYSQL, SNOWFLAKE, SQLDATAWAREHOUSE, SQLSERVER, SYBASE, VERTICA
space(3)

-- AURORA_POSTGRES, BIGQUERY, COCKROACHDB, HSQLDB, POSTGRES, YUGABYTE
repeat(' ', 3)

-- FIREBIRD, HANA, INFORMIX, MEMSQL, ORACLE, TERADATA
rpad(' ', 3, ' ')

-- SQLITE
' ' || substr("replace"(hex(zeroblob(3)), '00', ' '), 1, 3 - length(' '))

-- ACCESS, DERBY, REDSHIFT
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.16, see #10141), or translate your own on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo