Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Error "'exists ^0^' has chars not alphanumeric or underscore in perl"

by NetWallah (Abbot)
on Jan 25, 2013 at 05:14 UTC ( #1015266=note: print w/ replies, xml ) Need Help??


in reply to Error "'exists ^0^' has chars not alphanumeric or underscore in perl"

The error seems to be emanating from SQL::Parser - which looks like it is getting confused by the complex SQL syntax.

Try re-designing your SQL statement using UNION or INTERSECTION - maybe that will get past the Parser.

Sorry - I'm not a SQL guru, and dont know the syntax well enough to actually provide the alternative.

BTW - your attempt to clear the SQL of funny characters has a bug - it deletes the "%" after "Data%" - leading to potentially undesirable results.

The SQL string shown is clean to start with - it does not need the regex you have attempted to use.

             Most people believe that if it ain't broke, don't fix it.
        Engineers believe that if it ain't broke, it doesn't have enough features yet.


Comment on Re: Error "'exists ^0^' has chars not alphanumeric or underscore in perl"
Re^2: Error "'exists ^0^' has chars not alphanumeric or underscore in perl"
by choroba (Abbot) on Jan 25, 2013 at 09:05 UTC
    I am getting the same error when trying to parse the SQL with SQL::Parser. However, it work with DBD::SQLite, for example:
    #!/usr/bin/perl use warnings; use strict; use DBI; use DBD::SQLite; my $sql = DBI->connect('dbi:SQLite:dbname=1.db', q(), q()); $sql->do('create table TABLENAME (type varchar, name varchar)') +; $sql->do(q(insert into TABLENAME values ('MASTER', 'm1'))); $sql->do(q(insert into TABLENAME values ('MASTER', 'Data1'))); $sql->do(q(insert into TABLENAME values ('SLAVE', 's1'))); my $sth = $sql->prepare(q(select T.Name from TABLENAME T where T.Type = 'MASTER' and not exists (select 1 from TABLENAME +T2 where T2.Name = T.Name and T2.Name like 'Da +ta%'))); $sth->execute; my $aref = $sth->fetchall_arrayref; print "@$_\n" for @$aref;
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015266]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-07-10 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (212 votes), past polls