sql statement generation problem

Chris Liechti cliechti at gmx.net
Wed Apr 24 20:15:21 EDT 2002


"Hugh" <h.e.w.frater at cs.cf.ac.uk> wrote in
news:aa7g4o$djf$1 at mannews.swan.ac.uk: 
> when using the following line to create an sql statement:  query2 =   
> "select * from tblitem where itemtypeid = %(itemTypeID)s and
> %(searchIn)s like '%(query)s'" % sqlValues    
> 
> it works, but it need to have this  like '%%(query)s%' so that oracle
> will 
>  perform the search properly. However, the extra %'s seem to mess
>  things  

whe you use the % operator on a string you must use double '%%' to get one 
in the resulting string:

.. '%%%(query)s%%'" % sqlValues

> up. Is there any way to get round this. Also, DCOracle2 is returning
> 1.0 for a value of 1 in the database. This is totally messing things
> up, and I need to find a way round this.

"int(x)" ? when you know that there are no floats, why not?

> Any ideas,
> Hugh
> 
> 



-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list