[Zope] Zope DTML zSQL Select from Oracle insert into MS Access

Tino Wildenhain tino@wildenhain.de
Mon, 07 Jul 2003 11:32:19 +0200


Hi Julian,

Julian Clark wrote:
> Hi,
> 
> I've been trying (rather unsuccessfully i might add) to select some 
> data from an oracle table, and insert it into another MS Access table.
> 
> I'm trying to do this  via a dtml method and a couple of zSQL queries.
> 
> Has anyone here found a good way of achieving this?


If this must be done via web, you should consider small python scripts
for this, since it is more clear how to script them.

Say, where did you find the most ancient way of defining dtml-tags? ;))

in a python-script and somewhat similar in dtml,
you would do something like that:

for item in context.yourOracleQuery(param1=someparam1,param2=someparam2):
 
context.yourAccessQueryWithSingleLineInsert(insertvalue1=item.value1,insertvalue2=item.value2)


this was it. Your mail-client may break the lines appart, but you can
have a look into your favourite python manual to get this right.

Inside your ZSQL-Methods you use param1, param2
and insertvalue1,insertvalue2 and so on.

HTH
Tino Wildenhain

> I've been trying many variants...
> 
> this is my latest...
> 
> TheForm 
> <form name='form1' action='meth_step'> 
> <tr> 
> <td>Start Date</td> 
> <td><input type='text' name='start_date'></input> 
> <td>End Date <input type='text' name='end_date'></input> 
> <input type='submit' name='Go'></input></td> 
> </form> 
> 
> 
> Oracle Select 
> select 
> H.mobile_no as mobile_number, 
> H.DEALER_NO as dealer_code, 
> SCD.ENTRY_DATE as date_added 
> from 
> jan.sc_detail SCD, 
> jan.handset H 
> where 
> SCD.handset_code = H.code and 
> SCD.comments = 'SERVICE ADDED' and 
> SCD.ENTRY_DATE > ('<dtml-var start_date>') and 
> SCD.ENTRY_DATE < ('<dtml-var end_date>') and 
> (H.status = 'A' or H.status = 'B') and 
> (H.DEALER_NO NOT BETWEEN '0000' and '0004') 
> 
> Dtml method ('meth_step')
> <!--#call insert_all_connects --> 
> 
> 



MS Access Insert
INSERT into mConnectList
(
dealer_code,
mobile_number,
date_added
)
values
(
   <dtml-sqlvar insertvalue1>,<dtml-sqlvar insertvalue2>,<dtml-sqlvar 
insertvalue3>
)



(you can of yourse have other names for your insertvalues, this is just 
an example)


> 
> Thanks
> Julian.
> 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>