I came across an example of UPSERT in postgresql manual here and I implemented it such that it works perfectly when I call the function and pass the arguments select myfunction(arg1,arg2,arg3). Now my problem is that I want to run a query that will select a number of records and insert/update a table using myfunction. The issue is how to pass each result from my select statement to the function as variables. I should probably use triggers but am lost as to where to start from. I hope you guys understand me. ofcourse if there is an entirely different and better way to go about this am all ears. Help pls
Asked
Active
Viewed 122 times
0
flexxxit
- 2,178
- 4
- 37
- 63
-
1Does this help? http://stackoverflow.com/a/8702291/330315 – a_horse_with_no_name Dec 12 '13 at 15:44
-
@a_horse_with_no_name Yes it did Thanks – flexxxit Dec 29 '13 at 17:49
1 Answers
0
select myfunction(arg1,arg2,arg3)
from (
select arg1, arg2, arg3
from data_table
where something='something-other'
) as _;
Tometzky
- 20,923
- 4
- 58
- 71