2021年3月13日星期六

How to call postgresql function that returns TABLE type from Java code?

I have a postgresql function with this signature...

create function getProductsPerCodes(p_c_prodcodes VARCHAR(1000)) RETURNS table (prodcode VARCHAR(1000), prodname VARCHAR(1000), prodline VARCHAR(1000), prodvendor VARCHAR(1000), quantity_in_stock int) AS ...

The function returns TABLE type.

From SQL client, I can call this function like this: select getProductsPerCodes('''c1'',''c4'',') rec

It prints the records fine.

Now, how do I call this function from Java code and access the data returned by the function? I need to access the table records and the all the fields that constitute the table record.

https://stackoverflow.com/questions/66620981/how-to-call-postgresql-function-that-returns-table-type-from-java-code March 14, 2021 at 12:04PM

没有评论:

发表评论