Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9

SHL

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

The SHL() function produces the bitwise shift left operation.

SELECT shl(1, 4);
create.select(shl(1, 4)).fetch();

The result being

+-----+
| shl |
+-----+
|  16 |
+-----+

Dialect support

This example using jOOQ:

shl(1, 4)

Translates to the following dialect specific expressions:

-- ASE, HSQLDB, SQLDATAWAREHOUSE, SYBASE
(1 * CAST(power(2, 4) AS int))

-- AURORA_MYSQL, AURORA_POSTGRES, BIGQUERY, COCKROACHDB, DUCKDB, MARIADB, MEMSQL, MYSQL, POSTGRES, REDSHIFT, SQLITE, 
-- SQLSERVER, VERTICA, YUGABYTEDB
(1 << 4)

-- DB2, INFORMIX
(1 * CAST(power(2, 4) AS integer))

-- EXASOL
bit_lshift(1, 4)

-- FIREBIRD
bin_shl(1, 4)

-- H2
lshift(1, 4)

-- ORACLE
(1 * CAST(power(2, 4) AS number(10)))

-- SNOWFLAKE
bitshiftleft(1, 4)

-- TERADATA
shiftleft(1, 4)

-- TRINO
bitwise_left_shift(1, 4)

-- ACCESS, DERBY, HANA
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.19, 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