Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error with creating function 1

Status
Not open for further replies.

plork123

Programmer
Mar 8, 2004
121
GB
hi all
i have a function that's created sucessully but when i try to run it it gives me this error

ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "test"


this is my function

CREATE OR REPLACE FUNCTION test(int8, varchar, varchar)
RETURNS void AS
'
declare
arg_userid ALIAS FOR $1;
arg_name ALIAS FOR $2;
arg_emailaddress ALIAS FOR $3;


begin
UPDATE table SET address = arg_emailaddress WHERE userid = arg_userid;

end;

'
LANGUAGE 'plpgsql' VOLATILE;


and when i run it i get the error

select * from test(123, '', 'email')

can anyone help me out

many thanks
 
just give it return :))

CREATE OR REPLACE FUNCTION test(int8, varchar, varchar)
RETURNS void AS
'
declare
arg_userid ALIAS FOR $1;
arg_name ALIAS FOR $2;
arg_emailaddress ALIAS FOR $3;


begin
UPDATE table SET address = arg_emailaddress WHERE userid = arg_userid;
return;
end;

'
LANGUAGE 'plpgsql' VOLATILE;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top