?
Solved

Alias in Microsoft Query no longer recognized

Posted on 2013-01-09
5
Medium Priority
?
1,202 Views
Last Modified: 2013-01-19
I have some Excel 2010 workbooks that connect to an Oracle database. Data is returned via Microsoft Query. The query contains some aliases. The data continues to be returned to the spreadsheet with no errors on update. However, if I try to edit the query, I get the following error message: ORA-923: FROM keyword not found where expected. I've discovered that if I delete the alias, I do not get the error.

At first I thought it had to do with upgrading to a new computer (Windows 7 64bit), but I've tested on older computers in the office and I get the same error.

The code follows:
SELECT AR_TRX_HEADER.SONO, AR_TRX_HEADER.INVOICEDATE, GA_BLOCK.ID, Sum(AR_TRX_PRODUCT.QNT) AS "SHIP", AR_TRX_CHARGE_VIEW.QNT AS "SOLD", Sum(AR_TRX_HEADER_AUX.QNT) AS "COUNT", Sum(AR_TRX_PRODUCT.QNT*AR_TRX_DETAIL.COSTPRICE) AS "REVENUE"
FROM COMPANY_1.AR_TRX_CHARGE_VIEW AR_TRX_CHARGE_VIEW, COMPANY_1.AR_TRX_DETAIL AR_TRX_DETAIL, COMPANY_1.AR_TRX_HEADER AR_TRX_HEADER, COMPANY_1.AR_TRX_HEADER_AUX AR_TRX_HEADER_AUX, COMPANY_1.AR_TRX_PRODUCT AR_TRX_PRODUCT, COMPANY_1.GA_BLOCK GA_BLOCK
WHERE AR_TRX_PRODUCT.ARTRXHDRIDX = AR_TRX_HEADER.ARTRXHDRIDX AND AR_TRX_DETAIL.ARTRXHDRIDX = AR_TRX_PRODUCT.ARTRXHDRIDX AND AR_TRX_DETAIL.ARTRXDTLSEQ = AR_TRX_PRODUCT.ARTRXDTLSEQ AND AR_TRX_HEADER_AUX.ARTRXHDRIDX = AR_TRX_PRODUCT.ARTRXHDRIDX AND AR_TRX_HEADER_AUX.ARTRXDTLSEQ = AR_TRX_DETAIL.ORIGINALSEQ AND GA_BLOCK.GABLOCKIDX = AR_TRX_PRODUCT.GABLOCKIDX AND AR_TRX_CHARGE_VIEW.ARTRXHDRIDX = AR_TRX_PRODUCT.ARTRXHDRIDX
GROUP BY AR_TRX_HEADER.SONO, AR_TRX_HEADER.INVOICEDATE, GA_BLOCK.ID, AR_TRX_CHARGE_VIEW.QNT, AR_TRX_DETAIL.GLDELETECODE, AR_TRX_HEADER_AUX.TAB, AR_TRX_HEADER.CUSTNAMEIDX, AR_TRX_CHARGE_VIEW.CHARGEMETHODTYPE, AR_TRX_CHARGE_VIEW.FCCHARGEIDX, AR_TRX_CHARGE_VIEW.LINENO, AR_TRX_PRODUCT.GABLOCKIDX
HAVING (AR_TRX_HEADER.INVOICEDATE>{ts '2012-01-01 00:00:00'} And AR_TRX_HEADER.INVOICEDATE<={ts '2012-12-31 00:00:00'}) AND (AR_TRX_DETAIL.GLDELETECODE='N') AND (AR_TRX_HEADER_AUX.TAB=2) AND (AR_TRX_HEADER.CUSTNAMEIDX=9) AND (AR_TRX_CHARGE_VIEW.CHARGEMETHODTYPE='1') AND (AR_TRX_CHARGE_VIEW.FCCHARGEIDX=17) AND (AR_TRX_CHARGE_VIEW.LINENO=1) AND (AR_TRX_PRODUCT.GABLOCKIDX<>128 And AR_TRX_PRODUCT.GABLOCKIDX<>127 And AR_TRX_PRODUCT.GABLOCKIDX<>135)
ORDER BY AR_TRX_HEADER.INVOICEDATE
0
Comment
Question by:clcarlson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 38759594
Should the alias column names have quotes around them?
0
 

Author Comment

by:clcarlson
ID: 38759627
I've tried double quotes, single quotes, no quotes, no AS. Nothing seems to work any more. Originally the query had single quotes and no error. The issue began mid-December. I notice there were quite a few Office 2010 updates on 12-12-12.
0
 
LVL 23

Expert Comment

by:NBVC
ID: 38759851
I haven't played with MS Query in Excel 2010 yet, so not sure why it would bark at you.... hopefully someone with some experience can further assist...
0
 

Accepted Solution

by:
clcarlson earned 0 total points
ID: 38774833
Contacted Microsoft support. It was a known issue. It required an edit to the registry:
1. HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\query\options
2. After you select the subkey that is specified in step 1, point to New on the Edit menu, and then click DWORD Value.
3. Type AllowAlias, and then press ENTER.
4. Right-click AllowAlias, and then click Modify.
5. In the Value data box, type 2, and then click OK.
6. On the File menu, click Exit to exit Registry Editor.
0
 

Author Closing Comment

by:clcarlson
ID: 38796056
Because I found the solution myself by contacting Microsoft support.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question