I exported a database from Informix 11.50 and want to import it to Informix 14.10.
dbexport -ss -c -q iscala
The exported SQL script starts with the following:
{ DATABASE iscala delimiter | }
EXECUTE PROCEDURE ifx_allow_newline ('t');
grant dba to "informix";
grant dba to "waspop";
grant connect to "jzl";
create distinct type 'informix'.vestnik as decimal(4,0);
grant usage on type 'informix'.vestnik to 'public' as 'informix';
drop cast (decimal(4,0) as vestnik);
create explicit cast (decimal(4,0) as vestnik with 'informix'.date_vestnik);
CREATE FUNCTION "informix".date_vestnik(vestnik DATE) RETURNING vestnik WITH(NOT VARIANT);
RETURN ((CASE WHEN MONTH(vestnik)=12 AND DAY(vestnik)>12 THEN DAY(vestnik) ELSE MONTH(vestnik) END)
*100+MOD(YEAR(vestnik),100))::NUMERIC(4,0)::vestnik;
END FUNCTION;
create explicit cast (vestnik as integer with 'informix'.vestnik_int);
CREATE FUNCTION "informix".vestnik_int(vestnik vestnik) RETURNING INT WITH(NOT VARIANT);
RETURN vestnik::NUMERIC(4,0)::INT;
END FUNCTION;
create explicit cast (integer as vestnik with 'informix'.int_vestnik);
CREATE FUNCTION "informix".int_vestnik(vestnik INT) RETURNING vestnik WITH(NOT VARIANT);
RETURN vestnik::NUMERIC(4,0)::vestnik;
END FUNCTION;
create explicit cast (vestnik as decimal(4,0) with 'informix'.vestnik_date);
CREATE FUNCTION "informix".vestnik_date(vestnik vestnik) RETURNING DATE WITH(NOT VARIANT);
DEFINE y, m, d INT;
LET y = MOD(vestnik::NUMERIC(4,0),100);
LET m = TRUNC(vestnik::NUMERIC(4,0)/100);
LET d = 1;
IF m<1 THEN RETURN NULL;
ELIF m>20 THEN RETURN NULL;
ELIF m>12 THEN LET m,d = 12,m;
END IF
IF y<0 THEN RETURN NULL;
ELIF y<50 THEN LET y = 2000+y;
ELSE LET y = 1900+y;
END IF
RETURN MDY(m,d,y);
END FUNCTION;
{ TABLE "informix".pbcattbl row size = 369 number of columns = 25 index size = 31 }
{ unload file name = pbcat00100.unl number of rows = 0 }
...
...
When I run the import with this SQL script I receive the following error
[informix@srvbib ~]$ dbimport -c -d datadbs -i /home/informix/ iscala
{ DATABASE iscala delimiter | }
grant dba to "informix";
grant dba to "waspop";
grant connect to "jzl";
create distinct type 'informix'.vestnik as decimal(4,0);
grant usage on type 'informix'.vestnik to 'public' as 'informix';
drop cast (decimal(4,0) as vestnik);
create explicit cast (decimal(4,0) as vestnik with 'informix'.date_vestnik);
CREATE FUNCTION "informix".date_vestnik(vestnik DATE) RETURNING vestnik WITH(NOT VARIANT);
RETURN ((CASE WHEN MONTH(vestnik)=12 AND DAY(vestnik)>12 THEN DAY(vestnik) ELSE MONTH(vestnik) END)
*100+MOD(YEAR(vestnik),100))::NUMERIC(4,0)::vestnik;
END FUNCTION;
create explicit cast (vestnik as integer with 'informix'.vestnik_int);
CREATE FUNCTION "informix".vestnik_int(vestnik vestnik) RETURNING INT WITH(NOT VARIANT);
RETURN vestnik::NUMERIC(4,0)::INT;
END FUNCTION;
create explicit cast (integer as vestnik with 'informix'.int_vestnik);
CREATE FUNCTION "informix".int_vestnik(vestnik INT) RETURNING vestnik WITH(NOT VARIANT);
RETURN vestnik::NUMERIC(4,0)::vestnik;
END FUNCTION;
create explicit cast (vestnik as decimal(4,0) with 'informix'.vestnik_date);
*** prepare sqlobj
201 - A syntax error has occurred.
*** execute sqlobj
201 - A syntax error has occurred.
When I remove the procedure it works OK. If I try to create the function using the dbaccess, I can create it without issues.
Do you please know or could you please provide some advice or hint on how to solve this issue? Thank you.