-
Hiya everybody
I'm having a bit of trouble with an SQL statement and I wondered if anyone knew where I was Going wrong. I want to extract data from a table. The user can specify dates between which the data will be displayed.
The user inputs the start and end dates which are place into the variables 'Starter' and 'Ender'.
When I try to run the search I get the following error message:
"Missing right parenthesis"
Heres my SQL Statemet ( it is one long line ):
cmmSQL = "SELECT StartDateTime, EndDateTime, DurationSecs, CallersNumber, DialledNumber,TerminatingNumber, ValuePence
FROM Opal_Data
WHERE TerminatingNumber = '" & PRSselecta & "'
AND
StartDateTime >=TODATE(" & Starter & ",DD/MM/YYYY HH:MM:SS)
AND
EndDateTime <=TODATE(" & Ender & ", DD/MM/YYYY HH:MM:SS) "
Set rsCDR = cnAcqAcc.Execute(cmmSQL)
rsCDR.MoveFirst
Any Help appreciated!
Cheers 'n' Beers
Skeen
-
Hi Skeen, What database is this coming from ?
Ian
-
Hi Ian
I'm running Oracle 8i
Cheers 'n' beers
Skeen
-
I'm sorry mate but I've nether used Oracle SQL before (unfortunatley it is different from SQL Server)
but in SQL server, the equivelent of TODATE(" & Starter & ",DD/MM/YYYY HH:MM:SS), the DD/MM/YYYY HH:MM:SS part need's to be in quotes. If it doesn't in Oracle then i'm sorry I cant help.
Ian