September 2nd, 2012, 08:58 AM
Join Date: Sep 2012
Time spent in forums: 13 m 51 sec
Reputation Power: 0
Using Function to reduce column value
I am currently trying to use a function to reduce the value of a particular column in a view I have created.
The function is as follows:
create type holder as (name1 text, title1 text, count1 int);
create or replace function coauthorcount1() returns setof holder1 as
for r in select name, title, count
from nametitlecount LOOP
r.count1 := r.count1 - 1;
The table consists of 3 columns: Name, Title and Count.
I am trying to decrement the count values by 1 but it doesn't seem to be working when I run the function using 'select 'coauthorcount();'.
I just get an output of '(0 rows)'.
Any help would be greatly appreciated.