I have a view in my schema that lists the staff information.
I want to calculate the RETIRE_DATE from these two fields: BIRTH_DATE and RETIRE_AGE.
Using the RETIRE_DATE I want to query the staff retiring in a certain period.
Running the query gives me an error
ORA-01741: illegal zero-length identifier
I think it's beacuse I am using the RETIRE_DATE as a column of my view in the query. How do I correct this?
Here's my code:
$start_period = strtotime("-100 week");
$stop_period = strtotime("+100 week");
$query = StaffEmploymentListView::find()
->SELECT([
'PAYROLL_NO',
'BIRTH_DATE',
'RETIRE_AGE',
"ADD_MONTHS(BIRTH_DATE, RETIRE_AGE * 12) AS RETIRE_DATE"]);
$query->andFilterWhere(['>=',$this->RETIRE_DATE, $start_period])
->andFilterWhere(['<=', $this->RETIRE_DATE, $stop_period])
->all();

Here is some information on the error:
ORA-01741: illegal zero-length identifier
Cause: An attempt was made to use two double quotes ("") as an identifier. An identifier must be at least one character long.
Your query has a problem in the way you are quoting the elements. I made a test using oci_connect and oci_execute, and I have no issues.
Perhaps you need to rewrite it as follows, or use the same quotation for all elements. In your case you are quoting some columns with
', and the last part with"