Solved

Alias in Microsoft Query no longer recognized

Posted on 2013-01-09
5
1,118 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

752 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