回答編集履歴
3
修正
answer
CHANGED
@@ -25,6 +25,7 @@
|
|
25
25
|
```
|
26
26
|
ストアド
|
27
27
|
---
|
28
|
+
カラムを指定するだけだと曖昧と言われるので、修飾を付加します。
|
28
29
|
```SQL
|
29
30
|
create or replace function codes(_kind varchar(10))
|
30
31
|
returns table(kind varchar(10), status int, value text) as $$
|
2
修正
answer
CHANGED
@@ -27,11 +27,12 @@
|
|
27
27
|
---
|
28
28
|
```SQL
|
29
29
|
create or replace function codes(_kind varchar(10))
|
30
|
-
returns table(kind
|
30
|
+
returns table(kind varchar(10), status int, value text) as $$
|
31
31
|
begin
|
32
|
-
return query select codelist.kind, key, codelist.value from codelist where kind = _kind;
|
32
|
+
return query select codelist.kind, key, codelist.value from codelist where codelist.kind = _kind;
|
33
33
|
end;
|
34
34
|
$$language plpgsql;
|
35
|
+
|
35
36
|
```
|
36
37
|
実行
|
37
38
|
---
|
1
修正
answer
CHANGED
@@ -27,9 +27,9 @@
|
|
27
27
|
---
|
28
28
|
```SQL
|
29
29
|
create or replace function codes(_kind varchar(10))
|
30
|
-
returns table(status int, value text) as $$
|
30
|
+
returns table(kind text, status int, value text) as $$
|
31
31
|
begin
|
32
|
-
return query select key, codelist.value from codelist where kind = _kind;
|
32
|
+
return query select codelist.kind, key, codelist.value from codelist where kind = _kind;
|
33
33
|
end;
|
34
34
|
$$language plpgsql;
|
35
35
|
```
|