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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to retrieve the row count from a table?

Hi all,
I need to retrieve the row count of a table. How can I do this? 
For this I should execute a select query to the database (Oracle in my case).
Can I use the tOracleRow component to get this done? If so, please advice me.
Thanks,
thivanka.
Labels (2)
18 Replies
Anonymous
Not applicable
Author

Hi,
Do you want to capture no. of insert, update, and delete for a table? If so, you can add a tFlowMeter component between input component and output component, and then using tFlow MeterCatcher to catch the no of records.
 
For example:
tFileInput--->tFlowMeter--->tMysqlOutput_1
tFlowMeterCatcher---tLogRow
There is one column called count on the schema of tFlowMeterCatcher which counts the no. of records pass by the specify flow.
Let me know if it is OK with you.
 
Or you want to count the number of rows are inserted/updated/deleted? Global variable, such as:
((Integer)globalMap.get("tOracleOutput_1_NB_LINE_INSERTED"))?
 
Best regards
Sabrina
 
 
 
 
 
 
Anonymous
Not applicable
Author

Hi Sabrina,
Thanks for your quick reply. But, what I need is not the things you mentioned. For example, say that a table
contains 1548 records. I need to get the number of rows in the table to an integer variable or something. So the
value I want is 1548.
Thanks,
thivanka.
Anonymous
Not applicable
Author

Hi,
For example, say that a table
contains 1548 records. I need to get the number of rows in the table to an integer variable or something. So the
value I want is 1548.

Do you mean you want to use SQL COUNT() function in talend DB component?
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi Sabrina,
Yeah, I need to use the SQL COUNT().
Anonymous
Not applicable
Author

Hi Sabrina,
Is there any solution for this?
Thanks,
thivanka.
willm1
Creator
Creator

I suppose the crude solution to your problem would be to use a tOracleInput with a select count that you iteratetoflow and use in your job... Not very cool, but would work.
Anonymous
Not applicable
Author

Yes, but I was thinking whether we can use a tOralcleRow and execute the SQL COUNT() command in it and retrieve the value from it.
Since the tOracleRow returns a ResultSet, I dont know how to get the count from it. 
Anonymous
Not applicable
Author

Hi,
Sorry for delay.
tXXXRow component is usually used to any type of sql statement excepts select statement,  we use txxxInput component to execute a select statement, if you use use tXXXRow to execute a select statement, it returns a record set, and you are required to use a tParseRecordSet component after tXXXRow to parse the record sets.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi Sabrina,
Thanks for the reply. I will try to do this as you suggested.
Thanks,
thivanka.