-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";
 }
2
  • 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. Commented Mar 18, 2013 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. Commented Mar 19, 2013 at 0:40

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I have edited as you said and also used strict and warnings but no help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.