For the following function, I get an error:
ERROR: query has no destination for result data
CONTEXT: PL/pgSQL function "registration" line 19 at SQL statement
The error refers to the insert statement (when I comment it out the error goes away) and I have no idea what it is trying to tell me.
Can someone help? Thanks.
CREATE OR REPLACE FUNCTION registration( wr text ) RETURNS integer AS $rL$
DECLARE
eml text;
pwd text;
emid integer;
rowt Email%ROWTYPE;
BEGIN
eml := getWebVarValue( wr , 'email' );
select * into rowt from Email where email_email = eml;
if rowt IS NOT NULL THEN
RAISE EXCEPTION 'email address, %, already registered.' , eml;
END IF;
pwd := getWebVarValue( wr , 'password' );
if pwd is null then
RAISE EXCEPTION 'No password specified in registration.';
END IF;
INSERT INTO Email VALUES (eml,pwd) RETURNING Email.email_id as emid;
RETURN emid;
END;
$rL$ LANGUAGE plpgsql;
Email.email_id is declared as:
email_id integer DEFAULT nextval('email_email_id_seq'::regclass) NOT NULL,