Question:
I have a script, which does random inserts of emails into a table, after these inserts, I need to find a way to recheck these inserted emails, and change them
This is a part of the Script, I pass him a number of emails (for example 5), and he will create 5 emails (kaue1@email.com.br….kaue5@email.com.br ), what I'm not getting is after these inserts, replace those emails in an UPDATE. I need to replace these same emails inserted, by other emails, such as (kaue5@email.com.br….kaue10@email.com.br)
FOR i IN 1..V_QTD_EMAILS LOOP
INSERT INTO G_CADASTRO.PX_EMAIL
(
ID,
CD_DADOS_XXX_XXX_XXX,
EMAIL,
DT_INCLUSAO,
CD_USUARIO
)
VALUES
(
(SELECT MAX(ID) + 1
FROM G_CADASTRO.PPX_EMAIL),
V_CD_DADOS_PX_ESTAB,
'KAUE' || i || '@EMAIL.COM.BR',
SYSDATE,
4993
);
END LOOP;
COMMIT;
I tried to include this block, but it didn't work:
FOR i IN 5..V_QTD_EMAILS loop
UPDATE G_CADASTRO.PX_EMAIL
SET EMAIL = 'MATHEUS_' || i || '@EMAIL.COM.BR'
WHERE CD_DADOS_PX_ESTAB = V_CD_DADOS_PX_ESTAB
END LOOP;
can you help me?
Answer:
Person, I decided with the following SCRIPT:
FOR i IN 1..V_QTD_EMAILS loop
UPDATE G_CADASTRO.PX_EMAIL
SET EMAIL = 'TSTALTERACAO_' || i || '@EMAIL.COM.BR'
WHERE EMAIL = 'KAUE' || i || '@EMAIL.COM.BR'
AND CD_USUARIO = 4993;
END LOOP;
Thanks to all for your help