On 13/12/13 12:06, Mark Lawrence wrote:
I'm getting the the following error using DBI::SQL::Nano:

     DBD::DBM::db prepare failed: Bad ORDER BY clause ';'
         at /home/wose/.cpan/build/DBI-1.630-ZpcutD/blib/
         lib/DBI/DBD/SqlEngine.pm line 333.

for the following statement:

     SELECT
         name, phone
     FROM
         users
     ORDER BY
         name
     ;

As I understand the Nano docs the ORDER BY statement is actually ok,
but the error isn't.

If I remove the ORDER BY I get

     Couldn't find WHERE clause in '
     ;'

For:

     SELECT
         name, phone
     FROM
         users
     ;

So it looks to be a general issue with a trailing ";". Am I reading
this right?

See the last paragraph of the following subsection of the DBI
documentation:

 http://search.cpan.org/~timb/DBI/DBI.pm#prepare

It says:

Some command-line SQL tools use statement terminators, like a
semicolon, to indicate the end of a statement. Such terminators
should not normally be used with the DBI.

--
Charles Jardine - Computing Service, University of Cambridge
c...@cam.ac.uk    Tel: +44 1223 334506, Fax: +44 1223 334679

Reply via email to