Question

I have a oci8 module installed with PHP and when using a to_date conversion in my query I get an error. When I use the exact same query in my sql developer it works just fine.

php:

include("db_connection.php");


$query = "select count(distinct mp_eic) kogus, asp
from tellitud_eic
where work_type in ('E63001','E90000')
and wo_issued_meter is not null
and to_date(actual_completion, 'dd.mm.yyyy hh24:mi:ss') < '01.01.2014'
group by asp";


$parseQuery = oci_parse($connection, $query);

$result = oci_execute($parseQuery);

$sqlResultJson = array();


while ($row = oci_fetch_array($parseQuery, OCI_ASSOC+OCI_RETURN_NULLS)) {
    array_push($sqlResultJson, $row);
}

$json = json_encode($sqlResultJson);

echo $json;

error:

Warning:  oci_execute(): ORA-01843: not a valid month in <b>C:\Apache24\htdocs\queries\query_2013_installation_by_asp.php on line 15
Warning:  oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in <b>C:\Apache24\htdocs\queries\query_2013_installation_by_asp.phpon line 
[]

I used one other query with a different to_date format and this one worked (to_date(to_char(to_date(p_kuu, 'mm'), 'MONTH'), 'MONTH');)
so I have no idea whats going on.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top