2013-01-22 2 views
1

Cette instruction de fusion génère ORA-00905: exception de mot clé manquante. Quel peut être le problème? Quelque chose avec la branche WHEN MATCHED?Instruction de fusion génère une exception, mais pourquoi

MERGE INTO WORKERPROJECT TARGET 
USING (SELECT distinct 
       w.worker_id, 
       w.worker_type, 
       w.project_id worker_project_id, 
       p.project_id project_project_id, 
       p.dedicated_project_leader, 
       p.dedicated_lead_developer, 
       p.dedicated_lead_consultant, 
       p.dedicated_supervisor 
     from WORKER w 
     join PROJECT p on w.project_id = p.project_id 
    ) SOURCE 
    ON (TARGET.FK_worker_id=SOURCE.WORKER_ID) 
WHEN MATCHED THEN INSERT (TARGET.FK_WORKER_ID, TARGET.FK_PROJECT_ID,TARGET.IS_ACTIVE,POSITION) 
    VALUES (SOURCE.WORKER_ID,SOURCE.worker_project_id,'IS_ACTIVE',SOURCE.worker_type); 
+1

Pouvez-vous faire un insert sur QUAND CORRESPOND? Je pensais que vous ne pouviez faire un insert sur QUAND PAS CORRESPONDANT. http://www.oracle-base.com/articles/10g/merge-enhancements-10g.php – twoleggedhorse

+0

bonne question.Yeah peut-être que vous avez raison, je l'essaie ... Quoi qu'il en soit -> http: // docs. oracle.com/cd/B19306_01/server.102/b14200/statements_9016.htm – czupe

+0

Malade, c'est bon maintenant. S'il vous plaît écrivez la réponse et je voterai + l'accepter! Je ne sais pas pourquoi est de cette façon, mais je nie la condition et ce sera OK. – czupe

Répondre

Questions connexes