Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-03-12
9
Medium Priority
?
1,026 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 2000 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 49

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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 article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

636 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