从Oracle更新SQL Server表中的日期/时间值

时间:2013-06-04 11:41:39

标签: sql-server oracle date

从Oracle,通过DBLINK,我试图更新MS-SQL Server数据库中日期字段中的值。

但是,当我运行此查询时

update axp@mis
SET "ExpireDate" = '2013-06-04 12:00:00'
WHERE "IdNumber" = 103;

我收到消息:

[Error] Execution (13: 16): ORA-28534: Heterogeneous Services preprocessing error

我也试过

update axp@mis
SET "ExpireDate" = to_date('2013-06-04 12:00:00','yyyy-mm-dd HH24:MI:SS')
WHERE "IdNumber" = 103;

我收到了消息:

[Error] Execution (14: 1): ORA-02070: database MISDOORACCESS does not support TO_NUMBER in this context

有人可以建议我如何从Oracle执行此更新吗?

1 个答案:

答案 0 :(得分:1)

您必须使用CAST功能。试试这个:

declare
     v_date date:=to_date('2013-06-04 12:00:00','yyyy-mm-dd HH24:MI:SS');
begin
     update axp@mis set "ExpireDate"=cast(v_date as date) WHERE "IdNumber" = 103;
     commit;
end;