[resolved] using toracle row for insert into oracle table
Hi, my job is like : tfileList-->tfileinputdelimite-->tmap-->toracleoutput--->onComponentOK-->toraclerow i want use toaclerow to insert information into a oracle table : this is my query : "INSERT INTO KPI.HTTP_TRACE(NOM, NBRE_LIGNES_FICHIER , NBRE_LIGNES_TABLE , NBRE_LIGNES_INSER , NBRE_LIGNES_REJET, ENTER_DATE) values ('" + ((String)globalMap.get("tFileList_1_CURRENT_FILE")) +"',"+ ((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE")) +"',"+ ((Integer)globalMap.get("tOracleOutput_1_NB_LINE"))+"',"+ ((Integer)globalMap.get("tOracleOutput_1_NB_LINE_INSERTED"))+"',"+ ((Integer)globalMap.get("tOracleOutput_1_NB_LINE_REJECTED"))+"',"+ TalendDate.getCurrentDate()+ ")" when i execute i have error that missing comma, and also i have an id primary key in my table so how can i insert the value of this primary key Thanks for your help
or
You can think of removing the tdbrow component and replace it by the tfixedflow-->tdboutput component and use respective columns and their values for insert.
this is much simpler than performing with tdbrow
Vaibhav
I have this error : ORA-00972: identifier is too long ORA-00972: identifier is too long and my query : "INSERT INTO KPI.HTTP_TRACE(NOM, NBRE_LIGNES_FICHIER , NBRE_LIGNES_TABLE , NBRE_LIGNES_INSER , ENTER_DATE) values (" +"\""+ ((String)globalMap.get("tFileList_1_CURRENT_FILE")) +"\"" +","+ ((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE")) +","+ ((Integer)globalMap.get("tOracleOutput_1_NB_LINE"))+","+ ((Integer)globalMap.get("tOracleOutput_1_NB_LINE_REJECTED"))+","+"\""+ TalendDate.getCurrentDate()+"\""+")"
hi all,
keep it simple & use tFixedFlowInput to fix your values from globalMap in column and a main flow to wtire in DB.
it will be more easy for debug & 'maintenance'.
regards
laurent
Hi Sanvaibhav
for the date when i use : TalendDate.getCurrentDate();
I get the date in this format : Sat Aug 23 00:34:44 PDT 2014
but i would have in this format 23/08/2014 00:34:44
how can i do this ??
Thanks for help i try with parseDate but it does'nt work
Hi Fetyna,
please understand the Java type Date! The method TalendDate.getCurrentDate() returns the Java object (a binary representation) of a Date. Here is no textual presentation, therefore there is no pattern needed. It like the database type DATE from Oracle, here is also no pattern needed to be applied.
A pattern is only necessary if you read a Date object and wants it printed in the console or a file or if you read text from a file and need to convert it into a real Date object. Ofter unexperienced developers see the date value in a SQL editor and think the date field it self must have any kind of pattern but this is not the case, the program showing the date value have to have its own pattern how the date value should be shown to the user.
Because of the method TalendDate.getCurrentDate() returns already a Date object the method TalendDate.parseDate does not make sense because this method expects a String (textual representation of a date) and returns the Java object Date -> what you already have as the result of
TalendDate.getCurrentDate() !!!
In the database a date is also stored in an internal binary format WITHOUT pattern of course!
I strongly suggest you invest some time and learn Java an some basic skills about databases like Oracle. It will make your life as developer much easier!