Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7970269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:22:18+00:00 2026-06-04T07:22:18+00:00

I recently start playing with stored procedures for db2(one day ago) and I manage

  • 0

I recently start playing with stored procedures for db2(one day ago) and I manage to create very simple SP that worked fine when I tested them in the iAccess Navigator. Now Im trying to call the SP from my model but Im getting errors back and Im not sure how to get the return variable. Here is some code

here is my SP

drop procedure schema.test_ac ;
CREATE PROCEDURE schema.test_ac (IN a int, in b int, out c int)
LANGUAGE SQL
BEGIN
    set c=b+a;
END; 

here is the php code

public function storePro(){
    $queryStr = "call test_ac (1,1,?)";

        $stmt = $this->db->query($queryStr);
        print_r($stmt->fetchAll());
}

any help will be nice Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:22:19+00:00Added an answer on June 4, 2026 at 7:22 am

    Zend_Db may have an issue when handling DB2 stored procedures. I’ll try to get that fixed in ZF 2.0. However, today you can run your example successfully using the base ibm_db2 driver functions. I tested this on a v7.1 IBM i system:

    // get actual db2 resource from ZF object
    $dbConn = $this->db->getConnection();
    
    if (!$dbConn) {
        die("could not get connection");
    }
    
    $queryStr = "call test_ac (?, ?, ?)";
    
    $stmt = db2_prepare($dbConn, $queryStr);
    
    if (!$stmt) {
        die ("Could not prepare statement. " . db2_stmt_error());
    }
    
    // set values to be bound. All three variables must be created.
    $in1 = 1;
    $in2 = 2;
    $out1 = 0; // irrelevant but must provide
    
    db2_bind_param($stmt, 1, "in1", DB2_PARAM_IN);
    db2_bind_param($stmt, 2, "in2", DB2_PARAM_IN);
    db2_bind_param($stmt, 3, "out1", DB2_PARAM_OUT);
    
    $result = db2_execute($stmt);
    
    if ($result) {
        // success!
        echo "value of output var: $out1";
    
    } else {
    
        die("Execute failed: " . db2_stmt_error($stmt));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Start thread with member function I have recently been playing around with
I have recently noticed that a lot of JavaScript files on the Web start
I got into django recently and start playing around with the tutorials & documentation
I recently observed a very weird problem with MediaPlayer playing an mp3 file. I'm
I recently came upon the scary idea that Integer.count loops in Ruby start from
Recently I start playing with OO Perl and I've been creating quite a bunch
I'm a programmer that recently moved to a company where I need to start
The software group I currently work in has recently decided to start documenting our
I recently updated to the new version of XCode and the session start code
I'd like to start by apologizing for my unfamiliarity with Hibernate. I'm only recently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.