如何在oracle过程

时间:2018-01-27 12:16:55

标签: java php oracle pdo oracle11g

我的程序:

 $sql = "Begin VMS_REFUEL_PROC_APP_N('0','$p_reqtype','$p_vehiclename','$p_fueltype','$p_unit','$p_unit_price','0','$p_cur_reading','$p_station',:outmsg,'$p_apr_stat','$p_unit_2'); End;";

输出参数消息显示在:outmsg

我的连接返回此变量:

self::$conn = Connection::getInstance(); 

连接类型pdo_oci

1 个答案:

答案 0 :(得分:2)

<?php
$outmsg = '';
$stmt = self::$conn->prepare( "CALL VMS_REFUEL_PROC_APP_N( '0', :p_reqtype, :p_vehiclename, :p_fueltype, :p_unit, :p_unit_price, '0', :p_cur_reading, :p_station, :outmsg, :p_apr_stat, :p_unit_2" );
$stmt->bindParam( ':p_reqtype', $p_reqtype );
$stmt->bindParam( ':p_vehiclename', $p_vehiclename );
$stmt->bindParam( ':p_fueltype', $p_fueltype );
$stmt->bindParam( ':p_unit', $p_unit );
$stmt->bindParam( ':p_unit_price', $p_unit_price );
$stmt->bindParam( ':p_cur_reading', $p_cur_reading );
$stmt->bindParam( ':p_station', $p_station );
$stmt->bindParam( ':outmsg', $outmsg, PDO::PARAM_STR, 4000); 
$stmt->bindParam( ':p_apr_stat', $p_apr_stat );
$stmt->bindParam( ':p_unit_2', $p_unit_2 );

$stmt->execute();

print "result: $outmsg\n";
?>