Re: Error Occurred when run function. How to solve it?

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: annachau <annachau(at)hongkong(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Error Occurred when run function. How to solve it?
Date: 2002-11-24 18:45:36
Message-ID: 173221970.1038167136@liza
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

--On Montag, 25. November 2002 01:17 +0800 annachau <annachau(at)hongkong(dot)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(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hubert depesz Lubaczewski 2002-11-24 19:02:30 log analyzer - please test, and let me know what i can and should improve
Previous Message javaholic 2002-11-24 18:16:49 How does postgres handle non literal string values