This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
Amigo dev = vc.getAmigo("desenvolvedor") | |
se (dev != null && vc.querInidicar()){ | |
Email email = new Email("rh@synchro.com.br"); | |
email.setAssunto("Indicação"); | |
email.setMensagem("Indicação de " + dev.getNome()); | |
email.setAnexo(dev.getCurriculo()); | |
email.enviar(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- RETORNA O NÚMERO 9, OO SEJA, POSIÇÃO INICIAL DO EMAIL NO TEXTO. | |
SELECT REGEXP_INSTR('E-mail: eder@gmail.com', '\w+@\w+(\.\w+)+') FROM DUAL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--IMPORTANTE: O ÚLTIMO PARAMENTRO INDICA QUAL O GRUPO QUE SERÁ RETORNANDO, VIDE EXEMPLO: | |
-- RECUPERA DA MENSAGEM O NOME DA USUÁRIO/SCHEMA, RETORNANDO "SCHEMA" | |
SELECT REGEXP_SUBSTR('ORA-01400: cannot insert NULL into ("SCHEMA"."TABLE_NAME"."COLUMN_NAME")','"(.*?)"',1,1) FROM DUAL; | |
-- RECUPERA DA MENSAGEM O NOME DA TABELA, RETORNANDO "TABLE_NAME" | |
SELECT REGEXP_SUBSTR('ORA-01400: cannot insert NULL into ("SCHEMA"."TABLE_NAME"."COLUMN_NAME")','"(.*?)"',1,2) FROM DUAL; | |
-- RECUPERA DA MENSAGEM O NOME DA COLUNA, RETORNANDO "COLUMN_NAME" | |
SELECT REGEXP_SUBSTR('ORA-01400: cannot insert NULL into ("SCHEMA"."TABLE_NAME"."COLUMN_NAME")','"(.*?)"',1,3) FROM DUAL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A WHERE A BAIXO, FILTRA AS PESSOAS COM O PRIMEIRO NOME "Steven" OU "Stephen": | |
SELECT * FROM TABLE | |
WHERE REGEXP_LIKE(first_name, '^Ste(v|ph)en$'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SUBSTITUI "_" POR " ", RETORNANDO "Eder Leite" | |
SELECT REGEXP_REPLACE('Eder_Leite', '_', ' ') FROM DUAL; | |
-- ADICIONA UM " " APÓS CADA UMA DOS CARACTERES DO TEXTO ORIGINAL, RETORNANDO "E d e r _ L e i t e " | |
-- OBSERVAÇÃO: AO USAR "\1", ESTAMOS DIZENDO QUE QUEREMOS QUE PRIMEIRO GRUPO DO FILTRO SEJA ADICIONADO, | |
-- O GRUPO É SEMPRE REPRESENTADO POR UM REGEX DELIMITADO POR PARENTESES. | |
SELECT REGEXP_REPLACE('Eder_Leite', '(.)', '\1 ') FROM DUAL; | |
-- REMOVENDO CARACTERES ESPECIAS DO TEXTO ORIGINAL, RETORNANDO "NA" | |
SELECT REGEXP_REPLACE("Não", '[^A-Za-z0-9]+', '') FROM DUAL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- retorna a quantidade de críticas do tipo 'E' | |
select regexp_count(criticas_erro, 'E\..*?\|') from tabela; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ... | |
DBMS_OUTPUT.PUT_LINE('---> OK: ' ); | |
-- ... | |
DBMS_OUTPUT.PUT_LINE('---> ERRO: ' || V_ERROR); | |
-- ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET SERVEROUTPUT ON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
public class RepositoryApplicationTests { | |
@Autowired | |
ClienteRepository repository; | |
@Test | |
public void testRepository(){ | |
repository.save(new Cliente("Maria Oliveira","123456789")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface TimeRepository extends JpaRepository<Time, Long> { | |
@Query(value = "SELECT t.* FROM time t " | |
+ "cross JOIN boleiro_time bt, boleiro b " | |
+ "WHERE t.id = bt.id_time " | |
+ "AND bt.id_boleiro = b.id " | |
+ "AND b.id_usuario = ?1 " | |
+ "AND (t.id_gerente = ?1 " | |
+ " OR bt.id_boleiro IN (SELECT b2.id FROM boleiro b2 WHERE b2.id_usuario= ?1)" | |
+ ")", nativeQuery = true) |
NewerOlder