problem with returning values from pl/pgsql

From: "Luis Silva" <lfs12(at)hotmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: problem with returning values from pl/pgsql
Date: 2006-01-27 17:49:50
Message-ID: BAY18-F9D38D16E550BAF1CB2DE0B5140@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


I there!! I'm using pl/pgsql in my application, but I'm having a problem
with the returning value. What my function does is quering the db and
according to the result of the different queries returns a error message or
some information from the db. I'm inserting the correct information in a
record variable, but I cant insert text in a variable like this,the error
message created by me. Is it possible, or is there another returning type
that I can use??

DECLARE
val_pub text;
asds Record;

BEGIN
RAISE NOTICE 'validate_user()';
val_pub:=$1;

EXECUTE 'SELECT count(*) FROM public_identif WHERE
identity='||quote_literal(val_pub) INTO asds;

IF asds.count=0 THEN
RETURN 'DIAMETER_ERROR_USER_UNKNOWN';
END IF;

EXECUTE 'SELECT name FROM public_identif WHERE
identity='||quote_literal(val_pub) INTO asds;

RETURN name; -----array of text!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

RETURN NULL;
END;

tks a lot in advance

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jaime Casanova 2006-01-27 20:01:15 Re: Problema con postgresql 8.1.2
Previous Message Dhivya 2006-01-27 10:17:38 Restoring SQL Databse for use in PostgreSQL.