[Zope] Problen wtih dtml-in inside Zsql method

Alejandro Pancani apancani@topgroup.com.ar
Thu, 9 Nov 2000 00:25:05 -0300


----------------------------------------------------------------------------
-------------------------------------
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
alejandrop1@topgroup.com.ar