DB variable substitution in Pro*C

Hi,

I have declared two DB variables as
EXEC SQL BEGIN DECLARE SECTION;
static long db_sample_date_val;
static int db_sample_time_val;
EXEC SQL END DECLARE SECTION;

and I'm using these varibales in my code as
EXEC SQL
INSERT
INTO sample_tbl(sample_dt)
VALUES (TO_DATE(:db_sample_date_val::db_sample_time_val, 'J:SSSSS'));

I have to use colon infornt of the DB variable for value substitution. But when I execute this query using Pro*C,
I'm getting an SQL Exception because of the two colon being used.

I also tried TO_DATE(':db_sample_date_val::db_sample_time_val', 'J:SSSSS') and
TO_DATE(':db_sample_date_val':':db_sample_time_val', 'J:SSSSS'). But I still get the Exception.

Can anyone help me with this piece of code ?

Thanks in advance!!!
Mary Antony

to_date takes a char

EXEC SQL BEGIN DECLARE SECTION;
static long db_sample_date_val=0;
static int db_sample_time_val=0;
static char something[32]={0x0};
EXEC SQL END DECLARE SECTION;

sprintf(something, "%d:%05d", db_sample_date_val, db_sample_time_val)
EXEC SQL
   INSERT
INTO sample_tbl(sample_dt)
VALUES (TO_DATE(:something, 'J:SSSSS'));

Also, do not neglect checking for sqlca.sqlcode < 0 after every sql operation.