X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6E01D5E46E1 for ; Thu, 26 Aug 2004 11:59:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86706-05 for ; Thu, 26 Aug 2004 14:58:59 +0000 (GMT) Received: from mail1.virtual-email.net (Mail2.virtual-email.net [213.228.203.184]) by svr1.postgresql.org (Postfix) with ESMTP id A3C315E46F9 for ; Thu, 26 Aug 2004 11:58:54 -0300 (ADT) Received: from mail2.virtual-email.net ([213.228.203.173] RDNS failed) by mail1.virtual-email.net with Microsoft SMTPSVC(6.0.3790.0); Thu, 26 Aug 2004 15:58:56 +0100 Received: from mail4.virtual-email.net ([213.228.203.171]) by mail2.virtual-email.net with Microsoft SMTPSVC(6.0.3790.0); Thu, 26 Aug 2004 15:58:57 +0100 thread-index: AcSLfTY0GMixR0EyRRi3IycBFsNdJw== Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.132 Received: from albourne.com ([213.207.142.99]) by mail4.virtual-email.net with Microsoft SMTPSVC(6.0.3790.0); Thu, 26 Aug 2004 15:58:56 +0100 Message-ID: <412DFABE.3090008@albourne.com> Date: Thu, 26 Aug 2004 17:59:10 +0300 From: "Antonis Antoniou" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Patrice OLIVER" Cc: Subject: Re: Problem with stored procedure References: <412DE07D.1060800@free.fr> In-Reply-To: <412DE07D.1060800@free.fr> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Aug 2004 14:58:56.0869 (UTC) FILETIME=[36239150:01C48B7D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/291 X-Sequence-Number: 18788 Patrice OLIVER wrote: > Hello, > > In this example, I use 2 tables : > create table types ( > typnum integer primary key, > catcode varchar(2), > typlib varchar(35)); > > create table uv ( > uvnum varchar(5) primary key, > typnum integer, > uvlib varchar(50)); > > alter table uv > add constraint fk_uv_type foreign key (typnum) > references types (typnum) > on delete restrict on update restrict; > > I also use stored procedures : > > create function numtype(varchar) returns integer as ' > declare > codetype alias for $1; > coderet integer; > begin > select into coderet typnum from types > where typcode = codetype and catcode = ''UV''; why not -> select *typenum* into coderet from types where typcode = codetype and catcode = ''UV'';