|
|
Question : PPRO*C and TIMESTAMP, DATE variable
|
|
Is it possible to define a TIMESTAMP or DATE variables in a PRO*C program? How can I get or enter date, timestamp values without converting them from and to char[?]
|
Answer : PPRO*C and TIMESTAMP, DATE variable
|
|
Hi, you can declare a char variable for date data types and fetch the date into them:
char * getDate() {
char * date;
EXEC SQL BEGIN DECLARE SECTION; char my_date[25]; char db_name[10]; EXEC SQL END DECLARE SECTION;
EXEC SQL AT :db_name SELECT SYSDATE into :my_date from DUAL;
if (sqlca.sqlcode != 0) printf("Error getting date.\n"); else { date = new char[strlen(my_date)+1]; strcpy(date,my_date); } return date; }
|
|
|
|
|