How much do you know about 'varchar' type in DB2?
I thought I knew, until I ran a little test and got a nasty surprise.
Here's a simple test case to illustrate:
db2 => create table smallt ( c1 varchar(1));
DB20000I The SQL command completed successfully.
db2 => insert into smallt values('B ') ;
DB20000I The SQL command completed successfully.
db2 => select * from smallt ;
C1
--
B
1 record(s) selected.
See the 'problem'?
This behaviour can be very disturbing for those used to Oracle DB. Another potential 'hidden' bug for Oracle developer doing DB2.
No comments:
Post a Comment