Hi all,
Sure i m the only one doing perl in the week-end, the mailinglist is deserted.
I' m tryig to generate dynamic SQL statements.
I have a problem on getting a WHERE over 'varchar' type fields.
for ($i =0; $i<scalar(@where); $i+=2){
#pour une entree a la table de hash avec en sortie un ensemble de atts
#on en selectionne un aleatoirement sur le quel portera le where
@tabAttrs = @{$hash{@where[$i]}};
my $indice = int(rand(@tabAttrs));
if($i != scalar(@where)-2){
$string .= @where[$i].' = '.@where[$i+1].' and ';
$stringW .= @tabAttrs[$indice].' like '.@where[$i+1].' and ';
}else{
$string .= @where[$i].' = '.@where[$i+1];
$stringW .= @tabAttrs[$indice].' like '.@where[$i+1];
}
}
suppose @where[$i+1] == mars -> I want to get 'mars'.
"select DE_Intitule, @select from F_Depot $stringW" ------------> that is my SQL
statement
And i m gtting the error bellow :
select DE_Intitule, from F_Depot where DE_Contact like mars and DE_Ville like mars and
DE_Contact like rueOLE exception from "Microsoft OLE DB Provider for ODBC Drivers":
[Simba][Simba ODBC Driver]Syntax Error. Win32::OLE(0.1502) error 0x80040e14 in
METHOD/PROPERTYGET "Execute"
thanks for any help.
and have a nice week-end ;-)
asma