DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
    GET DIAGNOSTICS CONDITION 1 @ERRNO = MYSQL_ERRNO, @MESSAGE_TEXT = MESSAGE_TEXT;
    SELECT 'ERROR' AS STATUS, CONCAT('MySQL ERROR: ', @ERRNO, ': ', @MESSAGE_TEXT) AS MESSAGE;
    ROLLBACK;
END;

stackoverflow.com/questions/26338033/mysql-stored-procedure-print-error-message-and-rollback


show create procedure `SP_ABC_DEF`;


EXE=" -X POST -F SEQ=12345 -F ID=idval1 -F USER_NO=85 http://127.0.0.1:8080/dir1/progran.do"

echo "CURL" $EXE
curl $EXE

linux 파일 모든 줄에 삽입

2021. 2. 22. 13:26

보호되어 있는 글입니다. 내용을 보시려면 비밀번호를 입력하세요.


find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u

 

stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy


bash mysql

mysql 2021. 2. 9. 14:57
$ echo "SELECT now()" | mysql.exe -uuserid1234 -ppwd1234\!@ -h 127.0.0.1 -P 3306 mydb
now()
2021-02-09 14:53:14

(stackoverflow.com/questions/6150675/how-to-feed-mysql-queries-from-bash)


# application.yml ===============================================
visitor1:
  height: 170
  userid: HongKildong
  
/* ReadProp.java  ==============================================*/
package com.example.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ReadProp {
    @Value("${visitor1.userid}")
    private String userid;

    @Value("${visitor1.height}")
    private int height;

    @Value("${visitor1.hpno:01099887766}") // set default value
    private String hpno;

    @Override
    public String toString() {
        return  "    userid:" + userid 
        		+ ", height:" + height
        		+ ",   hpno:" + hpno
        		+ "";
    }
}
 
/* ReadYmlValueTests.java ====================================*/
package com.example.demo;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class ReadYmlValueTests {

	@Autowired
	ReadProp person;

	@Test
	void contextLoads() {
	}


	@Test
	public void userTest(){
		System.out.println(person.toString());
	}

}

java, String array foreach

java 2021. 1. 27. 17:30
public static String[] insertSqls ={	
	"INSERT INTO noti_table(LOG_ID, REG_DT)  "
	+ "SELECT NVL(MAX(LOG_ID), 0) ERROR_LOG_ID , now()\r\n"
	+ "from src_table "
	+ "where 1=1\r\n"
	+ " and DATE_FORMAT(REG_DT, '%Y%m%d') = ? \r\n"
	,
	"INSERT INTO noti_table(LOG_ID, REG_DT)  "
	+ "SELECT NVL(MAX(LOG_ID), 0) ERROR_LOG_ID , now() \r\n"
	+ "from src_table \r\n"
	+ "where REGR_ID = 'API'\r\n"
	+ "and RESP_CD != '200'\r\n"
	+ "and DATE_FORMAT(REG_DT, '%Y%m%d') = ? "
} 
			
Arrays.asList(insertSqls).forEach((String qry) -> {
	System.out.println("qry15:" + qry);
	jdbcTemplate.update(qry, requestDate.substring(0 ,8));
});
			

배치 parameter 바꿔서 실행


         return jobBuilderFactory.get("notiMailJob")
-                .start(notiDbStep())
+                .start(notiDbStep(null))