pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedusing string functions on plpgsql
5+ messages / 3 participants
[nested] [flat]
* using string functions on plpgsql
@ 2008-04-16 21:50 Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Marcelo Edgardo Paniagua Lizarraga @ 2008-04-16 21:50 UTC (permalink / raw)
To: pgsql-sql
I'm starting to create my firsts plpgsql functions, and I was
wondering how to use the string function 'length' in the code of the
fuction. I have tried so far and I get an error. I'm trying this:
declare
i integer;
begin
...
i = length(texto)
...
where texto is a varchar(200) I pass as a parameter to the function calling.
Any help will help.
Thanks!!!
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using string functions on plpgsql
@ 2008-04-17 00:08 Tom Lane <tgl@sss.pgh.pa.us>
parent: Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Tom Lane @ 2008-04-17 00:08 UTC (permalink / raw)
To: Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>; +Cc: pgsql-sql
"Marcelo Edgardo Paniagua Lizarraga" <mpaniagua18@gmail.com> writes:
> I'm starting to create my firsts plpgsql functions, and I was
> wondering how to use the string function 'length' in the code of the
> fuction. I have tried so far and I get an error.
There's nothing obviously wrong with what you posted, so the problem
is somewhere in what you left out.
If you want useful help, it's generally advisable to show a complete
example of what you did and exactly what error message you got.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using string functions on plpgsql
@ 2008-04-17 01:47 Craig Ringer <craig@postnewspapers.com.au>
parent: Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>
1 sibling, 1 reply; 5+ messages in thread
From: Craig Ringer @ 2008-04-17 01:47 UTC (permalink / raw)
To: Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>; +Cc: pgsql-sql
Marcelo Edgardo Paniagua Lizarraga wrote:
> declare
> i integer;
> begin
> ...
>
> i = length(texto)
^^^
i := length(texto)
--
Craig Ringer
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using string functions on plpgsql
@ 2008-04-17 01:51 Craig Ringer <craig@postnewspapers.com.au>
parent: Craig Ringer <craig@postnewspapers.com.au>
0 siblings, 1 reply; 5+ messages in thread
From: Craig Ringer @ 2008-04-17 01:51 UTC (permalink / raw)
To: Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>; +Cc: pgsql-sql
Craig Ringer wrote:
> Marcelo Edgardo Paniagua Lizarraga wrote:
>
>> declare
>> i integer;
>> begin
>> ...
>>
>> i = length(texto)
> ^^^
>
> i := length(texto)
Whoops, I spoke too soon - it seems both are valid for assignment. Has
that always been true?
The one time I don't write a small test before posting....
--
Craig Ringer
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using string functions on plpgsql
@ 2008-04-17 04:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: Craig Ringer <craig@postnewspapers.com.au>
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2008-04-17 04:42 UTC (permalink / raw)
To: Craig Ringer <craig@postnewspapers.com.au>; +Cc: Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>; pgsql-sql
Craig Ringer <craig@postnewspapers.com.au> writes:
> i = length(texto)
>> ^^^
>>
>> i := length(texto)
> Whoops, I spoke too soon - it seems both are valid for assignment. Has
> that always been true?
Yeah, it's not documented, but AFAIK plpgsql has always taken both.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2008-04-17 04:42 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-16 21:50 using string functions on plpgsql Marcelo Edgardo Paniagua Lizarraga <mpaniagua18@gmail.com>
2008-04-17 00:08 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-04-17 01:47 ` Craig Ringer <craig@postnewspapers.com.au>
2008-04-17 01:51 ` Craig Ringer <craig@postnewspapers.com.au>
2008-04-17 04:42 ` Tom Lane <tgl@sss.pgh.pa.us>
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