Re: = or := ?

From: "Zlatko Matic" <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
To: "Michael Glaesemann" <grzm(at)myrealbox(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: = or := ?
Date: 2005-05-09 16:26:08
Message-ID: 006301c554b3$cee15440$48778353@zlatkovyfkpgz6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

thanks.
----- Original Message -----
From: "Michael Glaesemann" <grzm(at)myrealbox(dot)com>
To: "Zlatko Matic" <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Monday, May 09, 2005 11:30 AM
Subject: Re: [GENERAL] = or := ?

>
>
> On May 9, 2005, at 18:00, Zlatko Matic wrote:
>
>> This is a newbie question: what is the difference between using = and
>> := in plpgsql function ?
>
> In pl/pgsql,
>
> := is assignment
> = is a logical comparison for equality
>
> Some languages, such as perl, use = for assignment and == for logical
> comparison.
>
> x = 1
> is a boolean result
>
> x := 1
> gives x the value of 1
>
> Quick example:
>
> x := 2; -- gives x the value of 2
>
> IF (x = 1) THEN -- x = 1 is false
> x := 3; -- skipped
> END IF;
> RETURN X; -- returns 2
>
> Again:
> x := 1; -- gives x the value of 1
>
> IF (x = 1) THEN -- x = 1 is true
> x := 3; -- perform assignment
> END IF;
> RETURN x; -- returns 3
>
> Hope this helps.
>
> Michael Glaesemann
> grzm myrealbox com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-05-09 16:29:08 Re: Shorthand for foreign key indices
Previous Message Ben 2005-05-09 16:25:35 Re: Postgres and GnuPlot