0

I have created a stored procedure with following declaration:


DELIMITER $$

DROP PROCEDURE IF EXISTS my_test$$

CREATE PROCEDURE my_test(input_number INT, OUT out_number text)
BEGIN
IF (input_number = 0) THEN
          SET out_number='Errorrrr';
ELSE
          SET out_number='Testing';
END IF;

END$$

DELIMITER ;


Following is my ZF2 code to call this SP:


    $spResponse = 0;
    $prepareStmt = $this->dbGateway->createStatement ();
    $prepareStmt->prepare ( 'CALL my_test(?,?)' );
    $prepareStmt->getResource ()->bindParam ( 1, $spRequest );
    $prepareStmt->getResource ()->bindParam ( 2, $spResponse, \PDO::PARAM_STR, 2 );
    $resultSet = $prepareStmt->execute ();

This code gives me following error:


Syntax error or access violation: 1414 OUT or INOUT argument 2 for routine zf2.my_test is not a variable or NEW pseudo-variable in BEFORE trigger


Can somebody advice where the issue is? Also, How can i retrieve value of "OUT" parameter.

Appreciate your response and help.

  • Try here -> http://stackoverflow.com/questions/1303912/how-can-i-use-a-stored-procedure-in-a-mysql-database-with-zend-framework – Crisp Feb 21 '13 at 16:47
  • I asked [the same question a month ago](http://stackoverflow.com/questions/14416204/accessing-mysql-stored-procedure-output-in-zend-framework-2), but without luck. I am afraid that this question might lead to the same result. Perhaps ask on [#zftalk](http://www.zftalk.com/) if you don't find an answer here. I would be interested to hear if you resolve this as I haven't tried to solve it since I asked my question. – ba0708 Feb 21 '13 at 19:55

1 Answers1

0

This low level code retrieves the base PDO connection object. This way you can work the results in PHP fashion

Community
  • 1
  • 1
Alwin Kesler
  • 1,450
  • 1
  • 20
  • 41