Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION rankFunction(workerid_temp INTEGER) RETURNS INTEGER AS'
- DECLARE
- rank integer;
- x integer;
- y integer;
- Begin
- while workerid_temp != NULL
- x = chefid of current workerid_temp
- y = assume x as workerid_temp
- rank = (get new chefid with y(as workerid_temp))
- if x == NULL
- rank = 0
- else
- rank = rank + 1
- return rank;
- END;
- ' LANGUAGE plpgsql;
- SELECT workerid, name, rankFunction(workerid)
- FROM workers;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement