Re: Function's final statement must be a SELECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Premil Agarwal escribió:
> I am trying to write a function in PgAdmin 1.8.2 for postgres 8.3. The
> function should check the input parameter for NULL. If its NULL then
> function should return 'Auto' otherwise return the input as such.

> 
> CREATE FUNCTION check_for_null( inp character varying) RETURNS character
> varying AS $$
[...]
> $$ LANGUAGE SQL;

              ^^^

There's your problem.  Try using PLPGSQL instead.

In any case, you can do this with COALESCE() and it's much easier.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux