slayedbylucifer has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks.
I am using DBI and the CSV driver DBD::CSV for manipulating the the CSV files. my SELECT query is not interpreting the way I want it ot.
e.g., consider following table called test.csv:
OS,RELEASE,VERSION Ubuntu,Warty,4 Ubuntu,Hoary,5 Ubuntu,Breezy,5 Fedora,Yarrow,1 Fedora,Tettnang,2 Fedora,Stentz,4
So, I want to list the version for Fedora Stentz which is "4".
I have written below query:
my $query = "SELECT VERSION from test.csv WHERE OS="Fedora" AND RELEAS +E="Stentz"; my $sth = $dbh->prepare ($query); $sth->execute;
However, I get below error:
DBD::CSV::st execute failed: No such column '"Fedora" AND RELEASE="Ste +ntz"' at /usr/local/lib/perl/5.10.1/DBI/DBD/SqlEngine.pm line 796
So, This means the use of "AND" clause is causing the problem. I have worked a little bit on Oracle DB and know that the above Query would work fine on Oracle DB.
however, I am not able to put "AND" clause to work in above query.
I hve referred the documnetion @ SQL::Statement::Syntax (which is used by DBD::CSV), however it doensn't talk much about the "AND" clause usage.
Could you help in correcting the query please.
-Thnaks.
|
---|