Skip to content

Instantly share code, notes, and snippets.

@roberto-filho
Created February 11, 2014 23:02
Show Gist options
  • Select an option

  • Save roberto-filho/8946157 to your computer and use it in GitHub Desktop.

Select an option

Save roberto-filho/8946157 to your computer and use it in GitHub Desktop.
IMPORTANT UPDATE STATEMENT
with x as (
select lancamentocontabil_lote.id id_lcto,
get_planoconta_id(cta.id, ativo.empresa_id) conta_empresa_ativo
from ativopermanente ativo
join lancamentocontabil_lote on lancamentocontabil_lote.mov_id = ativo.injecaocreditoicms_id
join planoconta cta on cta.id = lancamentocontabil_lote.conta_id)
update lancamentocontabil lcto
set conta_id = x.conta_empresa_ativo
from x
where lcto.id = x.id_lcto;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment