-2
I have today this INSERT in JAVA running but I need to implement a new routine:
            public void gravarLogAbonoUnificado(TbLogAbonClickUnic entity,
            RetornoAuxDto auxDto) {
            STRING SQL = "INSERT INTO" +
            "TB_LOG_ABON_CLIK_UNIC" +
            "(NR_SEQU_LOG_LOG_CLICK_UNIC, NR_SEQU_TIPO_MOTI, CD_PODR) +
            "VALUES (?,?,?)";
            Query query = em.createNativeQuery(hql);
            Query.setParameter(1, entity.getTbLogEntrClickUnic().
            getNrSequeLogClikUnic()).
            Query.setParameter(2, (long) auxDto.getCodRetorno());
            //ESSE MEU CAMPO SE VIER NULL, PRECISA QUE SEJA INSERIDO //
              Query.setParameter(3, (long) auxDto.getCodRetorno());
            query.executeUpdate;
If my CD_PODR field is NULL it should insert with this select:
                  select p.nr_seque_item_podr from
            tb_tipo_grup_podr g,
            tb_tipo_item_podr p,
            where
            g.nr_seque_grup_podr = p.nr_seq_grup_podr and
            g.sg_grup_podr = '09'
            and
            p.sg_item_podr = '01'
How can I do that?