开发者

"ORA-01747: invalid user.table.column, table.column, or column specification"

I am trying to execute this query against Oracle linked server, and getting the following error, which I know that my query is malformed, but I couldn't figure out where and how.

开发者_运维技巧
DECLARE @CREDIT_CUST_SQL NVARCHAR(1000) = NULL;
SET @CREDIT_CUST_SQL = 'SELECT 
                           cu.[ST_CD]
                          ,cu.[SRT_CD]
                          ,cu.[TITLE]
                          ,cu.[FNAME]
                          ,cu.[INIT]
                          ,cu.[LNAME]
                          ,cu.[ADDR1]
                          ,cu.[ADDR2]
                          ,cu.[CITY]
                          ,cu.[COUNTRY]
                          ,cu.[ZIP_CD]
                          ,cu.[HOME_PHONE]
                          ,cu.[BUS_PHONE]
                          ,cu.[EXT]
                        FROM [AR].[CUST] cu, 
                             [CUSTOM].[CUST_OTHER] co, 
                             [AR].[CUST_CR] cc
                        WHERE cu.CUST_CD = co.CUST_CD 
                            AND cu.CUST_CD = cc.CUST_CD
                            AND cu.DOB IS NOT NULL'



EXECUTE (@CREDIT_CUST_SQL) AT LIVE_BD;

And I get this error,

"ORA-01747: invalid user.table.column, table.column, or column specification"

Any idea why is happening. Thanks.


Your code looks like SQL Server

Do not use the brackets ([ ]) to quote the column names, just leave it as is for the capitalized valid identifiers or use the (sql standard) double quotes to the non valid identifiers or non capitalized ones.

Like this:

SELECT 
                       cu.ST_CD
                      ,cu.SRT_CD
                      ,cu.TITLE
                      ,cu.FNAME
                      ,cu.INIT
                      ,cu.LNAME
                      ,cu.ADDR1
                      ,cu.ADDR2
                      ,cu.CITY
                      ,cu.COUNTRY
                      ,cu.ZIP_CD
                      ,cu.HOME_PHONE
                      ,cu.BUS_PHONE
                      ,cu.EXT
                    FROM AR.CUST cu, 
                         CUSTOM.CUST_OTHER co, 
                         AR.CUST_CR cc
                    WHERE cu.CUST_CD = co.CUST_CD 
                        AND cu.CUST_CD = cc.CUST_CD
                        AND cu.DOB IS NOT NULL
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜