HELP! Date functions make my brain hurt!

From: Mike Stenzler <rxrgroup_at_earthlink.net>
Date: 1996/08/16
Message-ID: <4v2d9g$cj5_at_bolivia.it.earthlink.net>#1/1


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')

can anyone help?

my parameters are char strings of the format 'MM-DD-YY' I usually retrieve dates from the DB using:

         to_char(ev_date, 'MM-DD-YY')

I'd appreciate any clues.

TIA - mike Received on Fri Aug 16 1996 - 00:00:00 CEST

Original text of this message