我不知道如何解决这个问题:
我们从各种在线供应商(亚马逊、新蛋等)导入订单信息。每个供应商都有自己的特定术语和订单结构,我们已将其镜像到数据库中。我们的数据毫无问题地导入数据库,但是我面临的问题是编写一个方法,该方法将从数据库中提取所需的字段,而不管模式如何。
例如假设我们有以下结构:
新蛋结构:
"OrderNumber" integer NOT NULL, -- The Order Number
"InvoiceNumber" integer, -- The invoice number
"OrderDate" timestamp without time zone, -- Create date.
亚马逊结构:
"amazonOrderId" character varying(25) NOT NULL, -- Amazon's unique, displayable identifier for an order.
"merchant-order-id" integer DEFAULT 0, -- A unique identifier optionally supplied for the order by the Merchant.
"purchase-date" timestamp with time zone, -- The date the order was placed.
如何选择这些项目并将它们放入临时表中供我查询?
临时表可能如下所示:
"OrderNumber" character varying(25) NOT NULL,
"TransactionId" integer,
"PurchaseDate" timestamp with time zone
我知道一些数据库代表一个带有整数的订单号,而另一些则代表一个不同的字符;为了处理这个问题,我计划将数据类型转换为字符串值。
有没有人建议我阅读这将帮助我解决这个问题?
我不需要一个确切的答案,只是朝着正确的方向轻推。
这些数据将由 Java 使用,因此如果有任何特定的 Java 类有帮助,请随时提出建议。