[英]Extract function error in oracle invalid extract source
I was trying to extract minute from a datetime field .我试图从日期时间字段中提取分钟。 But i am getting the below issue .
但我得到了以下问题。 Please share any thoughts.
请分享任何想法。
code :-
select extract( minute from UPD_Action_STRT_Holi_update ) from my table
Error
ORA-30076: invalid extract field for extract source
Sample Data :-
UPD_Action_STRT_Holi_update
9/3/2021 12:39:27 PM
``
Extract source is datetime field
Oracle does not have a DATETIME<\/code> data type;
Oracle 没有
DATETIME<\/code>数据类型;
it has either a
DATE<\/code> or a
TIMESTAMP<\/code> and they both have year, month, day, hour, minute and second components;
它有一个
DATE<\/code>或一个
TIMESTAMP<\/code> ,它们都有年、月、日、小时、分钟和秒的组成部分;
TIMESTAMP<\/code> can, optionally, have fractional seconds and time zone components.
TIMESTAMP<\/code>可以选择包含小数秒和时区组件。
You get that error if your column has the
DATE<\/code> data type.
如果您的列具有
DATE<\/code>数据类型,则会收到该错误。
The
EXTRACT<\/code> function documentation<\/a> states that:
EXTRACT<\/code>函数文档<\/a>指出:
<\/blockquote>
select extract( minute from CAST(UPD_Action_STRT_Holi_update AS TIMESTAMP) ) from my_table<\/code><\/pre>
db<>fiddle here<\/a><\/em>
"db<>
在这里<\/a>摆弄<\/em>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.