PostgreSQL 16進数に変換する
- 作成日 2022.10.05
- 更新日 2022.12.29
- PostgreSQL
- PostgreSQL

PostgreSQLで、16進数に変換する手順を記述してます。「to_hex」に数値を指定することで可能です。
環境
- OS Rocky Linux release 8.4 (Green Obsidian)
- PostgreSQL 14.0
- pgadmin4 6.16
手順
16進数に変換する場合は、「to_hex」を利用します。
to_hex(数値)
実際に、「15」を16進数に変換します。
SELECT
to_hex(12) AS "to_hex(12)",
to_hex(13) AS "to_hex(13)",
to_hex(14) AS "to_hex(14)",
to_hex(15) AS "to_hex(15)",
to_hex(16) AS "to_hex(16)",
to_hex(17) AS "to_hex(17)";
実行結果

変換されていることが確認できます。
-
前の記事
SQL Server 文字列を置換する 2022.10.05
-
次の記事
python numpyで標準偏差を求める 2022.10.05
コメントを書く