Problem excuting SQL via Pass through

Pyromantic

Board Regular
Joined
Aug 9, 2006
Messages
58
I'm trying to run a pass-through query in Access on a Oracle9 DB but I keep getting an ORA-00936 (ie, I'm missing some syntax etc) but nothing seems to be wrong with my code. Am I missing something :

Code:
SELECT COMPANY, BRANCH, CONTRACT_ID, WEEKENDING_DATE, TRANSACTION_CODE, Sum(TRANSACTION_UNITS) AS SumOfTRANSACTION_UNITS, Sum(BILL_VALUE) AS SumOfBILL_VALUE, Sum(PAY_VALUE) AS SumOfPAY_VALUE, Sum([BILL_VALUE])-Sum([PAY_VALUE]) AS Margin, IIf(Sum([BILL_VALUE])=0 And Sum([PAY_VALUE])<>0,-1,(Sum([BILL_VALUE])-Sum([PAY_VALUE]))/Sum([BILL_VALUE])) AS Margin2, Abs(Sum([BILL_VALUE]))+Abs(Sum([PAY_VALUE])) AS Check, CREATED

FROM EDWARDSG.VIEW_CONTRACT_TRANSACTIONS_DG

GROUP BY COMPANY, BRANCH, CONTRACT_ID, WEEKENDING_DATE, TRANSACTION_CODE, CREATED

HAVING (Abs(Sum([BILL_VALUE]))+Abs(Sum([PAY_VALUE])))<>0
AND CREATED BETWEEN TO_DATE('05/09/2007','DD/MM/YYYY') AND TO_DATE('03/10/2007','DD/MM/YYYY')

Thanks for reading. Any help or pointers would be greatly appreciated.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
couple things I found...
* iif that is not an Oracle function.
* the not equal to operator in Oracle is != not <>
* Not sure if you can say BETWEEN TO_DATE('05/09/2007','DD/MM/YYYY') AND TO_DATE('03/10/2007','DD/MM/YYYY') I've only ever put dates in chronological order with a between. ie between march and may not between may and march... not in the same year anyway

hth,
Giacomo
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,913
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top