summaryrefslogtreecommitdiff
path: root/sql/functions
diff options
context:
space:
mode:
Diffstat (limited to 'sql/functions')
-rw-r--r--sql/functions/contact.insert_contact_us_post.sql10
-rw-r--r--sql/functions/resume.insert_contactinfo.sql45
-rw-r--r--sql/functions/resume.insert_resume.sql7
3 files changed, 47 insertions, 15 deletions
diff --git a/sql/functions/contact.insert_contact_us_post.sql b/sql/functions/contact.insert_contact_us_post.sql
index 739f084..7ca4495 100644
--- a/sql/functions/contact.insert_contact_us_post.sql
+++ b/sql/functions/contact.insert_contact_us_post.sql
@@ -30,15 +30,7 @@ begin
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;
+ ) returning id into l_id;
return l_id;
end;
diff --git a/sql/functions/resume.insert_contactinfo.sql b/sql/functions/resume.insert_contactinfo.sql
new file mode 100644
index 0000000..428e69b
--- /dev/null
+++ b/sql/functions/resume.insert_contactinfo.sql
@@ -0,0 +1,45 @@
+drop function resume.insert_contactinfo (
+ p_user_id int,
+ p_state_id bigint,
+ p_visastatus_id bigint,
+ p_address character varying,
+ p_city character varying,
+ p_phone character varying,
+ p_email character varying
+);
+
+create or replace function resume.insert_contactinfo (
+ p_user_id int,
+ p_state_id bigint,
+ p_visastatus_id bigint,
+ p_address character varying,
+ p_city character varying,
+ p_phone character varying,
+ p_email character varying
+)
+returns bigint
+as $$
+declare
+ l_id bigint;
+begin
+ insert into resume.contactinfo (
+ user_id,
+ state_id,
+ visastatus_id,
+ address,
+ city,
+ phone,
+ email
+ ) values (
+ p_user_id,
+ p_state_id,
+ p_visastatus_id,
+ p_address,
+ p_city,
+ p_phone,
+ p_email
+ ) returning id into l_id;
+
+ return l_id;
+end;
+$$ language plpgsql;
diff --git a/sql/functions/resume.insert_resume.sql b/sql/functions/resume.insert_resume.sql
index eb56897..99ac786 100644
--- a/sql/functions/resume.insert_resume.sql
+++ b/sql/functions/resume.insert_resume.sql
@@ -18,12 +18,7 @@ begin
) values (
p_user_id,
p_name
- );
-
- select id into l_id
- from resume.resume
- where user_id = p_user_id
- and name = p_name;
+ ) returning id into l_id;
return l_id;
end;