teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

状況更新

2019/03/18 06:17

投稿

raccoondog
raccoondog

スコア77

title CHANGED
File without changes
body CHANGED
@@ -40,4 +40,19 @@
40
40
  PRIMARY KEY(ORG_CODE)
41
41
  );
42
42
 
43
+ ```
44
+ ※20190318 実行状況
45
+ ```ここに言語を入力
46
+ ●SQL
47
+ update `embulk_test.T_RS_TRAN_TEST` rs set
48
+ from_org_name = (select org_name from `embulk_test.M_ORG_TEST` where org_code = rs.from_org_code and ROW_NUMBER() OVER `1`),
49
+ to_org_name = (select org_name from `embulk_test.M_ORG_TEST` where org_code = rs.to_org_code and ROW_NUMBER() OVER `1`),
50
+ from_subinv_name = (select subinv_name from `embulk_test.M_SUBINV_TEST` where org_code = rs.from_org_code and subinv_code = rs.subinv_code and ROW_NUMBER() OVER `1`),
51
+ to_subinv_name = (select subinv_name from `embulk_test.M_SUBINV_TEST` where org_code = rs.to_org_code and subinv_code = rs.subinv_code and ROW_NUMBER() OVER `1`) where ( rs.from_org_name is null or rs.to_org_name is null or from_subinv_name is null or to_subinv_name is null);
52
+
53
+
54
+ ●エラー
55
+ Analytic function not allowed in WHERE clause at [1:145]
56
+
57
+
43
58
  ```

1

質問内容の更新

2019/03/18 06:17

投稿

raccoondog
raccoondog

スコア77

title CHANGED
File without changes
body CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
  ```ここに言語を入力
8
8
  ●加工用のSQL
9
- update `embulk_test.T_RS_TRAN_TEST` rs set from_org_name = (select org_name from `embulk_test.M_ORG_TEST` where org_code = rs.from_org_code and ROW_NUMBER() = 1 ),to_org_name = (select org_name from `embulk_test.M_ORG_TEST` where org_code = rs.to_org_code and ROW_NUMBER() = 1 ),from_subinv_name = (select subinv_name from `embulk_test.M_SUBINV_TEST` where org_code = rs.from_org_code and subinv_code = rs.subinv_code and ROW_NUMBER() = 1 ),to_subinv_name = (select subinv_name from `embulk_test.M_SUBINV_TEST` where org_code = rs.to_org_code and subinv_code = rs.subinv_code and ROW_NUMBER() = 1 ) where ( rs.from_org_name is null or rs.to_org_name is null or from_subinv_name is null or to_subinv_name is null);
9
+ update `embulk_test.T_RS_TRAN_TEST` rs set from_org_name = (select org_name from `embulk_test.M_ORG_TEST` where org_code = rs.from_org_code and row_num = 1 ),to_org_name = (select org_name from `embulk_test.M_ORG_TEST` where org_code = rs.to_org_code and row_num = 1 ),from_subinv_name = (select subinv_name from `embulk_test.M_SUBINV_TEST` where org_code = rs.from_org_code and subinv_code = rs.subinv_code and row_num = 1 ),to_subinv_name = (select subinv_name from `embulk_test.M_SUBINV_TEST` where org_code = rs.to_org_code and subinv_code = rs.subinv_code and row_num = 1 ) where ( rs.from_org_name is null or rs.to_org_name is null or from_subinv_name is null or to_subinv_name is null);
10
10
 
11
11
  ●エラー
12
- Analytic function ROW_NUMBER cannot be called without an OVER clause at [1:145]
12
+ Unrecognized name:row_num at[1:145]
13
13
 
14
14
  ●テーブル定義
15
15
  CREATE TABLE T_RS_TRAN_TEST (