pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: shreedhar <shreedhar@lucidindia.net>
To: pgsql <pgsql-admin@postgresql.org>
Subject: Doubt in Plpgsql
Date: Mon, 27 May 2002 12:20:30 +0530
Message-ID: <001501c2054a$cc98f410$1201a8c0@a4005> (raw)

Hi all, 
    I am sorry for putting this question in this list. Hope some body may know 'plpgsql' in postgres.
    As I am practicing plpgsql I wrote the following code which is not retrieving data.

declare
 temprec record;
 funcs text;
 funcid integer;

begin
 funcs := 'success';

 for temprec in select * from tbldefaultaccounts loop
 -- if record belongs to project function
  if temprec.isfunction = 't' then
   funcid := 1;
   select functionid into funcid from tblFunctionHierarchy where HierarchyName = temprec.fname;
   funcs := funcs || ', ' ||  funcid ;

  end if;
 end loop;

 return funcs;
 
end;

Can any body say what is problem with this code. I hope it might have problem after where condition.

where tbldefaultaccounts is 
            daccid serial;
            fname varchar(50);

and tblFunctionHierarchy is
        functionid serial;
        name varchar(50);

Message-ID: <001501c2054a$cc98f410$1201a8c0@a4005>
Permalink:  ../001501c2054a$cc98f410$1201a8c0@a4005/
Also on:    postgresql.org/message-id/001501c2054a$cc98f410$1201a8c0@a4005

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: shreedhar@lucidindia.net
  Subject: Re: Doubt in Plpgsql
  In-Reply-To: <001501c2054a$cc98f410$1201a8c0@a4005>
  References: <001501c2054a$cc98f410$1201a8c0@a4005>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox