Re: Function calling error in postgreSQL 7.3.1 - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Function calling error in postgreSQL 7.3.1
Date
Msg-id 20030312220435.F61658-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Function calling error in postgreSQL 7.3.1  ("vincent" <waimeng@efkonasia.com.my>)
List pgsql-sql
On Thu, 13 Mar 2003, vincent wrote:

> Hi all,
>
> I'm trying to create a function that take in 2 varchar string and return a
> string.
> The function was created successfully, but when i issued the following
> command via pgadmin II,
> it give me the following error:
>
> select * from sc_company.dbseq('sc_company', 'COMPANY');
>
> ERROR: Namespace "in_schname" does not exist
>
>
> CREATE FUNCTION sc_company.dbseq(text, text) RETURNS varchar AS '
>  DECLARE
>   in_schname ALIAS FOR $1;
>   in_seqname ALIAS FOR $2;
>   retval VARCHAR := 0;
>  BEGIN
>   SELECT SEQ_VAL INTO retval FROM in_schname.DB_SEQ WHERE SEQ_NAME =
> in_seqname;

That is not going to use the argument in the FROM.  If you want to do
something like that you're probably going to need to look into using
EXECUTE.




pgsql-sql by date:

Previous
From: "vincent"
Date:
Subject: Function calling error in postgreSQL 7.3.1
Next
From: Tomasz Myrta
Date:
Subject: Re: nearest match