Thread: Novice trouble with plpgsql

Novice trouble with plpgsql

From
Alexander Stetsenko
Date:
Hello All
Help me please !
I need to select max value in plpgsql, but 
such code seems is not corect:select into var max(col) from table ;
How can I do this ?

Thanks you all.


Re: Novice trouble with plpgsql

From
Patrik Kudo
Date:
try:

select max(name_of_column) from name_of_table;

Regards,
Patrik Kudo

Alexander Stetsenko wrote:
> 
> Hello All
> Help me please !
> I need to select max value in plpgsql, but
> such code seems is not corect:
>         select into var max(col) from table ;
> How can I do this ?
> 
> Thanks you all.


Re: Novice trouble with plpgsql

From
wieck@debis.com (Jan Wieck)
Date:
> try:
>
> select max(name_of_column) from name_of_table;
>
> Regards,
> Patrik Kudo
   He said PL/pgSQL!
   Try
       var := max(col) from table;
   instead. Looks a little odd, but should work.

>
> Alexander Stetsenko wrote:
> >
> > Hello All
> > Help me please !
> > I need to select max value in plpgsql, but
> > such code seems is not corect:
> >         select into var max(col) from table ;
> > How can I do this ?
> >
> > Thanks you all.
>
>


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #




Re: Novice trouble with plpgsql

From
Alexander Stetsenko
Date:
Thank you all.
Trouble was in column name - "day" :-))))))
Sorry for my stupid question.
Bye