I'm trying to retrieve a range of dates from a table.
I'm wrinting in Visual C++ & accesing the db thru DTK++ - a class
library marketed by Intersolv that puts a thin wrapper around ODBC
the ? char is the replacement metachar for binding parameters &
retrieval values
Essentailly I want to do somthing like this:
int GetDates(char *event, char dates[][DATE_SIZE], char *s, char *e)
{
char evdate[DATE_SIZE];
int i = 0;
// do DTK initialization stuff here
// bind query parameters here - simplified
SetParam(1, event); // event param
SetParam(2, s); // starting date
SetParam(3, e); // ending date
// bind result here
Bind(1, evdate);
// my select - w/o DTK stuff
select ev_date
from event_dates
where event = ? // 1st param - the event
and ev_date >= ? // 2nd param - the starting date
and ev_date <= ? // 3rd param - the ending date
order by ev_date;
// fetch repeatedly until no more rows
for(qry->fetchfirst(); qry->sqlsuccess(); qry->fetchnext, i++)
{
strcpy(evdates[i], evdate);
}
return(i);
}
there is no problem with the fetching logic, etc. My problem is in
how to use the date functions provided by Oracle to convert my
values to Julian so I can do a compare in my where clause.
I've tried: and ev_date >= to_date(?, 'J')