Always complicate that

Este forum é dedicado a códigos errados que se encontram por aí, ou seja, coisas que não se deve fazer de jeito nenhum! Não coloque neste forum dúvidas! (apenas situações bizarras do nosso dia a dia :-)
Post Reply
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Here goes the code to commit 500 in 500 lines:

Select all

 
LOOP 
  .. códigos .. 
  .. códigos .. 
 
  IF MOD(j, 500) = 0 
  THEN 
       COMMIT; 
  END IF; 
 
  j := j + 1; 
 
END LOOP;
Would not it be faster to put only one if without the mod function?

Select all

IF j = 500  
THEN 
  j:=0;  
  COMMIT; 
END IF;
In place of

Select all

IF MOD(j, 500) = 0  
THEN  
  COMMIT 
END IF;
So you do not need to use the mod 500 times function.
: -O
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

really ..

.. is a pearl

rsrsrs
diegolenhardt
Moderador
Moderador
Posts: 1177
Joined: Thu, 15 Oct 2009 10:28 am
Location: Recife

What a beauty, AUIHAUIHIAU
RodrigoValentim
Moderador
Moderador
Posts: 367
Joined: Tue, 25 Mar 2008 3:41 pm
Location: Salvador - BA
Rodrigo Valentim
Analista de Sistemas
Oracle Developer

Campanha: Faça uma pesquisa antes de perguntar!!!

This is very normal! I'vê seen this several times ...
Maverick
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Wed, 22 Feb 2006 3:17 pm
Location: RJ
Espero que ajude

Abraços,

Maverick

Although delayed in the comment, it makes sense.

If for some reason the counter J can not be zeroed, it can not commit when J is equal to 500.

The Commit will occur every 500 records , multiples of 500

Select all

MOD(2000,500) = 0
On the other hand, it could have declared an auxiliary accountant.
diegolenhardt
Moderador
Moderador
Posts: 1177
Joined: Thu, 15 Oct 2009 10:28 am
Location: Recife

only to do as Dr_Gori said a if = 500

and at the end of the entire procedure another if

Select all

if j > 0 then 
  commit;
to commit what was lacking ...
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests