Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[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 
Labels (2)
28 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

Double quotes must be placed before and end of each string...
Anonymous
Not applicable
Author

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()+"\""+")"
Anonymous
Not applicable
Author

Oh... sorry... for oracle you need single quote and not double quote.. +"'"+ around the string..
Vaibhav
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

Thanks a lot vaibhav for your help appreciated it works finally 
Thanks Laurent for your reply, I will try it 
Anonymous
Not applicable
Author

0683p000009MEfs.jpg for making it work...
Vaibhav
Anonymous
Not applicable
Author

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 
Anonymous
Not applicable
Author

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!