2

这是用于 Excel 的 Invantive Control。

什么可能导致第二个 CREATE TABLE 出现错误?

CREATE TABLE niveau1@inmemorystorage
AS
SELECT ID
,      Code
,      AddressLine1
,      Name
,      Parent
FROM   Accounts
WHERE  ID=$P{P_ACCOUNTID}

CREATE TABLE niveau2@inmemorystorage
AS
SELECT ID
,      Code
,      AddressLine1
,      Name
,      Parent
FROM   Accounts
WHERE  Parent IN (SELECT ID FROM niveau1@inmemorystorage)

CREATE TABLE niveau3@inmemorystorage
AS
SELECT ID
,      Code 
,      AddressLine1
,      Name
,      Parent
FROM   Accounts
WHERE  Parent IN (SELECT ID FROM niveau2@inmemorystorage)

SELECT * FROM niveau1@inmemorystorage
UNION ALL
SELECT * FROM niveau2@inmemorystorage
UNION ALL
SELECT * FROM niveau3@inmemorystorage
4

1 回答 1

2

您可能收到错误消息:“标识符‘帐户’不明确。”。您可以在必要时添加标识符。

Exact Online 帐户的工作 SQL 如下所示。请注意使用 ofcreate or replace table而不是create table,权限不会改变(如果有的话),但在必要时首先删除表。

CREATE OR REPLACE TABLE niveau1@inmemorystorage
AS
SELECT act.ID
,      act.Code
,      act.AddressLine1
,      act.Name
,      act.Parent
FROM   exactonlinerest..Accounts act


CREATE OR REPLACE TABLE niveau2@inmemorystorage
AS
SELECT act.ID
,      act.Code
,      act.AddressLine1
,      act.Name
,      act.Parent
FROM   exactonlinerest..Accounts act
join   niveau1@inmemorystorage n1
on     n1.id = act.Parent

CREATE OR REPLACE TABLE niveau3@inmemorystorage
AS
SELECT act.ID
,      act.Code 
,      act.AddressLine1
,      act.Name
,      act.Parent
FROM   exactonlinerest..Accounts act
join   niveau2@inmemorystorage n2
on     n2.id = act.Parent

SELECT * FROM niveau1@inmemorystorage
UNION ALL
SELECT * FROM niveau2@inmemorystorage
UNION ALL
SELECT * FROM niveau3@inmemorystorage
于 2016-10-14T06:42:30.403 回答