Feb 172014
 

Two tables that look the same, but for some reason I can insert my pounds (£) into the first one, but not the second:

create table i_can_insert (
  into_this varchar2(1)
);

insert into i_can_insert (into_this)
values ('£');

-- I execute some code here

create table but_i_cant_insert (
  into_this varchar2(1)
);

insert into but_i_cant_insert (into_this)
values ('£');

ORA-12899: value too large for column

Why? Put your answers in the comments!

  3 Responses to “SQL Quiz: What’s different about these two tables?”


  1. alter session set nls_length_semantics=BYTE;

    works also with € instead of £ :-)

    • Indeed :)

      As this is client controlled, we’ve started explicitly stating CHAR or BYTE in the table def (e.g. varchar2(1 char)). We had a confusing incident where some multi-byte characters didn’t fit because the settings were different on the developer’s and releaser’s machines…

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>