ORA-1861: literal does not match format string

时间:2018-01-11 08:44:27

标签: sql-server oracle stored-procedures

I've encountered a quite strange behavior of a procedure called from various environments. The procedure is implemented in Oracle environment.

function licence_update(p_licence ax_import_licence_vw%rowtype) return number;

When I run the statement from Oracle everything is allright:

declare l_res number := null; begin l_res := licence_update(p_licence); end;

But when the same procedure is called from MS SQL using OPENROWSET I get an error

ORA-1861: literal does not match format string.

EXECUTE ('BEGIN licence_update(p_licence); END;') AT LinkedServer;

There is a date attribute in the view ax_import_licence_vw, that certainly cause the error. If I take out this attribute the procedure always finished successfully.

So, I guess it happens because of NLS_DATE_FORMAT that is set up differently when the procedure is called. I took a look at the log table and found out the following information about nls_date_formats:

from Oralce: DD.MM.RR
from MS SQL: YYYY-MM-DD HH24:MI:SS

What kind of converting operation should be done to that date attribute to get rid of this error?

0 个答案:

没有答案