Ask a Question

How to read unique data in a column through JDBC request without giving conditions

SOLVED
VenkataR1
New Contributor

How to read unique data in a column through JDBC request without giving conditions

Hi Team,
I am using JDBC step for retrieving data in which we use data from a column and use it in another request.But if I use the data from first row it will not be usefull next time if I run the query. So when I run the case for the second time it should not take the data from first row. It should take from second row data.
Can anyone help me out in resolving this?

Thanks

5 REPLIES 5
richie
Community Hero

Hi @VenkataR1 

 

What's the database vendor? Oracle ? SQL Server? DB2?  there's a number of ways to answer this and some of the answers would be determined by the RDBMS vendor.

 

Can you please do a describe on the table youre querying so we can get an understanding of the columns that are contained within the table - I'm wondering if there is a primary key that can be indexed.

 

e.g. - ACC_ID(INT(11)), ACCOUNT_FIRSTNAME(VARCHAR(200)), ACCOUNT_LASTNAME(VARCHAR(200)), PHONE(INT(11))

 

Can you provide an example of the data contained within each of columns within the table?

 

e.g. ACC_ID = 12345678901, ACCOUNT_FIRSTNAME = 'Rich', ACCOUNT_LASTNAME = 'JONES', PHONE = 07958 985 111

 

There's a possibility you can resolve this depending on the data contents of the table and the proprietary RDBMS setup (ROWID, ROWNUM, etc.) that you may be able to handle this by adding a filter on the query you're executing rather than just a simple 'SELECT * FROM TABLE;' hence the reason I'm asking the above questions 

 

 

Cheers,

 

Rich

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
HimanshuTayal
Community Hero

Hi @VenkataR1 :

 

What i would suggest in this scenario are two approached:

 

1. If number of record you are fetching from DataBase are not too much than you can store these record in Properties step and use it later on in your API Request.

 

2. If you want to fetch record and then hit a service and again do the same for another set of data, then what you can do is, implement below logic:

 

     a) Fetch 1st record from DB,

     b) Hit the API with the fetched DB data,

     c) Again do the step a) & b) with next set of data.

 

Hope it will help you.

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
nmrao
Champion Level 3

Unclear question.

What is your use case?
Why no condition in the query ?


Regards,
Rao.

@richie I have got the solution for it thanks for the reponse and support

@nmrao I have got the solution thanks for the reponse and support

cancel
Showing results for 
Search instead for 
Did you mean: