Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Posts
    27

    Unanswered: When do we receive 0E0

    Hello All,

    I am trying to figure out, the value received when doing: do / selectall_hashref, selectall_arrayref...

    N - number of effected rows
    0 - no record was effected
    undef - ?
    0E0 - ?

    thanks
    Chanan

  2. #2
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    You can just loop through the results, printing and/or counting them.

    This is an example using
    'selectall_hashref':
    Code:
    $sth = $dbh->prepare('SELECT * FROM exmpl_tbl');
    $results = $dbh->selectall_hashref('SELECT * FROM exmpl_tbl', 'id');
    foreach my $id (keys %$results) {
      print "Value of ID $id is $results->{$id}->{val}\n";
    }

    This is different example using 'selectall_arrayref':
    Code:
    my $sql_stmnt = "SELECT * FROM emp WHERE emp_id = ?";
    my $emps = $dbh->selectall_arrayref($sql_stmnt, undef, '1234');
    
    foreach my $emp (@$emps) {
       my ($emp_id, $emp_name) = @$emps;
       print "$emp_id - $emp_name \n";
    }


    hth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •