Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Oracle Model Issues

I'm getting a strange error when I attempt to do a simple select all statement with the following model:

public $REQUEST_ID;
public $RTM;    
public $DATE_TYPE;
public $START_DATE;
public $END_DATE;
public $REQUEST_START_DATE;
public $REQUEST_END_DATE;
public $CREATION_DATE;
public $CREATION_USER;
public $STATUS;

//Utility
public function initialize() {
    $this->setSource('O2B_REQUESTS');
    $this->setConnectionService('dbOracle');

    $this->hasMany("REQUEST_ID", "Params", "REQUEST_ID");
}

The error is PDOException: SQLSTATE[HY000]: General error: 936 OCIStmtExecute: ORA-00936: missing expression (ext\pdooci\ocistatement.c:148). Looking at the SQL logger, I find this query (apparently attempting to generate metadata? It's obviously malformed.):

SELECT Z2.* FROM (SELECT Z1.*, ROWNUM DB_ROWNUM FROM ( SELECT  ) Z1 ) Z2 WHERE Z2.DB_ROWNUM BETWEEN 1 AND 0

This occurs whether or not the hasMany relationship is applied.

Any thoughts?

Edit1: Additionally, specifying schema does not help (results in the table not being found). Edit2: Managed to set the schema and have it find the table correctly, but the above error still occurs.

edited Jul '14

I am seeing the same thing... When I don't provide a limit, the select is blank... so.. it's not building the query as it shoud.

btw, i am providing Meta Data manually for mine, and defining the columns since I am using views, not tables.



2.5k
Accepted
answer

I dug into the code, and I believe, with the latest stable release in github, i've identified the issue... They are missing the step where they add the columns and the from clause in the Oracle SQL builder.

https://github.com/phalcon/cphalcon/issues/2658#issuecomment-50626068