Lists: | pgsql-general |
---|
From: | "Craig Bryden" <brydencraig(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | MS-SQL to PostgreSQL |
Date: | 2005-01-07 20:00:47 |
Message-ID: | BAY12-F334DF13317BC1C781212F6B7940@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hi
Below is a snippet of MS-SQL code. Please can someone translate this to
plpgsql for me.
**************************************************************
DECLARE @MaxVal int, @MinVal int
SELECT @MaxVal = MAX(Value), @MinVal = MIN(Value)
FROM ABC
**************************************************************
The variables would then be used for purther processing.
I know that the variables would be declared like
*******************************************
DECLARE
MaxVal int;
MinVal int;
BEGIN
???
END;
*******************************************
I am not sure of the query part and in particular the assignment of the
values to the variables
Thank you
Craig
_________________________________________________________________
Research SA schools and varsities on MSN Search. http://search.msn.co.za
From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Craig Bryden <brydencraig(at)hotmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: MS-SQL to PostgreSQL |
Date: | 2005-01-07 20:37:51 |
Message-ID: | 20050107203751.GA91278@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Fri, Jan 07, 2005 at 10:00:47PM +0200, Craig Bryden wrote:
> I am not sure of the query part and in particular the assignment of the
> values to the variables
See SELECT INTO in the PL/pgSQL documentation.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From: | "Alam Surya" <alam_surya(at)highpointoffice(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: MS-SQL to PostgreSQL |
Date: | 2005-01-08 01:53:52 |
Message-ID: | 001401c4f524$e8ea1820$aa01a8c0@edp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hi Craig....
try with this....
Declare v_maxval integer; v_minval integer;
Begin
Select max(value),min(value) into v_maxval,v_minval from ABC;
............
............
............
end;
or see SELECT INTO from postgresql documentation
regards,
Alam Surya
----- Original Message -----
From: "Craig Bryden" <brydencraig(at)hotmail(dot)com>
Subject: [GENERAL] MS-SQL to PostgreSQL
> Hi
>
> Below is a snippet of MS-SQL code. Please can someone translate this to
> plpgsql for me.
>
> **************************************************************
> DECLARE @MaxVal int, @MinVal int
>
> SELECT @MaxVal = MAX(Value), @MinVal = MIN(Value)
> FROM ABC
> **************************************************************
>
> The variables would then be used for purther processing.
> I know that the variables would be declared like
>
> *******************************************
> DECLARE
> MaxVal int;
> MinVal int;
> BEGIN
> ???
> END;
> *******************************************
>
> I am not sure of the query part and in particular the assignment of the
> values to the variables
>
> Thank you
> Craig