Forum Discussion

VenkataR1's avatar
VenkataR1
New Contributor
4 years ago
Solved

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

  • 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

     

5 Replies

  • richie's avatar
    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

     

  • 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.

     

  • nmrao's avatar
    nmrao
    Champion Level 3
    Unclear question.

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