In article <000001c1b6e3$01433e20$62a3933e@w3w6d9> wrote "Mb" <[EMAIL PROTECTED]>:
> 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. I don't understand your source code really. 1. @where[$i] is an unfamous style of writing. You surely meant $where[$i] or @{$where[$i]} 2. Don't give your variables names like $string., $stringW It's important what your string stands for. 3. use strict; use warnings; 4. initialize your variables ($string, $stringW). > > 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" IIRC the upon sql-statement should be like: SELECT DE_Intitule FROM F_Depot # no , before the from WHERE DE_Contact like 'mars' and # what a column should like must be in quotes DE_Ville like 'mars' and # a xyz like 'string' statement isn't useful DE_Contact like 'rueOLE' # use an = instead - it's quicker # How can DE_Contact be like 'mars' and like 'rueOLE' > > thanks for any help. > and have a nice week-end ;-) A good shot would be, if you simply describe what the above code shall do. TMTWTDI and I believe you choosed a complicated one. Best Wishes, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]