
/*------ ATD 425328 ------*/
CREATE OR REPLACE VIEW PLATAFORMA_ECOMMERCE_V
AS
SELECT C.NOME, C.CODIGO AS IDENTIFICADOR, 
(CASE WHEN P.OID > 100000 THEN O.NOME ELSE C.NOME END) ORIGEM, 
(CASE WHEN P.OID > 100000 THEN O.OID ELSE C.OID END) OIDORIGEM, P.*
FROM PLATAFORMA_ECOMMERCE P
 JOIN CATEGORIA_R C ON C.OID = P.OID
 JOIN ITEM O ON O.OID = C.RSUPER;
/

UPDATE ITEM SET CODIGO = 'VTEX' WHERE OID = 38729 AND CODIGO = ' ';
UPDATE ITEM SET CODIGO = 'TrayCorp' WHERE OID = 39215 AND CODIGO = ' ';
UPDATE ITEM SET CODIGO = 'TrayVarejo' WHERE OID = 39338 AND CODIGO = ' ';
UPDATE ITEM SET CODIGO = 'Ideris' WHERE OID = 39598 AND CODIGO = ' ';
UPDATE ITEM SET CODIGO = 'Ciashop' WHERE OID = 38730 AND CODIGO = ' ';
UPDATE ITEM SET CODIGO = 'SkyHub' WHERE OID = 38731 AND CODIGO = ' ';
commit;
/