链接服务器“FDMEE_SIMPHONY”的 OLE DB 提供程序“OraOLEDB.Oracle”返回消息“ORA-00903:无效表名”
Posted
技术标签:
【中文标题】链接服务器“FDMEE_SIMPHONY”的 OLE DB 提供程序“OraOLEDB.Oracle”返回消息“ORA-00903:无效表名”【英文标题】:OLE DB provider "OraOLEDB.Oracle" for linked server "FDMEE_SIMPHONY" returned message "ORA-00903: invalid table name" 【发布时间】:2021-10-16 03:42:59 【问题描述】:我试图在两个链接的服务器之间运行此查询,但它返回消息ORA-00903
Invalid table。
--代码
SELECT * FROM OPENQUERY ([Database1],
'SELECT ''Simphony_ARCS-Operational'', ''Mar'', ''03'', ''2020'', ''DayPlaceholder''AS DAY,
SUM((MENU_ITEM_DAY_PART_TOTAL.SALESTOTAL) - (MENU_ITEM_DAY_PART_TOTAL.DISCOUNTTOTAL)) AS NETSALESTOTAL,
MENU_ITEM_DAY_PART_TOTAL.ORGANIZATIONID,
CONCAT(MENU_ITEM_DAY_PART_TOTAL.REVENUECENTERID, ''_REV'') AS REV_ID,
UPPER(CASE WHEN DAY_PART.NAME IS NULL THEN ''DINNER''
ELSE DAY_PART.NAME END) AS DAYPART,
COALESCE(sc.stringtext, scc.stringtext) as MenuItemClassName,
sm.stringtext as MenuItemName,
su.stringtext as ZoneORLocation
FROM
--LOCATION_ACTIVITY_DB.MAJOR_GROUP
[10.xxx.1.xxx].[Database2].[TRANS].menu_item_definition d
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table sm
on d.name1id = sm.stringnumberid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].menu_item_master m
on d.menuitemmasterid = m.menuitemmasterid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].hierarchy_structure s
on d.hierstrucid = s.hierstrucid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].hierarchy_unit u
on s.hierunitid = u.hierunitid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table su
on u.nameid = su.stringnumberid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].menu_item_class c
on d.hierstrucid = c.hierstrucid and d.menuitemclassobjnum = c.objectnumber
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].menu_item_class cc
on s.parenthierstrucid = cc.hierstrucid and d.menuitemclassobjnum = cc.objectnumber
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table sc
on c.nameid = sc.stringnumberid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table scc
on cc.nameid = scc.stringnumberid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].sales_itemizer i
on c.hierstrucid = i.hierstrucid and c.slsitmzrindex = i.slsitmzrindex
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].sales_itemizer ii
on cc.hierstrucid = ii.hierstrucid and cc.slsitmzrindex = ii.slsitmzrindex
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].sales_itemizer pi
on s.parenthierstrucid = pi.hierstrucid and c.slsitmzrindex = pi.slsitmzrindex
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table si
on i.nameid = si.stringnumberid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table spi
on pi.nameid = spi.stringnumberid
left join [10.xxx.1.xxx].[SimphonyTables].[TRANS].string_table sii
on ii.nameid = sii.stringnumberid
inner join LOCATION_ACTIVITY_DB.REVENUE_CENTER rc
on rc.revenuecenterposref = u.objectnumber
inner join LOCATION_ACTIVITY_DB.MENU_ITEM mi
on m.objectnumber = mi.MENUITEMPOSREF
right outer join LOCATION_ACTIVITY_DB.MENU_ITEM_DAY_PART_TOTAL midpt
on mi.menuitemid = midpt.menuitemid
left outer join LOCATION_ACTIVITY_DB.DAY_PART dp
on midpt.organizationid = dp.organizationid and midpt.daypartid = dp.daypartid
AND MENU_ITEM_DAY_PART_TOTAL.DAYPARTID = DAY_PART.DAYPARTID
WHERE (midpt.ORGANIZATIONID = ''10260'')
AND BUSINESSDATE BETWEEN (TO_DATE(''01-Mar-20'',''DD-MON-YY'')) AND (TO_DATE(''31-Mar-20'',''DD-MON-YY''))
AND mi.MENUITEMPOSREF = ''420000010''
AND rc.REVENUECENTERPOSREF LIKE ''304%''
GROUP BY midpt.ORGANIZATIONID
,COALESCE(sc.stringtext, scc.stringtext)
,sm.stringtext
,midpt.REVENUECENTERID
,dp.NAME
,su.stringtext')
错误信息...
OLE DB provider "OraOLEDB.Oracle" for linked server "FDMEE_SIMPHONY" returned message "ORA-00903: invalid table name".
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT 'Simphony_ARCS-Operational', 'Mar', '03', '2020', 'DayPlaceholder'AS DAY,
SUM((MENU_ITEM_DAY_PART_TOTAL.SALESTOTAL) - (MENU_ITEM_DAY_PART_TOTAL.DISCOUNTTOTAL)) AS NETSALESTOTAL,
MENU_ITEM_DAY_PART_TOTAL.ORGANIZATIONID,
CONCAT(MENU_ITEM_DAY_PART_TOTAL.REVENUECENTERID, '_REV') AS REV_ID,
UPPER(CASE WHEN DAY_PART.NAME IS NULL THEN 'DINNER'
ELSE DAY_PART.NAME END) AS DAYPART,
COALESCE(sc.stringtext, scc.stringtext) as MenuItemClassName,
sm.stringtext as MenuItemName,
su.stringtext as ZoneORLocation
FROM
--LOCATION_ACTIVITY_DB.MAJOR_GROUP
[10.118.1.135].[SimphonyTables].[TRANS].menu_item_definition d
left join [10.118.1.135].[SimphonyTables].[TRANS].string_table sm
on d.name1id = sm.stringnumberid
left join [10.118.1.135].[SimphonyTables].[TRANS].menu_item_master m
on d.menuitemmasterid = m.menuitemmasterid
left join [10.118.1.135].[SimphonyTables].[TRANS].hierarchy_structure s
on d.hierstrucid = s.hierstrucid
left join [10.118.1.135].[SimphonyTables].[TRANS].hierarchy_unit u
on s.hierunitid = u.hierunitid
left join [10.118.1.135].[SimphonyTables].[TRANS].string_table su
on u.nameid = su.stringnumberid
left join [10.118.1.135].[SimphonyTables].[TRANS].menu_item_class c
on d.hierstrucid = c.hierstrucid and d.menuitemclassobjnum = c.objectnumber
left join [10.118.1.135].[SimphonyTables].[TRANS].menu_item_class cc
on s.parenthierstrucid = cc.hierstrucid and d.menuitemclassobjnum = cc.objectnumber
left join [10.118.1.135].[SimphonyTables].[TRANS].string_table sc
on c.nameid = sc.stringnumberid
left join [10.118.1.135].[SimphonyTables].[TR...
【问题讨论】:
去掉括号后,消息仍然显示无效表。。消息 7321,第 16 级,状态 2,第 1 行 那么请使用新的(可能不同!)错误消息更新您的帖子。只需单击“编辑”并在底部添加新的错误文本。另外:如果您还没有,请查看我引用的 Microsoft 链接。 如果您更改了代码...但仍然出现错误...请“edit”您的帖子并在底部添加新的错误文本。如果您的问题得到解决,请告诉我们如何解决。 【参考方案1】:我怀疑问题出在您的方括号上(MSSQL 特定语法;对 Oracle 无效)。
看看这个链接:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/610dfd96-f9b3-41ee-948c-d5763599397e/oracle-linked-server-ole-db-provider-invalid-table-name-or-table-or-view-does-not-exist?forum=sqlintegrationservices
Oracle Linked Server Ole DB Provider 无效的表名或表或视图不存在
大家好,我在通过 SSIS 连接 Oracle 时遇到很大问题 使用 OLE DB Provider for Oracle
数据流,源 Oracle_Connection,我修复了 AlwaysUseDefaultCode 是的,我检索了表“[Oracle]”。“[Tax]”(顶点来了 在自动)。我检查了映射并创建了目的地 助手作为 SQL 表。 IT 确实有效。
数据流,源 Oracle_Connection,我修复了 AlwaysUseDefaultCode 是的,并且...我使用SQL命令编写
select * from [Oracle].[Tax] retrieves (ORA - 00903) invalid table name select * from "[Oracle]"."[Tax]" retrieves (ORA - 00942) table or view does not exist select * from LinkedSever.."[Oracle]"."[Tax]" retrieves (ORA - 00903) invalid table name select * from "LinkedSever".."[Oracle]"."[Tax]" retrieves (ORA - 00903) invalid table name
解决方案:
我明白了。
select * from Oracle.Tax simply without brackets
否则,请尝试此处的故障排除提示:
Set up and troubleshoot a linked server to an Oracle database in SQL Server【讨论】:
以上是关于链接服务器“FDMEE_SIMPHONY”的 OLE DB 提供程序“OraOLEDB.Oracle”返回消息“ORA-00903:无效表名”的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #597 (Div. 2) A. Good ol' Numbers Coloring