PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum Incrementar valor em um campo nulo? #385869

08/09/2010

0

Como faço para pegar valores nulos (varchar) no banco e incrementar + 1 ... Uso firebird 2.0

create or alter procedure MUDA_VALOR
returns (
    IDCHAVE integer)
as
declare variable VINC_CAMPO integer;
begin
  vINC_CAMPO = 000001;
  for select M.nrordemserv from ordemserv M
    where cast(M.nrordemserv as integer) is null into :idchave
  do begin

    update ordemserv m
       set M.nrordemserv = :vINC_CAMPO
           where M.nrordemserv = :idchave;

    vinc_campo = vinc_campo + 1;

    suspend;
  end
end

Adriano Dolce

Adriano Dolce

Responder

Posts

09/09/2010

Adriano Dolce

Resolvido 

create or alter procedure MUDA_VALOR
returns (
    IDCHAVE integer,
    VINC_CAMPO integer)
as
begin
  vINC_CAMPO = 000001;
  for select M.IDORDEM from ordemserv M
    where M.nrordemserv is null into :idchave
  do begin

    update ordemserv m
       set M.nrordemserv = :vINC_CAMPO
           where M.IDORDEM = :idchave;

    vinc_campo = vinc_campo + 1;

    suspend;
  end
end

Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar