Home > Enterprise >  Pass table as argument to postgreSQL function?
Pass table as argument to postgreSQL function?

Time:01-09

is it possible to pass table/list/json as argument to postgreSQL function from .net core API? The requirement is like for an invoice, there are multiple line items. so we want to save invoice first and then it's respective multiple line items. for line items, we have to either call postgreSQL function one by one and insert line item to DB. so just checking if SQL bulk inset like functionality is available in PostgreSQL.

CREATE FUNCTION test(table sometable) 
RETURNS TABLE(id bigint, vendor_id bigint) 
BEGIN
 -- bulk or single insert multiple records from argument table into postgreSQL table
END;

Thanks,

CodePudding user response:

So, I came to know that json can be passed to postgresql function and there are plenty of functionality is available to extract value from json in postgresql function makes life easy.

  • Related