[pgsql-jp: 33335] Re: Webアプリケーションからのシーケンス操作
HOTTA Michihide
hotta @ net-newbie.com
2004年 6月 22日 (火) 16:48:31 JST
堀田@長崎市です。
on 2004/06/22 16:23 Fumiki Kawabata said the following:
> nextval() 等が存在するのはわかるのですが、
> これをpsql等で使用するなら問題ないのです。
>
> select nextval('foo');
>
> こういう構文は、coldfusion中では値を取得して来れません
> (というかエラーです)。
ColdFusion は知らないのですが、単に FROM がないからダメという
ことであれば、こんな感じでいけるみたいです。
hotta=# select version();
version
-----------------------------------------------------------------
PostgreSQL 7.4.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
3.3.2 20031218 (Vine Linux 3.3.2-0vl8)
(1 行)
hotta=# create table t(a serial, b text);
NOTICE: CREATE TABLE will create implicit sequence "t_a_seq" for
"serial" column "t.a"
CREATE TABLE
hotta=# insert into t(b) values('ABC');
INSERT 22121 1
hotta=# select * from t;
a | b
---+-----
1 | ABC
(1 行)
hotta=# select currval('t_a_seq') from t;
currval
---------
1
(1 行)
--
堀田 倫英 <hotta @ net-newbie.com> http://www.net-newbie.com
pgsql-jp メーリングリストの案内