Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORA-01036; illegal variable name/number

I have the following insert query

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);

Everytime i try to run this query i get this error

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

I've done a bit of research and it's apparently it mean that one of the variables is not in the SQL statement. This is not the case for me, I've check the statement, the DB (which is oracle) table and all the bound variables and they all match.

The line number on the error would indicate that it is the $driveable variable. I did a check and this is being sent to the page fine.

Not sure where else to look so any help would be great.

like image 365
jampez77 Avatar asked Jan 23 '13 12:01

jampez77


People also ask

What is Ora 01036 illegal variable name number?

The Oracle error ORA-01036 means that the query uses an undefined variable somewhere. From the query we can determine which variables are in use, namely all that start with @.

What are bind variables?

Bind variables are variables you create in SQL*Plus and then reference in PL/SQL. If you create a bind variable in SQL*Plus, you can use the variable as you would a declared variable in your PL/SQL subprogram and then access the variable from SQL*Plus.


1 Answers

You seem to have missed out a comma here,

:street_of_acc :ph_driving,

It should be,

:street_of_acc, :ph_driving,
like image 140
bonCodigo Avatar answered Sep 19 '22 06:09

bonCodigo