In Oracle, the CHAR(n) data type stores fixed-length, blank padded character strings with the maximum size of 2000 bytes (default) or characters.
In PostgreSQL, you can use CHAR(n) that can store up to 10,485,760 characters.
Oracle:
-- Sample table CREATE TABLE specs ( note CHAR(30), data CHAR, -- CHAR(1) name CHAR(100 CHAR), -- size in characters item CHAR(50 BYTE) -- size in bytes );
PostgreSQL:
-- Sample table CREATE TABLE specs ( note CHAR(30), data CHAR, -- CHAR(1) name CHAR(100), -- size always in characters item CHAR(50) );
Conversion summary:
Oracle | PostgreSQL | |
Syntax | CHAR[(n [CHAR | BYTE])] | CHAR[(n)] |
Parameter | n is the number of characters or bytes (default) | n is the number of characters |
Range | 1 ⇐ n ⇐ 2000 | 1 ⇐ n ⇐ 10,485,760 |
Default | n is 1 | n is 1 |
For more information, see Oracle to PostgreSQL Migration.