开发者

What is wrong with the below PostgreSql insert function.. throwing error

I have written a function in PostgreSQL which accepts two parameters viz varchar and int . The ai开发者_运维问答m is to insert record

CREATE OR REPLACE FUNCTION fnInsert(varchar,int) RETURNS void AS   
'BEGIN
        Insert Into testtable(col1,col2) values ($1,$2)
RETURN;
END;'
LANGUAGE plpgsql;

But while trying to compile it is throwing error

ERROR:  syntax error at or near "RETURN"
LINE 4: RETURN;
        ^

********** Error **********

ERROR: syntax error at or near "RETURN"
SQL state: 42601
Character: 173

If I take out the RETURN statement, I am getting the below error

ERROR:  syntax error at or near "END"
LINE 4: END;'
        ^

********** Error **********

ERROR: syntax error at or near "END"
SQL state: 42601
Character: 173

Please help me in identifying what is wrong here?

Thanks


It's probably complaining about the lack of semicolon after

Insert Into testtable(col1,col2) values ($1,$2)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜