Загрузка функций и проекта "Нарушениям нет"
This commit is contained in:
22
Database/Функции/application_post.sql
Normal file
22
Database/Функции/application_post.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
CREATE OR REPLACE FUNCTION nn_db.application_post(
|
||||
in_car_number nn_db.application.car_number%TYPE
|
||||
, in_description nn_db.application.description%TYPE
|
||||
, in_fk_user nn_db.application.fk_user%TYPE)
|
||||
RETURNS TABLE(pk_application nn_db.application.pk_application%TYPE)
|
||||
AS $$
|
||||
BEGIN
|
||||
INSERT INTO nn_db.application (
|
||||
car_number
|
||||
, description
|
||||
, fk_status
|
||||
, fk_user)
|
||||
VALUES (
|
||||
in_car_number
|
||||
, in_description
|
||||
, (SELECT MIN(nn_db.status.pk_status) FROM nn_db.status)
|
||||
, in_fk_user);
|
||||
RETURN QUERY SELECT
|
||||
MAX(nn_db.application.pk_application)
|
||||
FROM nn_db.application;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
Reference in New Issue
Block a user