"localhost:/firebird/data/ILICHEVSK2.FDB". Процедуры Previous topic Chapter index Next topic

DELETE_CLIENTS

 

Входные параметры

(Нет входных параметров)

 

Выходные параметры

Параметр

Тип

Описание

CLIENTID

INTEGER

 

CLIENTFULLNAME

VARCHAR(255)

 

 

Описание

(Нет описания для процедуры DELETE_CLIENTS)

 

Определение

CREATE PROCEDURE DELETE_CLIENTS
RETURNS (
    CLIENTID INTEGER,
    CLIENTFULLNAME VARCHAR(255))
AS
declare variable INVENTORYO integer;
declare variable INVENTORYP integer;
declare variable INVENTORYS integer;
declare variable INVENTORYF integer;
declare variable INVENTORYE integer;
declare variable INVENTORYM integer;
begin
  for
    select CLIENTS.CLIENTID, CLIENTS.CLIENTFULLNAME,
        (select max(IT.INVENTORYID) from IT where (IT.OWNERID = CLIENTS.CLIENTID)),
        (select max(IT.INVENTORYID) from IT where (IT.PROVIDERID = CLIENTS.CLIENTID)),
        (select max(IT.INVENTORYID) from IT where (IT.INVOICEID = (select max(INVOICES.INVOICEID) from INVOICES where(INVOICES.SENDERID = CLIENTS.CLIENTID)))),
        (select max(IT.INVENTORYID) from IT where (IT.INVOICEID = (select max(INVOICES.INVOICEID) from INVOICES where(INVOICES.FORWARDERID = CLIENTS.CLIENTID)))),
        (select max(IT.INVENTORYID) from IT where (IT.INVOICEID = (select max(INVOICES.INVOICEID) from INVOICES where(INVOICES.EXPORTERID = CLIENTS.CLIENTID)))),
        (select max(IT.INVENTORYID) from IT where (IT.INVOICEID = (select max(INVOICES.INVOICEID) from INVOICES where(INVOICES.MANUFACTURERID = CLIENTS.CLIENTID))))
      from CLIENTS
      where (CLIENTS.CLIENTID > 2)
    group by CLIENTS.CLIENTID, CLIENTS.CLIENTFULLNAME
    into :CLIENTID, :CLIENTFULLNAME, :INVENTORYO, :INVENTORYP, :INVENTORYS, :INVENTORYF, :INVENTORYE, INVENTORYM
  do
    if ((:INVENTORYO is null) and (:INVENTORYP is null) and (:INVENTORYS is null)
        and (:INVENTORYF is null) and (:INVENTORYE is null) and (:INVENTORYM is null)) then begin
      delete from CLIENTS
      where (CLIENTID = :CLIENTID);

      suspend;
    end
end

 

     Previous topic Chapter index Next topic