例程xxx的OUT或INOUT参数1不是触发器之前的变量或NEW伪变量 [英] OUT or INOUT argument 1 for routine xxx is not a variable or NEW pseudo-variable in BEFORE trigger
本文介绍了例程xxx的OUT或INOUT参数1不是触发器之前的变量或NEW伪变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
找不到解决方案. 我有以下存储过程:
Can't find the solution. I'm having the following stored procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_process_upload_log`(
inout prm_upload_id int,
prm_location_id integer,
prm_week_start integer,
prm_error_code integer,
prm_last_attempt_date integer,
prm_error_log_url varchar(256))
BEGIN
select null from dual;
-- real impementation is ommited, it's not an issue, im sure
end
以及相应的php代码:
and corresponing php code:
function update_log($conn, $upload_id, $location_id, $errcode, $att_date, $err_url) {
$week = 1;
$sql = "call sp_process_upload_log (:p0,:p1,:p2,:p3,:p4,:p5);";
try {
$stmt = $conn->prepare($sql);
$stmt->bindParam(':p0', $upload_id, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 4000);
$stmt->bindValue(':p1', $location_id);
$stmt->bindValue(':p2', $week);
$stmt->bindValue(':p3', $errcode);
$stmt->bindValue(':p4', $att_date);
$stmt->bindValue(':p5', $err_url);
if ( ! $stmt->execute() ) {
post_msg ("PDO Error: ".var_dump($stmt->errorInfo())."\n");
return false;
}
} catch (PDOException $e) {
post_msg ("Exception: " . $e->getMessage() . "\n");
return false;
}
return $upload_id;
}
//$conn variable is assigned with db connection resource properly
$upload_id = update_log($conn, false, 1, false, time(), "someurl");
失败,并显示以下错误:
It fails with the error:
array(3) {
[0]=>
string(5) "42000"
[1]=>
int(1414)
[2]=>
string(125) "OUT or INOUT argument 1 for routine hex_tvdb.sp_process_upload_log is not a variable or NEW pseudo-variable in BEFORE trigger"
}
即使在MySQL查询浏览器中尝试调用该存储过程时,也遇到相同的错误.
Even when trying to call for that stored procedure in MySQL Query Browser getting the same error.
推荐答案
您看到此注释了吗 http://forums.mysql.com/read.php ?98,167022,222800#msg-222800 .
Did you see this comment http://www.php.net/manual/en/pdo.prepared-statements.php#101993 ? See also http://forums.mysql.com/read.php?98,167022,222800#msg-222800.
这篇关于例程xxx的OUT或INOUT参数1不是触发器之前的变量或NEW伪变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文