Skip to content

Instantly share code, notes, and snippets.

@harish2704
Created October 13, 2023 07:07
Show Gist options
  • Save harish2704/5b598ac571006f1cbbb944ba72e948d4 to your computer and use it in GitHub Desktop.
Save harish2704/5b598ac571006f1cbbb944ba72e948d4 to your computer and use it in GitHub Desktop.
pass data as query parameter while using SQL insert into ( batch mode ) statement
INSERT INTO my_table (col_a, col_b)
(SELECT col_a,
col_b
FROM json_populate_recordset(NULL::my_table, ?)
)
-- Here query parameter should be a json collection ( array of objects ) which matches with column names of my_table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment