Re: Error Occurred when run function. How to solve it? - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: Error Occurred when run function. How to solve it?
Date
Msg-id 173221970.1038167136@liza
Whole thread Raw
In response to Error Occurred when run function. How to solve it?  ("annachau" <annachau@hongkong.com>)
List pgsql-general
Hi,

--On Montag, 25. November 2002 01:17 +0800 annachau <annachau@hongkong.com>
wrote:

> Error Occurred when run function.  Please give me some advices.  Thanks.
>
> The function:
> -- Function: usf_annatest(varchar, varchar)
> CREATE FUNCTION usf_annatest(varchar, varchar) RETURNS varchar AS '
> DECLARE
>   curs_userdetail refcursor;
>   table_name ALIAS for $1;
>   identity ALIAS for $2;
>   query_where VARCHAR;
>
> BEGIN
>   IF table_name = "ot_customer" THEN
                     ^^^^^^^^^^^^

(as the error tells you) You have to write ''ot_customer'' note the
double single ' instead of one double ".

Regards
Tino


>       RETURN table_name;
>   ELSE
>       RETURN identity;
>   END IF;
> END;'  LANGUAGE 'plpgsql';
>
> I run it :
> SELECT usf_annatest('ot_test', 'anna');
>
> Error :
> NOTICE: Error occurred while executing PL/pgSQL function usf_annatest
> NOTICE: line 8 at if
> ERROR : Attribute 'ot_customer' not found.
>
> So, when I need to user "ot_customer" and 'ot_customer'.
>
> Thanks a lot.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Calculated fileds in pg
Next
From: Hubert depesz Lubaczewski
Date:
Subject: log analyzer - please test, and let me know what i can and should improve