Solved

What am I missing with this error:  ORA-00936: missing expression

Posted on 2014-03-12
9
914 Views
Last Modified: 2014-11-03
This is the sequel statement that I have in Microsoft Query and it works fine:  

SELECT SO.DEL_DOC_NUM, SO.SHIP_TO_ZIP_CD, Sum(SO_LN.UNIT_PRC*qty)
FROM SALES.SO SO, SALES.SO_LN SO_LN
WHERE SO_LN.DEL_DOC_NUM = SO.DEL_DOC_NUM AND ((SO.STAT_CD<>'V') AND (SO_LN.VOID_DT Is Null))
GROUP BY SO.DEL_DOC_NUM, SO.SHIP_TO_ZIP_CD, SO.PU_DEL, SO.PU_DEL_DT, SO.SHIP_TO_ZONE_CD, SO.ORD_TP_CD
HAVING (SO.PU_DEL='D') AND (SO.PU_DEL_DT Between {ts '2013-05-01 00:00:00'} And {ts '2013-05-31 00:00:00'}) AND (SO.SHIP_TO_ZONE_CD='HNO') AND (SO.ORD_TP_CD='SAL')

But as soon as I want the statement to allow me to enter data for the dates or the zone cd, I receive the error ORA-00936: missing expression.

I don't know what to look for or how to add an expression to this statement as I'm not writing the code, but instead selecting the fields like through a wizard.
0
Comment
Question by:drozeveld
[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
9 Comments
 
LVL 23

Expert Comment

by:David
ID: 39924173
In Oracle the function syntax for {ts '2013-05-01 00:00:00'} is TO_DATE('2013-05-01','YYYY-MM-DD').

Secondly I suspect, without yet checking, that the GROUP BY may only include columns to the left of the function SUM().

The easiest way to parse where the error occurs -- is to execute the statement in SQL*Plus.  You'll see an asterisk character beneath the offending syntax, working right to left.
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39924233
I just tried taking the items to the right of SUM function away, and my error did not go away.
0
 
LVL 23

Expert Comment

by:David
ID: 39924241
And changing the {ts....?
0
Industry Leaders: 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!

 
LVL 1

Author Comment

by:drozeveld
ID: 39924275
In Microsoft Query, I always use the "wizard" type of input.  When I want a date range, I've always changed the "filter" to:  BETWEEN and then in the box below I've entered [begdate],[enddate].  By doing this, a pop-up box appears and I have to enter the date like:  01-may-13.

With that being said, I'm a little lost on how to change the to TO_DATE to be able to require the pop-up boxes so that I can enter the date ranges I want to see.

I've attached a screen shot of what I'm looking at.
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39924279
Here is the screenshot
MSQ-SCREENSHOT.tif
0
 
LVL 10

Accepted Solution

by:
dbmullen earned 500 total points
ID: 39933339
I hate to do this but this sounds more like a "mircosoft query" question than an Oracle question.  I did a google search for
"microsoft query oracle date variable"
http://www.mrexcel.com/forum/excel-questions/27292-resolved-oracle-date-time-parameter-msquery.html

what your "query" above has is a "string"
 {ts '2013-05-01 00:00:00'}

something needs to tell oracle that it's really a "date"...  thus, the "to_date" response.
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39938059
You are correct.  This is probably Microsoft Query, instead of Oracle.  I apologize for incorrectly coding.

Thank you for the link to the Mr. Excel thread.  I think that will help me get this figured out.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40419082
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

707 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