0

This update query is part of my function

update  tax_table it
    set updated_by   =  1,
        updated_on   =  now(),
        customer_id  =  gs.colum,
        site_id      =  t.colum
    from    table1 ri
        inner join table2 t on t.colum = ri.colum 
        inner join table3 gs on ri.colum = gs.colum 
        inner join table4 vg on vg.colum = ri.colum     
    where   ri.table1 = _id ;

I want to store updated site_id into a integer array variable in my function

1 Answer 1

2

smth like shoud do:

with u as (
update  tax_table it
    set updated_by   =  1,
        updated_on   =  now(),
        customer_id  =  gs.colum,
        site_id      =  t.colum
    from    table1 ri
        inner join table2 t on t.colum = ri.colum 
        inner join table3 gs on ri.colum = gs.colum 
        inner join table4 vg on vg.colum = ri.colum     
    where   ri.table1 = _id 
    returning site_id 
)
select array_agg(site_id) from u into YOUR_VAR;
Sign up to request clarification or add additional context in comments.

1 Comment

Its Worked !! :) Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.