declare startDate date;begin select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') into startDate from dual;dbms.output.put_line(to_char(startDate));end;我想要输出:2014-03-12 15:31:27这种格式
startDate date; 你这里定义了日期类型,但是 to_char(sysdate,'yyyy-MM-dd HH24:mi:ss')是字符串类型,类型不一致。你改成:startDate varchar2(20);