AFAIK, placeholders are only able to be used as column values, not as column names.  I 
know that Oracle does support using bind parameters that refer to column names in 
version 805 and higher at least, but I am not aware of that being supported in DBI in 
any version as yet.

-----Original Message-----
From: Steve Berlage [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 10:53 AM
To: [EMAIL PROTECTED]
Subject: Placeholders in ORDER BY clause?


Is it possible to use placeholders in an order by clause?  The code
below executes fine but is not sorted correctly.

$sth = $dbh->prepare("SELECT projectnumber, companyname, engineer
                                                 FROM project
                                                WHERE projectmanager =
'$fullname' AND projectclass = 'Active'
                                                ORDER BY ?");

$sth->execute(projectnumber);

Obviously I will replace "projectnumber" in the execute statement with a
variable if/when the above works.  I have used placeholders successfully
in other areas so I know they work with my db.

MS Access
NT4
Active Perl

Thanks for any help!

--
Steven J. Berlage
System Administrator
ENTEGEE Engineering Technical Group
ph: 319.582.7482 x228
[EMAIL PROTECTED]


Reply via email to