ORA-01861: literal does not match format string

简介: 在创建基线过程中遇到了这个错误:SYS@db1> BEGIN2  DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE (3    start_time  =>'2017-03-06 7:00:00' ,4    end_time   =>...
在创建基线过程中遇到了这个错误:

SYS@db1> BEGIN
2  DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE (
3    start_time  =>'2017-03-06 7:00:00' ,
4    end_time   => '2017-03-06 8:00:00' ,
5    baseline_name  => 'AWR_bs3',
6    expiration     => NULL );
7  END;
8  /
BEGIN
*
ERROR at line 1:
ORA-01861: literal does not match format string
ORA-06512: at line 2

原因是日期需要用to_date从字符串转化成日期格式,改成如下格式即可:

BEGIN 
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE ( 
  start_time  => to_date('2017-03-06 7:00:00' , 'yyyy-mm-dd hh24:mi:ss'), 
  end_time   => to_date('2017-03-06 8:00:00' , 'yyyy-mm-dd hh24:mi:ss'), 
  baseline_name  => 'AWR_bs3', 
  expiration     => NULL ); 
END;



相关文章
|
12天前
|
C++
【洛谷 P1000】超级玛丽游戏 题解(raw string literal)
这是一个关于使用字符画展示超级玛丽场景的编程题。无需输入,输出为指定的马里奥图案。提供的C++代码直接打印了预设的场景图案。
7 0
|
13天前
|
C++
【洛谷 B2025】输出字符菱形 题解(raw string literal)
使用`*`构建一个斜置的、对角线长度为5的菱形。无输入要求。输出示例:`*`、`***`、`*****`、`***`、` *`。代码实现使用C++,直接打印预定义字符串完成。
23 0
|
10月前
|
C++
C++11新特性探索:原始字符串字面值(raw string literal)
原始字符串字面值(raw string literal)是C++11引入的新特性。
101 0
解决Format string is not a string literal (potentially insecure)问题
在用宏实现部分字符串格式化问题时,stringWithFormat方法会出现【Format string is not a string literal (potentially insecure)】警告
349 0
IllegalArgumentException Parameter value [4] did not match expected type [java.lang.String (na)]
IllegalArgumentException Parameter value [4] did not match expected type [java.lang.String (na)]
|
人工智能 安全 算法
Leetcode-Easy 942. DI String Match
Leetcode-Easy 942. DI String Match
91 0
Mockito框架研究 - how is match any string implemented
Mockito框架研究 - how is match any string implemented
122 0
Mockito框架研究 - how is match any string implemented
Mockito框架研究 - how is match any string implemented
Mockito框架研究 - how is match any string implemented
Mockito框架研究 - how is match any string implemented