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

CHANGE_CLIENTID

 

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

Параметр

Тип

Описание

OLDCLIENTID

INTEGER

 

NEWCLIENTID

INTEGER

 

CHANGECLIENTID

INTEGER

 

 

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

Параметр

Тип

Описание

UPDATINGCLIENTID

INTEGER

 

 

Описание

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

 

Определение

CREATE PROCEDURE CHANGE_CLIENTID(
    OLDCLIENTID INTEGER,
    NEWCLIENTID INTEGER,
    CHANGECLIENTID INTEGER)
RETURNS (
    UPDATINGCLIENTID INTEGER)
AS
begin
  update ORDERLOAD
  set PROVIDERID = :NEWCLIENTID
  where (PROVIDERID = :OLDCLIENTID);

  update ORDERLOAD
  set OWNERID = :NEWCLIENTID
  where (OWNERID = :OLDCLIENTID);

  update IT
  set PROVIDERID = :NEWCLIENTID
  where (PROVIDERID = :OLDCLIENTID);

  update IT
  set OWNERID = :NEWCLIENTID
  where (OWNERID = :OLDCLIENTID);

  update INVOICES
  set EXPORTERID = :NEWCLIENTID
  where (EXPORTERID = :OLDCLIENTID);

  update STORAGETICKETS
  set OWNERID = :NEWCLIENTID
  where (OWNERID = :OLDCLIENTID);

  update CONTRACTS
  set OWNERID = :NEWCLIENTID
  where (OWNERID = :OLDCLIENTID);

  update CONTRACTS
  set PROVIDERID = :NEWCLIENTID
  where (PROVIDERID = :OLDCLIENTID);

  update CONTRACTS
  set FORWARDERID = :NEWCLIENTID
  where (FORWARDERID = :OLDCLIENTID);

  update EXPORTACTS
  set OWNERID = :NEWCLIENTID
  where (OWNERID = :OLDCLIENTID);

  update EXPORTACTS
  set PROVIDERID = :NEWCLIENTID
  where (PROVIDERID = :OLDCLIENTID);

  if (:CHANGECLIENTID = 1) then begin
    update CLIENTS
    set CLIENTID = :NEWCLIENTID
    where (CLIENTID = :OLDCLIENTID);
  end
  else begin
    delete from CLIENTS
    where (CLIENTID = :OLDCLIENTID);
  end

  UPDATINGCLIENTID = :NEWCLIENTID;

  suspend;
end

 

     Previous topic Chapter index Next topic