MySQL 中date_format函数与存储过程结合解决java.sql.SQLException异常

问题:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date

解决:

drop procedure getAllOrderProc;

delimiter $$

create procedure getAllOrderProc()

    select date_format( startdate, '%Y-%m-%d') as startdate, date_format( lastdate, '%Y-%m-%d') as lastdate

    from prodorder$$
delimiter ;

 

你可能感兴趣的:(java,sql,mysql)