PHP ORA-01745: Invalid host variable / binding name

01745: Invalid hostname / binding warning when running metal-cad code. I'm not sure why this is happening, please help! I feel that it must be something wrong with my attachment, but I don’t see what's wrong with that. My $ Start and $ End variables look like DD-MM-YY. I have listed the PHP code below. Thanks!

PHP:

<?php $year_Echo = '2013'; $yearTruncation = substr($year_Echo, 2); $yearTruncationMinusOne = $yearTruncation-1; $Start = ('1-OCT-'.$yearTruncationMinusOne); $End = ('30-SEP-'.$yearTruncation); echo "Start = ".$Start." End = ".$End." Year Truncation Minus One = ".$yearTruncationMinusOne."<br>"; /*** connect or WFO DB ***/ $db = oci_connect('query','pw','server:1521/view'); if (!$db){ $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $query = "SELECT * FROM db.cooldb WHERE (STATUS = 'ACTIVE' OR STATUS = 'CLOSED') AND NUMBER <> ' ' AND AMENDMENT_DATE_CREATED BETWEEN :start AND :end ORDER BY AMENDMENT_DATE_CREATED DESC"; $runQuery = oci_parse($db, $query); oci_bind_by_name($runQuery, ":start", $Start); oci_bind_by_name($runQuery, ":end", $End); oci_execute($runQuery); while($row = oci_fetch_array($runQuery, OCI_ASSOC+OCI_RETURN_NULLS)) { echo $row['AMENDMENT_DATE_CREATED']." ".$row['TITLE']."<br>"; } ?> 

Error:

 Warning: oci_execute() [function.oci-execute]: ORA-01745: invalid host/bind variable name 
+5
source share
1 answer

The problem is that you are using the oracle reserved words (namely I think): end "is the culprit) for the variable binding name, which is not allowed.

Try changing it to ": finish" or similar, and it should work.

+13
source

Source: https://habr.com/ru/post/1213176/


All Articles