Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- НЕ ДОБАВЛЯЙТЕ ЭТИ ФУНКЦИИ В БАЗУ !!!!
CREATE OR REPLACE FUNCTION public.discipline_find(pstudyplanid integer, psemesterid integer, psubjectid integer, pexamtype exam_credit_grading_credit)
RETURNS SETOF integer
LANGUAGE sql
AS $function$
--select public.discipline_find(
-- :pstudyplanid, -- put the pstudyplanid parameter value instead of 'pstudyplanid' (int4)
-- :psemesterid, -- put the psemesterid parameter value instead of 'psemesterid' (int4)
-- :psubjectid, -- put the psubjectid parameter value instead of 'psubjectid' (int4)
-- :pexamtype -- put the pexamtype parameter value instead of 'pexamtype' (exam_credit_grading_credit)
--);
SELECT disciplines.ID
FROM disciplines
INNER JOIN disciplines_study_plans ON disciplines.ID = disciplines_study_plans.DisciplineID
WHERE disciplines_study_plans.StudyPlanID = pStudyPlanID AND
disciplines.SemesterID = pSemesterID AND
disciplines.SubjectID = pSubjectID AND
(disciplines.ExamType = pExamType or
(disciplines.ExamType = 'credit' and pExamType = 'grading_credit'));
$function$;
-- НЕ ДОБАВЛЯЙТЕ ЭТИ ФУНКЦИИ В БАЗУ !!!!
CREATE OR REPLACE FUNCTION public.discipline_settypeunsafe(pdisciplineid integer, ptype exam_credit_grading_credit)
RETURNS integer
LANGUAGE plpgsql
AS $function$
declare vRow int;
begin
UPDATE disciplines
SET examtype = ptype
WHERE ID = pDisciplineID ;
get diagnostics vRow = ROW_COUNT;
RETURN vRow-1;
EXCEPTION
when others then RETURN -1;
END
$function$
;