我有以下插入查询
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语句中。这不是我的情况,我检查了语句,DB(这是oracle)表和所有绑定变量,它们都匹配。
错误上的行号表示它是$ driveable变量。我做了一个检查,这被发送到页面很好。
不知道还有什么地方可以看,所以任何帮助都会很棒。
答案 0 :(得分:19)
你似乎错过了逗号,
:street_of_acc :ph_driving,
应该是,
:street_of_acc, :ph_driving,
答案 1 :(得分:2)
除了@bonCodigos回答,你还没有绑定:driverAddress3
答案 2 :(得分:0)
如果您还有visual studio,并且您正在使用详细信息视图。我建议您重新配置数据源。我收到了ORA-01036错误,而我所要做的就是重新配置我的SQL源代码,并为我正确生成它。对我而言,当我尝试更新数据源时,我没有正确处理原始值。
我也在甲骨文。