From: | "Luis Silva" <lfs12(at)hotmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: returning from a trigger |
Date: | 2006-04-18 00:08:03 |
Message-ID: | BAY117-F32B6BEEF9DAED29ABD0DF1B5C40@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
sorry, I was doing select validate('') and I need to do select * from
validate(''). sorry
>From: "Luis Silva" <lfs12(at)hotmail(dot)com>
>To: pgsql-novice(at)postgresql(dot)org
>Subject: [NOVICE] returning from a trigger
>Date: Tue, 18 Apr 2006 00:03:33 +0000
>
>
>Hi there! I'm having a big problem. I'm creating a pl/pgsql function and I
>want my function to return one table that I've created, but that info is
>created by me:
>
>-->Table
>
>CREATE TABLE returnfunc
>(
> error bool NOT NULL,
> result text NOT NULL,
> name text
>)
>WITHOUT OIDS;
>
>-->Pl/pgsql func
>CREATE OR REPLACE FUNCTION validate(pub text)
> RETURNS returnfunc AS
>$BODY$
>DECLARE
>answer returnfunc
>val_pub text;
>asds Record;
>
>BEGIN
> val_priv:=$1;
>
> EXECUTE 'SELECT count(*) FROM public_data WHERE
>identity='||quote_literal(val_pub) INTO asds;
>
> IF asds.count=0 THEN
> answer.error='1';
> answer.result='DIAMETER_ERROR_USER_UNKNOWN';
> RETURN answer;
> END IF;
>
>RETURN NULL;
>END;
>....
>
>the problem is that this is returning " (t,DIAMETER_ERROR_USER_UNKNOWN,) "
>and I want to return this information in different columns, like when i'm
>doing a select to the returnfunc. Is that possible? is there another away
>of doing this? tks in advance
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2006-04-18 01:40:41 | Re: PostgreSQL a slow DB? |
Previous Message | Luis Silva | 2006-04-18 00:03:33 | returning from a trigger |