-1

Note: I have corrected the variable differences and it does print the query from the first set but it returns nothing from the second set. If I use the second set only it works.

In the code below, I have some_array which is array of array the array contains text like name. So @some_array= ([sam, jon, july],[Mike, Han,Tommy],[angie, sita, lanny]); Now when I querying the list like 'sam jon july' first and 'mike han tommy' . Only the execute return the result from the first list others is undef. I don't know why any help will be appreciated.

my $pointer;
my $db = $db->prepare_cached("
        begin
                :pointer := myFun(:A1);
        end;
                ") or die "Couldn't prepare stat: " . $db->errstr;
$db->bind_param_inout(":pointer",\$pointer,0,{ ora_type => ORA_RSET });

for (my $i=0; $i < @some_array ; $i++) {
        my @firstarray = @{$some_array[$i]};
        my $sql = lc(join(" ", @firstarray));
        print "<pre>$sql</pre>\n";
        $db->bind_param(":A1",$sql);
        $db->execute();
        print "<pre>".Dumper($db->execute())."</pre>\n";
 }
mysteriousboy
  • 159
  • 1
  • 7
  • 20
  • This can't possibly be your real code, can it? Why are `@sql` and `$sql` initialized but not used, while `@query` and `$query` are used but not initialized? What are `$db`, `$dbh`, and `$sdh` and why does it seem like they are used so inconsistently? In the future, please make a better effort to post code that compiles, runs, and demonstrates the issue you are having. – mob Mar 18 '13 at 22:24
  • I am sorry for the variable differences, I have corrected it. Also it does prints the result but for the first set only second set returns undef. If I use the second set as first then it will return second set only. So the problem is its returning the first set only. – mysteriousboy Mar 19 '13 at 00:40

1 Answers1

2

Just like everyone told you on the last question you asked, initialize your array with parentheses, not nested brackets.

@some_array= ([sam, jon, july],[Mike, Han,Tommy],[angie, sita, lanny])

not

@some_array= [[sam, jon, july],[Mike, Han,Tommy],[angie, sita, lanny]]

You would also benefit tremendously from including

use strict;
use warnings;

at the top of all of your programs. That would catch the strange way you are trying to initialize @some_array, and it would catch your inconsistent usage of @sql and @query. update and $sdh and $db and $dbh.

Community
  • 1
  • 1
mob
  • 117,087
  • 18
  • 149
  • 283