UPDATE com JOIN
Bom dia galera,
Preciso fazer um Update numa tabela chamada TBLA54_TRACKING, que pega os dados da tabela TBLA41_TRANSITO..
Pesquisando na internet, vi que uma galera faz isso com um subselect, porém o meu está dando erro:
UPDATE
(SELECT TBLA54_TRACKING.A54_ORDEMDECOMPRA, TBLA41_TRANSITO.A41_ORDEMDECOMPRA,
TBLA54_TRACKING.A54_CONTACONTABIL, TBLA41_TRANSITO.A41_CONTACONTABIL,
TBLA54_TRACKING.A54_CODIGODOFORNECEDOR, TBLA41_TRANSITO.A41_CODIGODOFORNECEDOR
FROM TBLA54_TRACKING, TBLA41_TRANSITO
WHERE
TBLA54_TRACKING.A54_QUANTIDADEDOMATERIAL = TBLA41_TRANSITO.A41_QUANTIDADEDOMATERIAL
AND TBLA54_TRACKING.A54_FATURACONSOLI = TBLA41_TRANSITO.A41_FATURACONSOLI
AND TBLA54_TRACKING.A54_CODIGODOMATERIAL = TBLA41_TRANSITO.A41_CODIGODOMATERIAL
) T
SET
T.A54_ORDEMDECOMPRA = T.A41_ORDEMDECOMPRA,
T.A54_CONTACONTABIL = T.A41_CONTACONTABIL,
T.A54_CODIGODOFORNECEDOR = T.A41_CODIGODOFORNECEDOR
Erro de SQL: ORA-01779: não é possível modificar uma coluna que mapeie uma tabela não preservada pela chave
01779. 00000 - "cannot modify a column which maps to a non key-preserved table"
*Cause: An attempt was made to insert or update columns of a join view which map to a non-key-preserved table.
*Action: Modify the underlying base tables directly.
Como posso solucionar este problema ?
Obrigado
Discussão (1)
Carregando comentários...