Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AB35447613E for ; Tue, 13 Aug 2002 03:01:56 -0400 (EDT) Received: from issv0170.isis.de (issv0170.isis.de [195.158.131.222]) by postgresql.org (Postfix) with SMTP id 18186476299 for ; Tue, 13 Aug 2002 03:01:36 -0400 (EDT) Received: (qmail 28043 invoked by uid 1010); 13 Aug 2002 07:01:30 -0000 Received: from unknown (HELO janning.planwerk6.local) ([195.158.156.17]) (envelope-sender ) by mail.isis.de (qmail-ldap-1.03) with SMTP for ; 13 Aug 2002 07:01:30 -0000 Received: from there (localhost [127.0.0.1]) by janning.planwerk6.local (8.11.6/8.11.6/SuSE Linux 0.5) with SMTP id g7D71UF20185; Tue, 13 Aug 2002 09:01:30 +0200 Message-Id: <200208130701.g7D71UF20185@janning.planwerk6.local> Content-Type: text/plain; charset="iso-8859-1" From: Janning Vygen Organization: Planwerk 6 /websolutions To: "Sugandha Shah" , Subject: Re: Function error Date: Tue, 13 Aug 2002 09:01:30 +0200 X-Mailer: KMail [version 1.3.1] References: <002a01c2428f$96de9000$2005a8c0@cybage.com> In-Reply-To: <002a01c2428f$96de9000$2005a8c0@cybage.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/197 X-Sequence-Number: 9043 Am Dienstag, 13. August 2002 08:06 schrieb Sugandha Shah: > Hi , > > I'm porting MS- SQL stored procedure to postgres . I'm getting this > error : > > Error occurred while executing PL/pgSQL function > sel_free_disk_space line 7 at SQL statement > SELECT query has no destination for result data. > If you want to discard the results, use PERFORM instead. you need to SELECT INTO if you want to set a varaible in plpgsql try this: DECLARE var_free integer; -- var_free is used just to name it differently from the column name BEGIN SELECT INTO var_free free from logical_drive where computer_id = $1 and letter = upper($2); IF var_free THEN ... Janning > CREATE FUNCTION sel_free_disk_space(int4,bpchar) RETURNS integer > AS ' DECLARE > -- Declare variable to store the free space. > free INTEGER; > > BEGIN > select free from logical_drive where computer_id = $1 and > letter = upper($2); > IF free IS NULL THEN > RETURN -1; > END IF; > > RETURN free; > END; > 'LANGUAGE 'plpgsql'; > > > I'm not able to understand what I'm missing ? > > Secondly is there any equivalent of exec for postgres ? > > Any help will be highly appreciated. > > Regards, > -Sugandha -- Planwerk 6 /websolutions Herzogstraße 86 40215 Düsseldorf fon 0211-6015919 fax 0211-6015917 http://www.planwerk6.de