Hello Alexander,

 

To have a behavior the nearest possible to Oracle, I use STRICT_TRANS_TABLES sql_mode.

But then I have a problem with cast to varchar that failed with “truncated incorrect value” .

 

Ex:

set sql_mode='ORACLE,STRICT_TRANS_TABLES';

delimiter /

CREATE or replace procedure p3(b1 integer)

AS

  strres VARCHAR(4); 

BEGIN

  strres:=cast('123456' as char(4));

END

/

call p3(-1)

/

-- Failed with : ERROR 1292 (22007): Truncated incorrect CHAR(4) value: '123456'

 

But

 

select cast('11111' as varchar(2)) from dual;

 

just issue a warning, not an error.

 

On Oracle, Sybase,SQLServer and DB2, cast a string to a shorter string never issue warnings nor error.

 

What do you think about ?

 

Regards,

Jérôme.