nitn has asked for the wisdom of the Perl Monks concerning the following question:

my $sth3 = $dbh->prepare("select name,value from A where in (".join(" +,",@var1).")"); - @var1 contains the 5 values $sth3->execute(@var1); while (my @row = $sth3->fetchrow_array) { print join(", ", @row), "\n"; }
getting error :
DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD ERR +OR: error possibly near <*> indicator at char 58 in 'select name,valu +e from A where <*>in (1,2,3,4,5)') [for Statement "select name,value +from A where in (1,2,3,4,5)"] at hello.pl line 99. Can't call method "execute" on an undefined value at hello.pl line 102 +.

Replies are listed 'Best First'.
Re: Getting error multiple values in where conditon.
by huck (Prior) on Oct 13, 2017 at 16:21 UTC

    What variable is supposed to be a member of 1..5?

    The "IN" clause is defined as <variable> IN (<list>) but you have not specified a variable

(OT) Re: Getting error multiple values in where conditon. (SQL)
by LanX (Saint) on Oct 13, 2017 at 16:19 UTC
    Not a Perl question, your SQL is broken.

    You need to provide the tested field after WHERE, indicated with <*> in where <*> in

    And please better use placeholders!

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!