Link to home
Start Free TrialLog in
Avatar of enrique_aeo
enrique_aeo

asked on

ORA-00905 missing KEYWORD

i am trying execute this query
merge into CLIENTE c
using tmp_Solicitud s
on (c.CODIGOUNICO = s.CodUnico)
when not matched then
insert (
        c.CODIGOUNICO,
        c.RAZONSOCIAL,
        c.NUMERODOCUMENTO,
        c.BANCA,
        c.CODIGOGRUPO,
        c.CLASIFICACIONSBS,
        c.CLASIFICACIONFEVE,
        c.RATINGEMPRESA,
        c.SEGMENTO,
        c.CODIGOEJECUTIVO,
        c.NOMBREEJECUTIVO,
        c.CODIGOTIENDA
)
values(
        s.CodUnico,
        s.RazonSocial,
        s.NumeroDocumento,
        s.CodTipoBanca,
        s.CodGrupo,
        s.CodCalificacionSBS,
        s.CodFeve,
        s.Rating,
        s.CodSegmentacion,
        s.CodEjecutivoNegocios,
        s.DesEjecutivoNegocios,
        s.LineaCredTienda
       );
but i have this erros, missing keyword, view file
missingKEYWORD.jpg
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

you need to specify the WHEN MATCHED part also
I believe you need the

WHEN MATCHED THEN <update_clause>

but i am not positive it is required
Avatar of enrique_aeo
enrique_aeo

ASKER

when this happens
 WHEN MATCHED THEN
 must do nothing
 as would the code please
merge into CLIENTE c
using tmp_Solicitud s
on (c.CODIGOUNICO = s.CodUnico)
WHEN MATCHED THEN ( )
when not matched then
insert (
'when matched' is NOT required.

I ran the following code using 10.2.0.3.

drop table tab1 purge;
create table tab1(col1 char(1));

drop table tab2 purge;
create table tab2(col1 char(1));

insert into tab1 values('a');
insert into tab2 values('b');

merge into tab2
using tab1 on (tab1.col1=tab2.col1)
when not matched then
	insert(col1) values('z')
/

Open in new window

What is your database version?
I run that code for the version of the database?
I AM USING pl/sql developer
plsqlDEVELOPER.jpg
>>I AM USING pl/sql developer

Can you try the code you have from sqlplus?
THE SAME ERROR from sql plus
sqlPLUS.jpg
SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
add the sentence
WHEN MATCHED THEN
(
UPDATE
SET   c.RATINGEMPRESA = s.Rating
)
but the error it is the same
plsqlDEVELOPER.jpg
the same error
sqlPLUS.jpg
i add
when matched then
but i other error, view file
sqlPLUS.jpg
after executing the statement merge lose connection, do not understand why
9.2.0.1 was pretty buggy.  I suggest you use one of the other methods from your previos question and forget about merge.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial