Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger - ORA-6512

Re: Trigger - ORA-6512

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 9 Jun 1999 19:01:28 +0200
Message-ID: <928947608.1909.0.pluto.d4ee154e@news.demon.nl>


Hi Ricardo,
That message you get for free, that is you will get them always when anything happens with your pl/sql code

Hth,

Sybrand Bakker, Oracle DBA

Ricardo Patrocinio wrote in message <375E395A.B544D29_at_atm.mailcom.pt>...
>SqlPlus - Sql Server 7.3.2.2.
>
>
> I've the following trigger:
> Create or Replace Trigger TBI_RA1
> Before Insert on Rime_Alteracoes for each row
> Declare
> Cursor C_dummy is
> Select max(num_alteracao)
> From rime_alteracoes
> Where cod_projecto = :new.cod_projecto and
> regiao = :new.regiao and
> ano = :new.ano;
>
> Cursor C_Crs Is
> Select distinct 1
> From rime_alteracoes
> Where cod_projecto = :new.cod_projecto and
> regiao = :new.regiao and
> ano = :new.ano and
> num_crs = :new.num_crs;
>
> dummy rime_alteracoes.num_alteracao%TYPE := 0;
> BEGIN
>
> Open C_Crs;
> Fetch C_Crs into dummy;
> Close C_Crs;
>
> If dummy = 1 Then
> raise_application_error(-20100,'Coluna única
> repetida');
>
> Else
> Open c_dummy;
> Fetch c_dummy into dummy;
> Close C_dummy;
>
> if dummy is null then
> dummy := 0;
> else
> dummy := dummy + 1;
> end if;
>
> :new.num_alteracao := dummy;
> :new.login := USER;
> End if;
> END;
>
> When I try to Insert a line in the table
> Rime_Alteracoes, it gives me
> the following errors:
>
> insert into rime_alteracoes (cod_projecto,
>regiao,
> ano, num_crs)
> values (1,'N',1997,1)
> *
> ERRO na linha 1:
> ORA-20100: Coluna única repetida
> ORA-06512: na "RIME.TBI_RA1", linha 21
> ORA-04088: erro durante a execução do trigger
> 'RIME.TBI_RA1'
>
> The first one, I understand, it's the error
>that
> I've made and it should
> appear, but the other tow I don't understand!?
>
Received on Wed Jun 09 1999 - 12:01:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US