473,378 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Need help converting oracle decode statement for MS Access

ollyb303
Hello,

I have been using the following expression in Access as part of a statement to query an Oracle database:

Expand|Select|Wrap|Line Numbers
  1. (Sum(CASE WHEN STATS_DAILY_SA.LOGIN_TIME > (STATS_DAILY_SA.SCHEDULED_TIME - DECODE(STATS_DAILY_SA.EXCEPTION_TIME, Null, 0, 
  2. STATS_DAILY_SA.EXCEPTION_TIME)) THEN 0 ELSE ((STATS_DAILY_SA.SCHEDULED_TIME - DECODE(STATS_DAILY_SA.EXCEPTION_TIME, Null, 0, 
  3. STATS_DAILY_SA.EXCEPTION_TIME)) - STATS_DAILY_SA.LOGIN_TIME) END)/Sum(STATS_DAILY_SA.SCHEDULED_TIME)*100)
It works fine.

However, I now need to use the same statement (well, get the same result at least) within Access - the Query I will be querying, "Query2" has the same fields, but I am trying to use this expression as part of a crosstab query:

Expand|Select|Wrap|Line Numbers
  1. TRANSFORM (Sum(CASE WHEN Query2.LOGIN_TIME > (Query2.SCHEDULED_TIME - DECODE(Query2.EXCEPTION_TIME, Null, 0, 
  2. Query2.EXCEPTION_TIME)) THEN 0 ELSE ((Query2.SCHEDULED_TIME - DECODE(Query2.EXCEPTION_TIME, Null, 0, 
  3. Query2.EXCEPTION_TIME)) - Query2.LOGIN_TIME) END)/Sum(Query2.SCHEDULED_TIME)*100) AS SumOfSTAT
This doesn't work, giving me a 3075 Error - syntax error (missing operator) in query expression...

I first assumed that this was due to using the Decode function (which I don't believe works in Access?), so I tried using IIFs and even Switch statements, but I'm getting similar errors.

Can anyone help with this, I'm getting a serious headache here!!

Many thanks,

Olly
Feb 4 '09 #1
1 5451
Solved this by converting my Nulls to zero on the way into query2 using NVL, then used a simpler IIF statement for the crosstab:

Expand|Select|Wrap|Line Numbers
  1. (Sum(IIf(Query2.LOGIN_TIME>(Query2.SCHEDULED_TIME-Query2.EXCEPTION_TIME),0,(Query2.SCHEDULED_TIME-Query2.EXCEPTION_TIME-Query2.LOGIN_TIME)))/Sum(Query2.SCHEDULED_TIME)*100)
Feb 4 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: etravels | last post by:
Hiyas I am currently working on Oracle Report which ties in with my a report in the ebusiness suite of Oracle telesales module. Basically, the address on statement reports have blank fields...
3
by: Jevon | last post by:
I am trying to conert a SQL Server (2000) database to Oracle to see if it is a supportable back end for my product. I am running into a stone wall with Stored Procedures though. I was wondering...
1
by: richasaraf | last post by:
Hello everyone, I'm facing problem in converting CASE statements into DECODE. As i have PL/SQL 8i, so it does not handle CASE statements. Please send me the solutions . Then basic problem is the...
2
by: Amin Schoeib | last post by:
Hi, Like I see there is no equivalent to the Oracle decode Function In Postgres.Is there maybe somebody who wrote decode as a Function? Schoeib 4Tek Gesellschaft für angewandte...
1
by: Michael John | last post by:
Dear Oracle Developers, my task is to make up a Oracle View from a Pivot table in MS Access. Given are two tables to join: T_FIRM: FIRM_ABBR VARCHAR2(3 BYTE), FIRM_LONG ...
8
by: Alfonso Esteban Gonzalez Sencion | last post by:
I am trying to use Access as a front end for extracting information from an Oracle database. I started using linked tables but I am getting a very curious behaviour. When I consult the linked...
16
by: Medhatithi | last post by:
Hi, I am facing a strange problem with decode function in oracle. My table name is status_hist. Below is the query I am hitting on this table: select...
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
9
by: Michael Goerz | last post by:
Hi, I am writing unicode stings into a special text file that requires to have non-ascii characters as as octal-escaped UTF-8 codes. For example, the letter "ƨ" (latin capital I with acute,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.