简体   繁体   English

错误:列“DOJ”的类型是没有时区的时间戳,但表达式的类型是字符变化

[英]ERROR: column "DOJ" is of type timestamp without time zone but expression is of type character varying

I'm trying to extract data from oracle db table and insert into postgres db table using nifi我正在尝试从 oracle 数据库表中提取数据并使用 nifi 插入到 postgres 数据库表中

I'm using ExecuteSQLRecord with JsonRecordSetWriter and I'm giving this json data to PutDataBaseRecord with record reader as JsonTreeReader.我将 ExecuteSQLRecord 与 JsonRecordSetWriter 一起使用,并将此 json 数据提供给 PutDataBaseRecord,记录读取器为 JsonTreeReader。

My data in queue is like:-我在队列中的数据如下:-

[ {
  "EMP_ID" : "1",
  "DOJ" : "631170000000"
}, {
  "EMP_ID" : "2",
  "DOJ" : "631170000000"
}]

As per usage guide根据使用指南

Any numeric value can be coerced into a Date, Time, or Timestamp type, by assuming that the Long value is the number of milliseconds since epoch (Midnight GMT, January 1, 1970).通过假设 Long 值是自纪元(格林威治标准时间午夜,1970 年 1 月 1 日)以来的毫秒数,可以将任何数值强制转换为日期、时间或时间戳类型。 A String value can be coerced into a Date, Time, or Timestamp type, if its format matches the configured "Date Format," "Time Format," or "Timestamp Format."如果字符串值的格式与配置的“日期格式”、“时间格式”或“时间戳格式”匹配,则可以将字符串值强制转换为日期、时间或时间戳类型。

But in my case, date is extracting into milliseconds as a String.但在我的情况下,日期作为字符串提取到毫秒。

Is I'm missing any configuration with respect to JsonRecordSetWriter and JsonTreeReader regarding date/timestamp field.我是否缺少有关日期/时间戳字段的 JsonRecordSetWriter 和 JsonTreeReader 的任何配置。

I have seen options in JsonRecordSetWriter to provide date, time or timestamp format.我在 JsonRecordSetWriter 中看到了提供日期、时间或时间戳格式的选项。 In my oracle database date field has data like:- 2001-12-01 00:00:00 but how can I provide this value in date attribute of JsonRecordSetWriter, as it is expecting date format same as Java Date format.在我的 oracle 数据库日期字段中具有如下数据:- 2001-12-01 00:00:00但我如何在 JsonRecordSetWriter 的日期属性中提供此值,因为它期望日期格式与 Java 日期格式相同。

How do I overcome my issue, How do I extract data in timezone format from oracle date field or milliseconds but as numeric...如何克服我的问题,如何从 oracle 日期字段或毫秒中提取时区格式的数据,但作为数字...

Try to set Use Avro Logical Types to true for ExecuteSQLRecord , in this case, date shouldn't be string according to usage documentation尝试将ExecuteSQLRecordUse Avro Logical Types设置为true ,在这种情况下,根据使用文档,日期不应该是字符串

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误: <column-name> 是没有时区的时间,但表达的类型字符是变化的 - Error: the <column-name> is of time without time zone but expression is of type character varying 当我在 Jooq 中插入日期时,出现此错误:column creation_date is of type timestamp with time zone but expression is of type character varying - When I insert a date in Jooq, I get this error: column creation_date is of type timestamp with time zone but expression is of type character varying java sql error列的类型为整数,但表达式的类型为字符变化 - java sql error column is of type integer but expression is of type character varying 在 PostgreSQL 查询中将“没有时区的时间”类型读取为字符串(字符变化)类型 - Read 'Time without time zone' type as String(Character varying) type in PostgreSQL query 列是 uuid 类型,但表达式是 Spark Scala 中不同的字符类型 - Column is of type uuid but expression is of type character varying in Spark Scala JOOQ-列“ id”的类型为uuid,但表达式的类型为字符变化 - JOOQ - column “id” is of type uuid but expression is of type character varying org.postgresql.util.PSQLException:错误:列“标签”是 jsonb 类型,但表达式的类型是字符变化 - org.postgresql.util.PSQLException: ERROR: column "tags" is of type jsonb but expression is of type character varying PostgreSQL 提示:您需要重写或转换表达式。 “状态”列的类型是状态,但表达式的类型是字符变化 - PostgreSQL Hint: You will need to rewrite or cast the expression. column “state” is of type status but expression is of type character varying PostgreSQL 参数错误(timestamp with time zone, timestamp without time zone) - PostgreSQL Parameter error (timestamp with time zone, timestamp without time zone) postgres中的“带时区的时间戳”的Jooq绑定 - Jooq binding for “timestamp with time zone” type in postgres
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM