8

我有以下插入查询

include("ORCLconfig.php");

$addAclaim = oci_parse($conn, "INSERT INTO claims_accidents (ID, CLAIM_NUMBER, DATE_OF, TIME, LOCATION, PURPOSE, WEATHER, ROAD, STREET_LIGHTS, SPEED_LIMIT, SPEED_PRIOR, SPEED_AT_MOMENT, AIRBAGS, AMBULANCE, SIGNALS, OCCUPANTS, DESCRIPTION, ROAD_LOCATION, PH_DRIVING, NAME_OF_DRIVER, DRIVER_DOB, DRIVER_OCCUPATION, MEDICAL_CONDITIONS, DRIVER_CONVICTIONS, AUTHORISED, DRIVER_ADDRESS1, DRIVER_ADDRESS2, DRIVER_ADDRESS3, DRIVER_ADDRESS4, DRIVER_POSTCODE, DRIVER_TELEPHONE, MATCH, V5_NUMBER, KEY_SETS, OS_FINANCE, VEHICLE_VALUE, VEHICLE_REG, VEHICLE_MAKE, VEHICLE_MODEL, NAMED_DRIVER, FATALITIES, DRIVEABLE) VALUES (null, :claimnum, :date_of_accident, :time_of_acc, :location_of_acc, :purpose, :weather, :road, :lights, :speedLimit, :speedPrior, :speedImpact, :airbags, :ambulance, :signals, :occupants , :accdesc, :street_of_acc :ph_driving, :driverName, :DRIVER_DOB, :driverOccupation, :driverMedical, :driverConvictions, :auth, :driverAddress1, :driverAddress2, :driverAddress3, :driverAddress4, :driverPostcode, :driverTelephone, :match, :v5number, :keySets, :osf, :vehicle_value, :vehicle_reg, :vehicle_make, :vehicle_model, :named, :fatal, :driveable)");

   oci_bind_by_name($addAclaim, ":claimnum", $claimnum);
   oci_bind_by_name($addAclaim, ":date_of_accident", $date_of_accident);
   oci_bind_by_name($addAclaim, ":time_of_acc", $time_of_acc);
   oci_bind_by_name($addAclaim, ":location_of_acc", $location_of_acc);
   oci_bind_by_name($addAclaim, ":purpose", $purpose);
   oci_bind_by_name($addAclaim, ":weather", $weather);
   oci_bind_by_name($addAclaim, ":road", $road);
   oci_bind_by_name($addAclaim, ":lights", $lights);
   oci_bind_by_name($addAclaim, ":speedLimit", $speedLimit);
   oci_bind_by_name($addAclaim, ":speedPrior", $speedPrior);
   oci_bind_by_name($addAclaim, ":speedImpact", $speedImpact);
   oci_bind_by_name($addAclaim, ":airbags", $airbags);
   oci_bind_by_name($addAclaim, ":ambulance", $ambulance);
   oci_bind_by_name($addAclaim, ":signals", $signals);
   oci_bind_by_name($addAclaim, ":occupants", $occupants);
   oci_bind_by_name($addAclaim, ":accdesc", $accdesc);
   oci_bind_by_name($addAclaim, ":street_of_acc", $street_of_acc);
   oci_bind_by_name($addAclaim, ":ph_driving", $ph_driving);
   oci_bind_by_name($addAclaim, ":driverName", $driverName);
   oci_bind_by_name($addAclaim, ":DRIVER_DOB", $DRIVER_DOB);
   oci_bind_by_name($addAclaim, ":driverOccupation", $driverOccupation);
   oci_bind_by_name($addAclaim, ":driverMedical", $driverMedical);
   oci_bind_by_name($addAclaim, ":driverConvictions", $driverConvictions);
   oci_bind_by_name($addAclaim, ":auth", $auth);
   oci_bind_by_name($addAclaim, ":driverAddress1", $driverAddress1);
   oci_bind_by_name($addAclaim, ":driverAddress2", $driverAddress2);
   oci_bind_by_name($addAclaim, ":driverAddress4", $driverAddress4);
   oci_bind_by_name($addAclaim, ":driverPostcode", $driverPostcode);
   oci_bind_by_name($addAclaim, ":driverTelephone", $driverTelephone);
   oci_bind_by_name($addAclaim, ":match", $match);
   oci_bind_by_name($addAclaim, ":v5number", $v5number);
   oci_bind_by_name($addAclaim, ":keySets", $keySets);
   oci_bind_by_name($addAclaim, ":osf", $osf);
   oci_bind_by_name($addAclaim, ":vehicle_value", $vehicle_value);
   oci_bind_by_name($addAclaim, ":vehicle_reg", $vehicle_reg);
   oci_bind_by_name($addAclaim, ":vehicle_make", $vehicle_make);
   oci_bind_by_name($addAclaim, ":vehicle_model", $vehicle_model);
   oci_bind_by_name($addAclaim, ":named", $named);
   oci_bind_by_name($addAclaim, ":fatal", $fatal);
   oci_bind_by_name($addAclaim, ":driveable", $driveable);

   oci_execute($addAclaim, OCI_COMMIT_ON_SUCCESS);

每次我尝试运行此查询时,我都会收到此错误

oci_bind_by_name(): ORA-01036: illegal variable name/number

我做了一些研究,显然这意味着其中一个变量不在 SQL 语句中。这对我来说不是这种情况,我检查了语句、数据库(即 oracle)表和所有绑定变量,它们都匹配。

错误上的行号表明它是 $driveable 变量。我做了检查,这被发送到页面很好。

不知道在哪里看所以任何帮助都会很棒。

4

3 回答 3

21

你好像在这里漏掉了一个逗号,

:street_of_acc :ph_driving,

它应该是,

:street_of_acc, :ph_driving,
于 2013-01-23T13:02:43.463 回答
2

除了@bonCodigos 的回答,你没有约束力:driverAddress3

于 2013-01-23T13:08:54.270 回答
0

如果您还有 Visual Studio 并且正在使用详细信息视图。我建议重新配置您的数据源。我收到 ORA-01036 错误,我所要做的就是重新配置我的 SQL 源,它会为我正确生成它。对我来说,当我尝试更新我的数据源时,我没有正确处理原始值。

我也在甲骨文。

于 2014-11-26T14:12:30.163 回答