in reply to Re: Values concatenation for SQL query
in thread Values concatenation for SQL query

I know that works, I would like to know why it wouldn’t accepted the way I am trying to do it, and if there is a way of doing it.
  • Comment on Re^2: Values concatenation for SQL query

Replies are listed 'Best First'.
Re^3: Values concatenation for SQL query
by Corion (Patriarch) on Mar 10, 2015 at 12:33 UTC

    If you have three placeholders, DBI expects three values to be passed in for the three placeholders. There is no way around it.

    Maybe you want a way to extract three values out of your one concatenated string, but you haven't described your problem in a way that I can easily infer that from what you've told us so far.

    If you have the three values separated already, I recommend keeping them separate.

Re^3: Values concatenation for SQL query
by LanX (Saint) on Mar 10, 2015 at 12:36 UTC
    > why it wouldn’t accept

    because with 3 ? exactly 3 scalar arguments are expected and you only pass one

    > if there is a way of doing it.

    As already explained you could pass an array @values which is initialized with something like @values=($a,$b,$c)

    > the way I am trying to do it

    are you probably trying to code like in Tcl where (IIRC) comma space separated strings and arrays belong to the same data type? That's not Perl, sorry.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    PS: Je suis Charlie!