我正在使用 Oracle 的异构服务 (HS)。我有一个指向 Microsoft Access 表的数据库链接,名为employee
. 通过使用 SQL*Plus 的 Oracle 连接,我可以描述表的列和数据类型 ( desc employee
)。我还可以从远程表中选择并接收记录。
但是,当使用匿名块时,我收到 Oracle 错误:
ORA-02070: database MSAccessODBC64 does not support TO_NUMBER in this context
MSAccessODBC64
是我在 Windows 7 中配置的 ODBC DSN。
编码:
declare
my_record_position number := 60109;
my_record employee@MSAccessODBC64bit%rowtype;
begin
select
*
into
my_record
from
eemployee@MSAccessODBC64bit ---->> When I remove the database link, it works
where
staff_number = my_record_position ---->> when I remove the where clause, it works
order by
staff_number asc;
dbms_output.put_line(my_record.staff_number);
end;
/
错误:
declare
*
ERROR at line 1:
ORA-02070: database MSAccessODBC64 does not support TO_NUMBER in this context
ORA-06512: at line 5
是否需要某种问题或选项才能使 HS 工作?我在看什么?
当我使用替换变量时,它会起作用并显示employee
id
.
define emp = 60109;
declare
my_record_position number := 60109;
my_record employee@MSAccessODBC64bit%rowtype;
begin
select
*
into
my_record
from
employee@MSAccessODBC64bit
where
staff_number = &emp
order by
staff_number asc;
dbms_output.put_line('emp=' || my_record.staff_number);
end;
/
emp=60109
PL/SQL procedure successfully completed.
===========initMSAccessODBC64bit.ora for ODBC==============
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
#
# HS init parameters
#
HS_DESCRIBE_CACHE_HWM = 4000
HS_FDS_CONNECT_INFO = MSAccessODBC64bit
HS_FDS_TRACE_LEVEL = DEBUG
HS_OPEN_CURSORS = 50
HS_RPC_FETCH_REBLOCKING = ON
HS_RPC_FETCH_SIZE = 10000
HS_FDS_FETCH_ROWS = 100
HS_TRANSACTION_MODEL = READ_ONLY
#This was supposed to fix ORA-02070: database MSAccessODBC64bit does not
#support TO_number in this context
#This didn't work
#EnableWCharSupport = 0