Вот моя хранимая процедура, я пытаюсь получить последнюю вставленную DepartmentId
. Не ищу триггера и никакого решения без MAX(DepartmentId)
CREATE PROCEDURE "BPPRA_CUSTOM_APP"."AddUpdateMaster_Department"(IN DepartmentId BIGINT,Department nvarchar(100),Description nvarchar(100),UserId int)
LANGUAGE SQLSCRIPT
--READS SQL DATA
AS
BEGIN
if DepartmentId>0
then
update "BPPRA_CUSTOM_APP"."Master_Department" set "Department"=Department,"Description"=Description ,"ModifiedUserId"=UserId,"ModifiedDate"=CURRENT_TIMESTAMP
where "DepartmentId"= :DepartmentId;
select DepartmentId FROM DUMMY;
ELSE
insert into "BPPRA_CUSTOM_APP"."Master_Department" ("Department","Description","CreatedUserId","CreatedDate")
values(Department,Description,UserId,CURRENT_TIMESTAMP);
END IF;
END;