One Star

[resolved] Type mismatch: cannot convert string to date.

Hi,
I have a scenario in which data present in emp_dept.csv file should be split and inserted into two respective tables(EMP,DEPT)
Actually there is a field DOB declared as string in input schema(.csv file) but in EMP table the same column declared as date.
I tried with tMap TalendDate.formatting function also but getting the following error.
Type mismatch: cannot convert string to date.
Can somebody help me to overcome the situation.
Thanks
Babu Chokka

5 REPLIES
One Star

Re: [resolved] Type mismatch: cannot convert string to date.

Hi
Have you tried to use formatDate function?
TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",myDate)
One Star

Re: [resolved] Type mismatch: cannot convert string to date.

Hi,  I have tried using the TalendDate.formatDate function but still getting the type mismatch error.
I have two tables EMP and DEPT, I am trying to insert records from .CSV file to these tables using tMap.
- EMP contains columns EMP_NO, NAME, DOB, DESIGNATION and DEPT_NO
- DEPT contains columns DEPT_NO and DEPT_NAME 
While inserting giving the below error since DOB is string in .CSV file but the DOB column declared as Date in EMP table.
Note :- Due to Date datatype only getting the error, if we make the DOB column as varchar2 then there is no issue.
One Star

Re: [resolved] Type mismatch: cannot convert string to date.

sorry forgot to keep the error i.e, Type mismatch :cannot convert from string to date
One Star

Re: [resolved] Type mismatch: cannot convert string to date.

Hi Daniel,
Thanks for your guidance, it worked for me when I tried with TalendDate.parseDate("dd/MM/yyyy",row1.DOB(input schema column name))
Regards
Babu Chokka
Four Stars

Re: [resolved] Type mismatch: cannot convert string to date.

Hi, in this format 

TalendDate.parseDate("dd/MM/yyyy",row1.DOB(input schema column name))

can you please what to substitute in place of input schema