Skip to Content
0

JDBC Lookup Returns Multiple Rows

Jun 27, 2017 at 11:37 PM

51

avatar image
Former Member

Hi Experts

I have a scenario where I have to lookup the "company name" for a user from a JDBC table. A user may have multiple companies associated. There is another column "Last Updated Date" so I need to pick the company with the latest LastUpdatedDate.

The table looks like

User CompanyName LastUpdateDate

A CompanyA Date1

A CompanyB Date2

B CompanyC Date1

D CompanyB Date3

So while looking up is it possible to send a query something like "order by

LastUpdatedDate" and then pick the first record?

Or

Would have to write a udf to fetch all the records?

Or

can it be done without a udf?

Kindly assist.

Regards

Sonal

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Muniyappan Marasamy Jun 28, 2017 at 01:16 PM
0

first try if this can be achieved by select query from sender channel itself. you can do the filtering in UDF but it is not required if the channel sql works out.

https://stackoverflow.com/questions/189213/sql-selecting-rows-by-most-recent-date

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Muniyappan

Thanks for your response. Do we not need to create a receiver channel for JDBC look ups?

Regards

Sonal

0

Receiver channel is required doing JDBC lookup. you have to construct the message type as per sql_query

https://help.sap.com/saphelp_nw73/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

https://help.sap.com/saphelp_nw73/helpdata/en/44/7b7855fde93673e10000000a114a6b/content.htm

you can use select statement also to fetch records.Please check.

https://help.sap.com/saphelp_nw73/helpdata/en/44/7b7171fde93673e10000000a114a6b/content.htm

I thought you are fetching records from sender side. That is why i told to configure the sql query in sender channel. I misunderstood. Please ignore sender channel part.

0