I am using talend to retrieve data from Oracle DB. I am using tOracleRow to select the data and I am parsing the resultset using tParseRecordSet component. The result set contains date fields and I am getting error on parsing the date filed. Below is my error.
Exception in component tParseRecordSet_1
java.lang.RuntimeException: Unparseable date: "2000-01-01 00:00:00.0"
at routines.system.ParserUtils.parseTo_Date(ParserUtils.java:245)
at data.extract_0_1.Extract.tFileInputExcel_1Process(Extract.java:1821)
at data.extract_0_1.Extract.tOracleConnection_1Process(Extract.java:417)
at data.extract_0_1.Extract.runJobInTOS(Extract.java:2427)
at data.extract_0_1.Extract.main(Extract.java:2292)
I tried using date format - "yyyy-MM-dd'T'HH:mm:ss.ss.S", but still the error exits. Please advise.
Thanks
Try to use tOracleInput to select data from DB. You don't need to use tParseRecordSet in this case.
In schema for 'Date' type column use "yyyy-MM-dd HH:mm:ss.ss" in Date pattern.
I had the same problem and I have resolved changed the oracle select transforming the date field in string using to_char
Related
I am a SQL DBA trying to get some information in Cognos.
The column name is [Packingdate] column.
In order to retrieve last 7 days of packing data information I use the below.
where [Packingdate] >_add_days( current_date, -7 ) -This is working fine.
However when i tried to get November month data I tried the below
[Packingdate] between '2021-11-01' and '2021-11-30'
It is giving me the below error
RQP-DEF-0177 An error occurred while performing operation 'sqlPrepareWithOptions' status='-126'.
Ami missing something?
Remove the quotes:
[Packingdate] between 2021-11-01 and 2021-11-30
When dealing with date or datetime data, YYYY-MM-DD (without quotes) is the format Cognos understands.
I am trying to change the format of a timestamp field to a date field in a certain format with AWS Redshift.
I googled a lot and the common "best practice" that I found was to cast the timestamp to a date and then use to_char to bring it into the right format. In the end I want to use the date field in a Qlik Sense dashboard where it is input for a date picker extension that apparently requires the format DD/MM/YYYY to work.
Current date format in the DB:
9/2/2019 6:38:00 AM (which I would describe as M/D/YYYY H:MM:SS ZZ)
Desired output:
DD/MM/YYYY, resulting in the value 02/09/2019
Current status:
to_char(cast(timestamp_field as date), 'DD/MM/YYYY') --> result: 02/09/2019
However, the date picker extension in Qlik Sense still does not work and I guess that's because the output is a string and not a date. Casting the string to a date returns in an error.
cast(to_char(cast(timestamp_field as date), 'DD/MM/YYYY') as date) as date_picker_date
Connector reply error: SQL##f - SqlState: 57014, ErrorCode: 30,
ErrorMsg: [Amazon][Amazon Redshift] (30) Error occurred while trying
to execute a query: [SQLState 57014] ERROR: Error converting text to
date
I am new to Redshift and would have expected to be able to cast to date with a format string as parameter, but apparently that's not a thing. Can someone enlighten me on how to solve this?
You can try with the timestamp at the beginning of the script of the QlikSense.
It will be at the start of the script. in the Main section as shown below:
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
here SET is being used to define the time stamp in that application.
You can try changing here to your requirements.
Else 2 options 1 use a stamp which you have already used or create your own extension from the lib
Stamp use can be like this:
Datestamp_Table:
Load *,
Date(Date#(StringDate,'M/D/YY'),'DD/MMM/YY') as Date;
LOAD * INLINE [
StringDate
8/7/97
8/6/97];
Output will be like this:
Stringdate Date
8/7/97 07/Aug/97
8/6/97 06/Aug/97
I have Excel data and trying to insert the data into MongoDB using Talend Big Data for Open Studio. This is my job,
tFileInputExcel --> tMap --> tMongoDBOutput
In excel sheet, i have a date value column in this format 7/13/2017(MM/dd/yyyy) as string type and I am trying to insert this column value as ISO format ISODate("2017-07-13T00:00:00.000Z") in MongoDB.
This is my Job:
tFileInputExcel:
tMap:
tMongoDBOutput:
When execute this job, I'm getting the below error.
Error:
When i change the parse format like this TalendDate.parseDate("MM/dd/yyyy",row1.ClosingDate) , I'm getting SimpleDateFormat error. Simple Date Format Error
How to resolve this issue?
you can do simply if you mongodb column schema is date:
TalendDate.parseDate("MM/dd/yyyy",row3.newColumn)
That will automatically convert the date in the date model that your mongoDB column have.
You can change in your schema in Talend the date Model like "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'".
This is a very common mistake doing in reading data without understanding the underlying data types.
I have blogged about this especially for Talend: https://www.tobiasmaasland.de/2017/07/20/using-date-in-talend-etl-jobs/
But let me explain a bit.
Sometimes Excel tries to convert data in the cell even if one might think the cell type is set to String. Insted, it is set to Date. As such, no conversion is needed and the type needs to be Date in the input component.
If it is a String and an error occurs, the the structure of the String is either not the same everywhere or some cells are empty (null). So you might be lucky with
TalendDate.parseDate("MM/dd/yyyy", (row1.ClosingDate == null), "01/01/1970", row1.ClosingDate)
I just assumed you might want to use a placeholder date insted of having null.
This heavily depends on the actual data type in the cells, if every cell has the same data type and if all the data is formatted correctly.
To sum up one of the facts in my blog post: Don't use String for dates. Use Date for dates in Excel. It makes everything easier.
I am getting response from json and after that I directly save json data into NOSQL table.Actually it is as 12/15/2017 in NOSQL table.But sometimes it stores as 12/4/2017.When I want to get the data from the table using date,it returns empty data.Because I use date format like this dd/MM/yyyy.I don't know how to send exact date format into table and get data from the table.If anyone help me to solve this issue,it would be great.
I had same issue before a week.I used to give date format wrongly.First I gave date format as MM/dd/YYYY.Then how I solved the issue is,I tried below date formatter.Once I changed the date formatter to below format,it works fine.
M/d/yyy
In a data flow from one table to another, I would like to cast a date.
The date leaves the source table as a string in this format: "2009-01-05 00:00:00:000 + 01:00".
I tried to convert this to a date using a tConvertType, but that is not allowed apparently.
My second option is to cast this string to a date using a formula in a tMap component.
At the moment I tried these formulas:
- TalendDate.formatDate("yyyy-MM-dd",row3.rafw_dz_begi);
- TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",row3.rafw_dz_begi);
- return TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",row3.rafw_dz_begi);
None of these worked. When inserting the result into the target-table (MySQL, InnoDB) a receive the error message that the date is not valid. The format of the target field is a MySQL Date field.
How can I cast the date to the desired format?
Talend offers you a nice way of handling date formats.
You can easily change the date format in the Schema editor tab at the tMap window.
It works for both tMap input and output flows.
I've added a picture for a better illustration.
to cast this string to a date using a formula.... error message that
the date is not valid. The format of the target field is a MySQL Date
field.
What I understand from your question is, you want to insert a date into MySQL Date field.
But the method that you are using, returns the 'String' type.
TalendDate.formatDate(String pattern, Date date); //formats a date into Date/Time string
So in that case, if your field is of 'Date' type.
TalendDate.parseDate("yyyy-MM-dd", TalendDate.formatDate("yyyy-MM-dd",row3.rafw_dz_begi));