Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION public.addupdateemployee(IN employeeid bigint, IN employeetitle text, IN employeeaddress text)
- RETURNS bigint
- LANGUAGE 'plpgsql'
- AS $BODY$
- BEGIN
- DECLARE affectedrecordid bigint = 0
- IF employeeid = 0 THEN
- INSERT INTO employeemaster(title, address)
- values(employeetitle, employeeaddress)
- RETURNING id INTO affectedrecordid;
- RETURN affectedrecordid;
- ELSE
- UPDATE employeemaster
- SET title = employeetitle,
- address = employeeaddress
- WHERE id = employeeid
- RETURN employeeid;
- END IF
- END
- $BODY$;
- ERROR: syntax error at or near "IF"
- LINE 8: IF employeeid = 0 THEN
- ^
- SQL state: 42601
- Character: 218
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement