fucntion 생성시 오류발생 - 

ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)


my.cnf 파일 mysqld 설정 확인

--log-bin-trust-function-creators=1 


설정파일 수정하면 재시작 해야하니 명령어 실행

mysql>SET GLOBAL log_bin_trust_function_creators = 1; 


//1=on을 의미하고 0은 off를 의미한다 

'database' 카테고리의 다른 글

mysql table, column 구조 확인  (0) 2020.01.09
오라클 database 버전확인  (0) 2015.12.08
mysql 트리거 생성시 function 생성 오류  (0) 2015.05.13
오라클 LISTAGG  (0) 2014.12.04
오라클 특수문자 제거  (0) 2014.12.02
Posted by 우주정복☆
,

List 중복제거

java 2017. 11. 27. 11:30

List<String> years = new ArrayList<String>();


years.add("2017");

years.add("2016");

years.add("2015");

years.add("2014");

years.add("2013");

years.add("2012");

years.add("2017");

years.add("2016");

years.add("2015");

years.add("2011");

List<String> uniqueYears = new ArrayList<String>(new HashSet<String>(years));


String list = {"1","2","3","1","2"};

list = new HashSet<String>(Arrays.asList(list)).toArray(new String[0]);

'java' 카테고리의 다른 글

해당 월의 마지막 일자 구하기  (0) 2019.01.31
하이버네이트 중복제거(distinct)  (0) 2018.03.05
Date 날짜의 차이수 구하기  (0) 2017.11.09
JAVA 날짜 더하기  (0) 2017.10.31
[톰캣오류] MalformedByteSequenceException  (1) 2017.04.21
Posted by 우주정복☆
,


public class Test {


public static void main(String[] args) throws ParseException {

DateFormat format = new SimpleDateFormat("yyyy-MM-dd");

Calendar start = Calendar.getInstance();

Calendar end = Calendar.getInstance();

Calendar today = Calendar.getInstance();

start.setTime(format.parse("2017-01-01"));

end.setTime(format.parse("2017-01-31"));

today.setTime(new Date());

//올해의 일수

long time = (end.getTimeInMillis() - start.getTimeInMillis()) / 1000;

long totalCnt = ((time/(60*60*24))+1);

System.out.println("종료일과 시작일 차이수 : "+totalCnt);

//지난일수

time = (today.getTimeInMillis() - start.getTimeInMillis()) / 1000;

long nowDate = ((time/(60*60*24))+1);

System.out.println("시작일에서 오늘까지 일수 : "+nowDate);

//진행율

double percent = Double.parseDouble(String.format("%.1f",  ((double)nowDate / (double)totalCnt * 100.0)));

System.out.println("진행율 : "+percent);

}


}



'java' 카테고리의 다른 글

하이버네이트 중복제거(distinct)  (0) 2018.03.05
List 중복제거  (0) 2017.11.27
JAVA 날짜 더하기  (0) 2017.10.31
[톰캣오류] MalformedByteSequenceException  (1) 2017.04.21
tomcat7 패키지 복수 등록 예제  (0) 2016.10.28
Posted by 우주정복☆
,