diff options
| author | ckonstanski <carlos.konstanski@olo.com> | 2024-05-25 18:03:25 -0600 |
|---|---|---|
| committer | ckonstanski <carlos.konstanski@olo.com> | 2024-05-25 18:03:25 -0600 |
| commit | b8423f4d05c75094b7b9d09c6f0bb353acc9be1c (patch) | |
| tree | 3732f71f84191b26f038130c2220fb502d738251 /sql/functions/contact.insert_contact_us_post.sql | |
initial commit
Diffstat (limited to 'sql/functions/contact.insert_contact_us_post.sql')
| -rw-r--r-- | sql/functions/contact.insert_contact_us_post.sql | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/sql/functions/contact.insert_contact_us_post.sql b/sql/functions/contact.insert_contact_us_post.sql new file mode 100644 index 0000000..739f084 --- /dev/null +++ b/sql/functions/contact.insert_contact_us_post.sql @@ -0,0 +1,45 @@ +drop function contact.insert_contact_us_post ( + p_first_name character varying, + p_last_name character varying, + p_email character varying, + p_phone character varying, + p_comments text +); + +create or replace function contact.insert_contact_us_post ( + p_first_name character varying, + p_last_name character varying, + p_email character varying, + p_phone character varying, + p_comments text +) +returns bigint +as $$ +declare + l_id bigint; +begin + insert into contact.contact_us_posts ( + first_name, + last_name, + email, + phone, + comments + ) values ( + p_first_name, + p_last_name, + p_email, + p_phone, + p_comments + ); + + select id into l_id + from contact.contact_us_posts + where first_name = p_first_name + and last_name = p_last_name + and email = p_email + and phone = p_phone + and comments = p_comments; + + return l_id; +end; +$$ language plpgsql; |
