From: Gabriel Dovalo Carril <dovalo@terra.es>
To: Jeff Eckermann <jeff_eckermann@yahoo.com>
Cc: Lista SQL de postgres <pgsql-sql@postgresql.org>
Subject: Re: Functions with dynamic queries
Date: Fri, 24 May 2002 01:37:13 +0200
Message-ID: <3CED7D29.7E55D278@terra.es> (raw)
References: <20020523224320.56005.qmail@web20809.mail.yahoo.com>
Jeff Eckermann escribió:
>
> Reminder to self: cast to text _before_
> concatenating(!)
> I won't retype the code, but I hope you get the
> idea...
Yes, I have tried this:
Create Function calc_stocks(text) Returns text AS '
Declare
codart ALIAS For $1;
all_stocks record;
stock text;
Begin
Select sum(stocks.stkreal) as stock1,
sum(stocks.stkpteser) as stock2
into all_stocks
From stocks, prendas
Where prendas.codprenda = stocks.codprenda and
prendas.codarticulo = codart;
stock := (all_stocks.stock1::text ||
all_stocks.stock2::text);
Return stock;
End;
' language 'plpgsql';
But now I have got neither error nor
result.
gesyweb=# select calc_stocks('020220064');
calc_stocks
-------------
(1
row)
--
Gabriel D.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dovalo@terra.es, jeff_eckermann@yahoo.com
Subject: Re: Functions with dynamic queries
In-Reply-To: <3CED7D29.7E55D278@terra.es>
* 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