Question

I am inserting the array of elements {idno,age,salary} as {1,10000,30} in PostgreSQL database and I need to split and store into the respected columns of the table.

How to store the split array elements in respect columns of table?

First is this possible , if possible can some one explain me ,how can we do it?

Was it helpful?

Solution

Like this?

insert into test(idno, age, salary)
select D[1], D[2], D[3]
from (select '{1,10000,30}'::int[]) as A(D);

sql fiddle demo

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top