I am using sqlite3 to write a perl script. The sqlite version is 3.3.6.
When I run the command in sqlite command line it works. But it errors out in perl. The sqlite version I'm using supports "IF NOT EXISTS". So why am I getting that error?
> >sqlite3 test.db SQLite version 3.3.6 sqlite> create table if not exists DATA_STATUS_VALUE (TYPE TEXT PRIMARY KEY, Seq INTEGER);
> sqlite> .tables AllJobs LOCKSTAT_VALUE test_run12_data
> DATA_STATUS_VALUE STATUS_VALUE test_run12_lock
My Perl Code:
#!/usr/bin/perl
use DBI;
my $driver = "SQLite";
$database = "test.db";
$dsn = "DBI:$driver:dbname=$database";
$dbh = DBI->connect($dsn,undef,undef,{RaiseError => 1});
$dbh->do("CREATE TABLE IF NOT EXISTS DATA_STATUS_VALUE (TYPE TEXT PRIMARY KEY, Seq INTEGER);");
The Error I get is:
DBD::SQLite::db do failed: near "NOT": syntax error(1) at dbdimp.c line 268 at file line 2675.
DBD::SQLite::db do failed: near "NOT": syntax error(1) at dbdimp.c line 268 at file line 2675.
Thanks
Aucun commentaire:
Enregistrer un commentaire