PR INS REGISTRY — различия между версиями

Материал из wiki.standart-n.ru
Перейти к: навигация, поиск
(Новая страница: «SET TERM ^ ; create or alter procedure PR_INS_REGISTRY ( DOCTOR_ID DM_UUID_NULL) as declare variable TEMP_DATE DM_DATETIME; declare variable FIRST_DATE DM_DA…»)
 
Строка 1: Строка 1:
SET TERM ^ ;
+
  SET TERM ^ ;
  
create or alter procedure PR_INS_REGISTRY (
+
  create or alter procedure PR_INS_REGISTRY (
    DOCTOR_ID DM_UUID_NULL)
+
      DOCTOR_ID DM_UUID_NULL)
as
+
  as
declare variable TEMP_DATE DM_DATETIME;
+
  declare variable TEMP_DATE DM_DATETIME;
declare variable FIRST_DATE DM_DATETIME;
+
  declare variable FIRST_DATE DM_DATETIME;
declare variable RES_DATE DM_DATETIME;
+
  declare variable RES_DATE DM_DATETIME;
begin
+
temp_date='01.01.2017 08:00:00';
+
first_date='01.01.2017 08:00:00';
+
  while (temp_date<'01.01.2018 00:00:00')
+
  do
+
  begin
+
  res_date=temp_date;
+
  if ((select first 1 r.d$uuid from registry r where r.doctor_id=:doctor_id and
+
    r.status>-1 and r.reg_date=:res_date) is null) then
+
    INSERT INTO REGISTRY (DOCTOR_ID, STATUS, REG_DATE)
+
    VALUES (:doctor_id,0,:res_date);
+
  temp_date=dateadd(minute,30,temp_date);
+
  if (extract(hour from temp_date)=22 and extract(minute from temp_date)=00) then
+
 
   begin
 
   begin
     temp_date=first_date+1;
+
  temp_date='01.01.2017 08:00:00';
    first_date=temp_date;
+
  first_date='01.01.2017 08:00:00';
  end
+
     while (temp_date<'01.01.2018 00:00:00')
  --suspend;
+
    do
  end
+
    begin
end^
+
      res_date=temp_date;
 
+
      if ((select first 1 r.d$uuid from registry r where r.doctor_id=:doctor_id and
SET TERM ; ^
+
      r.status>-1 and r.reg_date=:res_date) is null) then
 
+
        INSERT INTO REGISTRY (DOCTOR_ID, STATUS, REG_DATE)
/* Following GRANT statetements are generated automatically */
+
        VALUES (:doctor_id,0,:res_date);
 
+
      temp_date=dateadd(minute,30,temp_date);
GRANT SELECT,INSERT ON REGISTRY TO PROCEDURE PR_INS_REGISTRY;
+
      if (extract(hour from temp_date)=22 and extract(minute from temp_date)=00) then
 
+
      begin
/* Existing privileges on this procedure */
+
        temp_date=first_date+1;
 
+
        first_date=temp_date;
GRANT EXECUTE ON PROCEDURE PR_INS_REGISTRY TO PROCEDURE TEMP;
+
      end
GRANT EXECUTE ON PROCEDURE PR_INS_REGISTRY TO SYSDBA;
+
      --suspend;
 +
    end
 +
  end^
 +
 
 +
  SET TERM ; ^
 +
 
 +
  /* Following GRANT statetements are generated automatically */
 +
 
 +
  GRANT SELECT,INSERT ON REGISTRY TO PROCEDURE PR_INS_REGISTRY;
 +
 
 +
  /* Existing privileges on this procedure */
 +
 
 +
  GRANT EXECUTE ON PROCEDURE PR_INS_REGISTRY TO PROCEDURE TEMP;
 +
  GRANT EXECUTE ON PROCEDURE PR_INS_REGISTRY TO SYSDBA;

Версия 14:54, 27 декабря 2016

 SET TERM ^ ;
  create or alter procedure PR_INS_REGISTRY (
      DOCTOR_ID DM_UUID_NULL)
  as
  declare variable TEMP_DATE DM_DATETIME;
  declare variable FIRST_DATE DM_DATETIME;
  declare variable RES_DATE DM_DATETIME;
  begin
  temp_date='01.01.2017 08:00:00';
  first_date='01.01.2017 08:00:00';
    while (temp_date<'01.01.2018 00:00:00')
    do
    begin
     res_date=temp_date;
     if ((select first 1 r.d$uuid from registry r where r.doctor_id=:doctor_id and
      r.status>-1 and r.reg_date=:res_date) is null) then
       INSERT INTO REGISTRY (DOCTOR_ID, STATUS, REG_DATE)
       VALUES (:doctor_id,0,:res_date);
     temp_date=dateadd(minute,30,temp_date);
     if (extract(hour from temp_date)=22 and extract(minute from temp_date)=00) then
     begin
       temp_date=first_date+1;
       first_date=temp_date;
     end
     --suspend;
    end
  end^
  
  SET TERM ; ^
  
  /* Following GRANT statetements are generated automatically */
  
  GRANT SELECT,INSERT ON REGISTRY TO PROCEDURE PR_INS_REGISTRY;
  
  /* Existing privileges on this procedure */
  
  GRANT EXECUTE ON PROCEDURE PR_INS_REGISTRY TO PROCEDURE TEMP;
  GRANT EXECUTE ON PROCEDURE PR_INS_REGISTRY TO SYSDBA;