How to resolve missing right parenthesis error?

Hello Experts,
I am running an SQL query connecting to Oracle DB which runs fine until I include the below where clause:

where c.duration between to_date(:Start_Time,'dd/mm/yyyy hh24:mi:ss') and to_date(:End_Time,'dd/mm/yyyy hh24:mi:ss')

On running the query in DBeaver, I am asked Start and End time values. I enter 13/02/2018 00:00:00 and 13/02/2018 00:59:59. I get the error

SQL Error [907] [42000]:
ORA-00907: missing right parenthesis
ORA-00907: missing right parenthesis
 ORA-00907: missing right parenthesis

I would not be able to paste the full SQL query. So, please let me know if there are any guesses about the possible causes for this error.
Who is Participating?
When you are asked for the Start and End time values, are you entering them in quotes (i.e. '13/02/2018 00:00:00' and '13/02/2018 00:59:59')?
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You do not have a where clause at all before adding above?
Geert GOracle dbaCommented:
it might be a different line than the one you think

execute the query in sqlplus and you should get the line where the error occurs
and then add a parenthesis

some editors, like Toad can highlight the parenthesis
that helps
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

slightwv (䄆 Netminder) Commented:
I'm not familiar with DBeaver but as long as it passes in the variables as strings there is nothing wrong with the syntax.

Using sqlplus:
SQL> select to_date('13/02/2018 00:00:00','dd/mm/yyyy hh24:mi:ss'), 
       to_date('13/02/2018 00:59:59','dd/mm/yyyy hh24:mi:ss') from dual;
02/13/2018 00:00:00 02/13/2018 00:59:59

Open in new window

I agree with the above suggestion:  Try the entire query in sqlplus or other simple tool.  Then you know where the error is being generated.
Gerwin Jansen, EE MVETopic Advisor Commented:
To add to the 'editors' suggestion - put your sql in notepad++ and save it as somefile.sql - sql syntax is then applied.
sukhoi35Author Commented:
Thank you experts. In the Bind Parameters window in DBeaver, I missed including quotes assuming the tool might insert by itself.
Geert GOracle dbaCommented:
another free tool tackling the myth that you can write code to work on all databases
... well all popular databases :)

amazing how many bugs get fixed with this thing every 2 weeks
looks like it's still in beta
what better way to let the whole world test and give feedback ?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.