[Zope-DB] ZADODA

Martin Winkler mw at agami.at
Thu Oct 21 13:04:48 EDT 2004


Hi Jürgen,

> My ZSQL Statement:

When using sql_delimiter, you have to write a full and valid sql
statement after the delimiter, which is not the case in your example.

> The Second Problem I have is how can I read the Last inserted ID form the DB? Is there a function?

insert into ( ... ) values (...)
<dtml-var sql_delimiter>
select currval('sequencename')


that works for PostgreSQL. I don't know about your database system.

Normally you should select the "nextval" of your sequence, and then do
the insert statement using this value. That way you have full control
over your new id.

Martin




More information about the Zope-DB mailing list