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

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, SQLServer, SQLite, Vertica, YugabyteDB

(1 << 4)

ClickHouse

bitShiftLeft(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 */
Generated with jOOQ 3.20. Translate your own SQL on our website

Feedback

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

The jOOQ Logo