#50555 [NEW]: Cannot retrieve output paramter from stored procedure

From: Date: Tue, 22 Dec 2009 22:09:40 +0000
Subject: #50555 [NEW]: Cannot retrieve output paramter from stored procedure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146001@lists.php.net to get a copy of this message
From:             david dot wright at opticsplanet dot com
Operating system: 2.6.24-24-server
PHP version:      5.3.1
PHP Bug Type:     PDO related
Bug description:  Cannot retrieve output paramter from stored procedure

Description:
------------
I cannot retrieve an output parameter from a stored procedure (in my case
on SQL Server 2005--am using PDO_DBLIB.

Reproduce code:
---------------
PHP Code:
---------------------------------------------------
/** SNIP. Set up a valid $db here! **/
$return_value = 999;
$sth = $db->prepare("EXEC dbo.opsp_Test ?");
$sth->bindParam(1, $return_value, PDO::PARAM_STR |
PDO::PARAM_INPUT_OUTPUT, 4);
$sth->execute();
echo "$return_value\n";

Stored Procedure
--------------------------------------------------
CREATE PROCEDURE opsp_Test 
	@TheOutputValue int OUTPUT
AS
BEGIN
	SET @TheOutputValue = 11
END



Expected result:
----------------
output should be: 11

Actual result:
--------------
Output is 999 ($return_value unchanged)

-- 
Edit bug report at http://bugs.php.net/?id=50555&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=50555&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=50555&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=50555&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=50555&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50555&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=50555&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=50555&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=50555&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=50555&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=50555&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=50555&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=50555&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=50555&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=50555&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50555&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50555&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=50555&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=50555&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=50555&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=50555&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=50555&r=mysqlcfg



Thread (15 messages)

« previous php.bugs (#146001) next »