I have the following query:
INSERT INTO TB_CLASSIFICACAO_UG
(COD_CLASSIFICACAO_UG, TXT_DESCRICAO, IND_ATIVO)
VALUES
(SEQ_COD_TB_CLASSIFICACAO_UG.nextval, 'TESTANDO', 1)
WHERE
(SELECT COUNT(TXT_DESCRICAO) FROM TB_CLASSIFICACAO_UG WHERE TXT_DESCRICAO = 'TESTANDO') = 0
This query generates the error:
"SQL command not properly ended"
But if I run only the first part it works.
INSERT INTO TB_CLASSIFICACAO_UG
(COD_CLASSIFICACAO_UG, TXT_DESCRICAO, IND_ATIVO)
VALUES
(SEQ_COD_TB_CLASSIFICACAO_UG.nextval, 'TESTANDO', 1)
And if I run the second part too.
(SELECT COUNT(TXT_DESCRICAO) FROM TB_CLASSIFICACAO_UG WHERE TXT_DESCRICAO = 'TESTANDO') = 0
What am I doing wrong?
What I want at the end of the day is an INSERT IF NOT EXISTS. Any suggestions for a query? I've tried it in other ways besides that and it did not work.