[英]Convert ID number into date format in oracle sql
I have ID's stored into the ID column in table TEMP_SDR_RECEIVED
which has value for example: 201505264865645884
. 我将ID存储到表TEMP_SDR_RECEIVED
的ID列中,该列的值例如: 201505264865645884
。 The year,month and date is stored in this ID format in the first 8 numbers. 年,月和日以该ID格式存储在前8个数字中。 I want to extract the year,month,date from this ID and want to set the minute,hour,seconds to 00:00:00
and others values to null in the column ID_DATE
which is date data type. 我想从此ID中提取年,月,日,并要将分钟,小时,秒设置为00:00:00
并将其他值设置为ID_DATE
列ID_DATE
其为日期数据类型)中的null。 So the conversion of ID into date format should look like this : 26.05.15 00:00:00
I am trying following query but getting an error as the hour must be between 1 to 23. Here is my query: 因此,将ID转换为日期格式应如下所示: 26.05.15 00:00:00
我正在尝试执行以下查询,但由于小时数必须在1到23之间,因此出现了错误。这是我的查询:
Insert into TEMP_SDR_RECEIVED(ID_DATE)
Select to_date(substr(ID, 1, 14), 'YYYYMMDDHH24MISS') FROM TEMP_SDR_RECEIVED
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.