#!/usr/bin/perl use 5.010; use warnings; use strict; use DBI; my $dbh = DBI->connect( "DBI:CSV:", undef, undef, { RaiseError => 1, csv_null => 1, } ); # csv_null => 0 my $table = 'Table1.csv'; my( $sth, $sql ); sub output { my $sql = shift; say $sql; $sth = $dbh->prepare( $sql ); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { say DBI::neat_list( \@row ) } say ""; } $dbh->do( "DROP TABLE IF EXISTS $table" ); $dbh->do( "CREATE TABLE $table ( id INT, nachname CHAR(64), vorname CHAR(64) )" ); $sth = $dbh->prepare("INSERT INTO $table( id, nachname, vorname ) VALUES (?,?,?)"); $sth->execute( 1, 'Lohan', 'Lindsay' ); $sth->execute( 2, '', '' ); $sth->execute( 3, undef, undef ); $sql = "SELECT * FROM $table"; output( $sql ); $sql = "SELECT * FROM $table WHERE vorname = 'Lindsay'"; output( $sql ); $sql = "SELECT * FROM $table WHERE vorname <> 'Lindsay'"; output( $sql ); $dbh->disconnect;