summaryrefslogtreecommitdiffstats
path: root/db_demo/sql/funcs/cr_func_insert_person.sql
diff options
context:
space:
mode:
authorWilrik de Loose <wilrik@wilrik.nl>2008-05-27 09:50:18 (GMT)
committerWilrik de Loose <wilrik@wilrik.nl>2008-05-27 09:50:18 (GMT)
commite2b5d9764888e0f307ebcdf9c20835b197a0f63c (patch)
tree00bf9c6fbc7dae49d14ac91d44fe5e3f20d1454d /db_demo/sql/funcs/cr_func_insert_person.sql
parent9b5236ed96a79e0fe979e2d7a7bc7173170af6cf (diff)
download2iv55-e2b5d9764888e0f307ebcdf9c20835b197a0f63c.zip
2iv55-e2b5d9764888e0f307ebcdf9c20835b197a0f63c.tar.gz
2iv55-e2b5d9764888e0f307ebcdf9c20835b197a0f63c.tar.bz2
db functies
Diffstat (limited to 'db_demo/sql/funcs/cr_func_insert_person.sql')
-rw-r--r--db_demo/sql/funcs/cr_func_insert_person.sql27
1 files changed, 27 insertions, 0 deletions
diff --git a/db_demo/sql/funcs/cr_func_insert_person.sql b/db_demo/sql/funcs/cr_func_insert_person.sql
new file mode 100644
index 0000000..762bf42
--- /dev/null
+++ b/db_demo/sql/funcs/cr_func_insert_person.sql
@@ -0,0 +1,27 @@
+CREATE OR REPLACE FUNCTION insert_person (
+ boolean, -- cexperience
+ boolean, -- wexperience
+ integer -- agegroupid
+) RETURNS integer AS $$
+DECLARE
+ par_cexperience ALIAS FOR $1;
+ par_wexperience ALIAS FOR $2;
+ par_agegroupid ALIAS FOR $3;
+
+ var_personid integer;
+BEGIN
+ INSERT INTO tbl_person (
+ cexperience,
+ wexperience,
+ agegroupid
+ ) VALUES (
+ par_cexperience,
+ par_wexperience,
+ par_agegroupid
+ );
+
+ SELECT INTO var_personid seq_person.last_value;
+
+ RETURN var_personid;
+END;
+$$ LANGUAGE plpgsql; \ No newline at end of file