[Zope] Problen wtih dtml-in inside Zsql method
- I have a problem using a 'dtml-in' tag inside of a Zsql method and I'm wondering if anybody can help me I´m using a sequence in ORACLE (called 'seq') and I need to obtain the following value of that sequence before execute other Zsql methods. For that, I define a Zsql method (called sql_select_nextval) that returns the following value of the sequence and other Zsql method (called sql_2 ) that executes another actions. The problem is that when I execute the Zsql method 'sql_2' it seems to execute the sql_select_next_val method two times because at the next time that I execute 'sql_2' the value returned from sql_select_next_val is incremented in 2 in comparison with last value returned. I need it to be incremented in 1. the code of sql_select_nextval method is the following: SELECT seq.NEXTVAL val FROM DUAL the code of sql_2 method is the following: dtml-in "sql_select_nextval" insert into anytable (oid_anytable, name) values (dtml-var val, 'john') dtml-var sql_delimiter select * from anytable where oid_anytable = dtml-var val /dtml-in The code used to create the sequence is the following: CREATE SEQUENCE seq START WITH 1 NOCYCLE NOCACHE; Note: if I put the dtml-in outside of the Zsql method it seems to work correctly... Alejandro Pancani [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problen wtih dtml-in inside Zsql method
Alejandro Pancani writes: The problem is that when I execute the Zsql method 'sql_2' it seems to execute the sql_select_next_val method two times because at the next time that I execute 'sql_2' the value returned from sql_select_next_val is incremented in 2 in comparison with last value returned. I need it to be incremented in 1. the code of sql_select_nextval method is the following: SELECT seq.NEXTVAL val FROM DUAL the code of sql_2 method is the following: dtml-in "sql_select_nextval" insert into anytable (oid_anytable, name) values (dtml-var val, 'john') dtml-var sql_delimiter select * from anytable where oid_anytable = dtml-var val /dtml-in Try to remove the "..." around "sql_select_nextval". I do not understand why your code with the "..." works at all. If this does not solve your problem, you may try: insert into anytable (oid_anytable, name) values (seq.NEXTVAL,'john') dtml-var sql_delimiter select * from anytable where oid_anytable = seq.CURVAL That's the code, we use successfully ('CURVAL' may be wrongly spelled, though). Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )