return new id of inserted row of 2 tables
# sql
o
return new id of inserted row of 2 tables
I'd like to return the id of the newly iserted row of the booking table. Here's my function:
Copy code
sql
begin
  INSERT INTO public.payment(user_id, therapy_session_id)
  VALUES (userid, sessionid);
  
  INSERT INTO public.booking(user_id, therapy_session_id)
    VALUES (userid, sessionid);
    RETURN id; --How do i retuen the ID here?
end;