Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multibyte vs CHAR(1 char) confusion

Mike KutzJul 21 2025

Why does a specific emoji require 2 Characters?

or is this a bug in Oracle 23.7 FREE VirtualBox?

test code:

-- mostly AI generated code
create table Tiles (
	tile_id number generated by default as identity primary key,
	sql_output char(1 char), -- expected version
	terrain_type varchar2(50) not null unique, -- Describes the type of terrain, e.g., 'Forest', 'Mountain'
	filename varchar2(255),
	tile_type varchar2(20),
	constraint chk_tile_type check (tile_type in ('Area', 'Path', 'Town'))
);

insert into tiles  (filename, sql_output, terrain_type, tile_type) 
			values ('mountain.png', '🏔️', 'Mountain', 'Area');

-- fails with ORA-12899

alter table Tiles modify sql_output char(2 char);

insert into tiles  (filename, sql_output, terrain_type, tile_type) 
			values ('mountain.png', '🏔️', 'Mountain', 'Area');

commit;

select dump( sql_output ) dmp
from Tiles
where terrain_type = 'Mountain';

-- Typ=96 Len=7: 240,159,143,148,239,184,143

drop table Tiles purge;
This post has been answered by Paulzip on Jul 21 2025
Jump to Answer
Comments
Post Details
Added on Jul 21 2025
7 comments
195 views