2009/3/13 B. Randy <randy11 / numericable.fr>:

> # Request with 3 parameters.
> request =3D "select * from emp
> where SUBSTR(ENAME,1,LENGTH(:who)) =3D :who AND SAL > :paid order by :how=
"
> cursor =3D connex.parse(request)
>
> # Bind the parameters.
> cursor.bind_param(':who', 'A') =A0 =A0 =A0# This work.
> cursor.bind_param(':paid', 1000) =A0 =A0# This work.
> cursor.bind_param(':how', 'ENAME') =A0# !! This doesn't work ???
> cursor.exec()

You cannot give the column name as a bind parameter.  You either have
to insert it when constructing the statement or you have to have
several statements.

Btw, I doubt that *any* RDBMS will allow to select a column used for
ordering with a bind parameter because that changes semantics of the
SQL statement. This would make a recompile of the SQL statement
necessary because the execution plan will change every time you invoke
it rendering bind parameters useless.

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end