1

I am currently using TOra as a query browser.

When I run the following query, I get an ORA-00936 missing expression error. This occurs even though I have set values for the bind variables.

SELECT DISTINCT 
    L.LOG_ID,
    L.EVENT_ARG4,
    L.EVENT_TYPE,
    L.EVENT_ARG1,
    L.EVENT_ARG3,
    L.PROD_ITEM_ID,
    TRUNC(L.LOG_DATE) AS LOG_DATE
FROM 
    EVENTLOG L
WHERE 
    L.LOG_DATE >= TO_DATE(:report_start_date, 'YYYY/MM/DD') AND 
    L.LOG_DATE < TO_DATE(:report_end_date, 'YYYY/MM/DD')  

What would be causing this problem?

Dodzi Dzakuma
  • 1,406
  • 2
  • 21
  • 39
  • I actually just started using Oracle SQL Developer, so this is no longer an issue for me. Leaving it just in case anyone else runs into the same problem. – Dodzi Dzakuma Aug 05 '14 at 15:57

1 Answers1

0

Try removing the colons in your WHERE clause.

Your PL-SQL statement should look like this:

SELECT DISTINCT 
    L.LOG_ID,
    L.EVENT_ARG4,
    L.EVENT_TYPE,
    L.EVENT_ARG1,
    L.EVENT_ARG3,
    L.PROD_ITEM_ID,
    TRUNC(L.LOG_DATE) AS LOG_DATE
FROM 
    EVENTLOG L
WHERE 
    L.LOG_DATE >= TO_DATE(report_start_date, 'YYYY/MM/DD') AND 
    L.LOG_DATE < TO_DATE(report_end_date, 'YYYY/MM/DD');
Jorge E. Hernández
  • 2,800
  • 1
  • 26
  • 50
  • The colons are there to signify that those values are bind variables. When I run the query TOra asks me to define the bind variables. I do that. After that it tries to run the query and that is where I get the error. – Dodzi Dzakuma Jul 30 '14 at 13:49