| 
		
			| Indicator Values for DATES [message #458706] | Tue, 01 June 2010 07:08  |  
			| 
				
				
					| mjm22 Messages: 54
 Registered: January 2010
 Location: Singapore
 | Member |  |  |  
	| Hi, 
 If doing an insert into DATE type fields like below... how do I employ null indicator values with the TO_DATE sql to cope with NULL values for the End Date?
 I can test the NULLness of the pServiceRecord->itemTo value and set the indicator ind_dbToDate to -1 but I don't know how to incorporate this with the to_date syntax (if I can)?
 
 
 
EXEC SQL BEGIN DECLARE SECTION;
    char    dbFromDate[MAX_DATE_LEN];
    char    dbToDate[MAX_DATE_LEN];
    short   ind_dbToDate;
    EXEC SQL VAR dbFromDate IS STRING;
    EXEC SQL VAR dbToDate IS STRING;
EXEC SQL END DECLARE SECTION;
sprintf(dbFromDate,"%s",pServiceRecord->itemFrom);
sprintf(dbToDate,"%s",pServiceRecord->itemTo);
EXEC SQL
insert into MYDATES (from_date, to_date)
             values (TO_DATE(:dbFromDate,:dbOraDateFmt),
                     TO_DATE(:dbToDate,:dbOraDateFmt));
 |  
	|  |  | 
	|  | 
	|  |