I can't imagine a problem that can be solved by cursors and not by a query.
We have been used PL/SQL (the extension of SQL by Oracle) inside zsql methods
like this:
DECLARE
C_AUX NUMBER;
BEGIN
INSERT INTO IT_GRUPO_INVESTIGACION (
C_GRUPO, D_GRUPO, S_GRUPO, F_INI_VIG, F_FIN_VIG, C_MACROAREA, L_TIPO_GRUPO,
C_PAI, C_CLASIFICACION_PAI
) VALUES (
,
,
,
,
,
,
,
,
);
''">
INSERT INTO IT_GRUPO_AREA_UNESCO (
C_AREA_UNESCO, C_GRUPO, F_INI_VIG, F_FIN_VIG
) VALUES (
,
,
,
);
''">
SELECT NVL(MAX(C_GRUPO_TECNICA)+1,1)
INTO C_AUX
FROM IT_GRUPO_TECNICA;
INSERT INTO IT_GRUPO_TECNICA (
C_GRUPO_TECNICA, D_GRUPO_TECNICA, C_GRUPO, L_PROPIA
) VALUES (
C_AUX,
,
,
);
EXCEPTION
WHEN OTHERS THEN
rollback;
raise;
END;
and it works fine. However, in such ZSQL method there isn't a resultset to
obtain (it contains INSERT and UPDATES). I think you can get a resultset by
inserting the results of your cursor proccesing into a temp table and finishing
your PL/SQL with a query.
On the other hand, a cursor is a select statement you define in order to
process each row individually; that is, a ZSQL method. You can reproduce the
cursor proccessing by defining several ZSQL methods with single SELECT and
combining then in a DTML method that does the actual proccessing (whith
, )
Andy Pahne escribió:
> hi, there,
>
> i've been using oracle8 with zope succesfully for a while. now my database
> programmer came up with a solution for a certain problem, which "we cannot
> solve with an easy select statement". he told me, that we are gonna have to
> use db-cursors instead.
>
> i must admit that i have heard the therm cursor before, but i am not sure
> how to use them with zsql-methods.
>
> my question is fairly simple: is there any difference in handling cursors
> with zsql-methods in comparison to handling 'simple' select-statements? can
> i use to iterate over the result sets?
>
> I read DCOracle.txt which comes along with DCOracle-Product, but I do not
> understand it very well.
>
> Any recommended readings?
>
> Andy Pahne
> ap@net22
>
> net22 GmbH
> Bad Meinberger Strasse 1
> 32760 Detmold
> Tel.: 05231 - 580 640
>
> ___
> 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 )
___
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 )