2009年2月27日星期五

[fw-db] Column ambiguously defined

Hi there,

I've got an exception with an oracle query executed via Zend but it works when I execute it with Toad...
I've wasted 2 hours on that issue, I still don't understand what's wrong and now I can feel anger deeply inside of me!

Here is the method building the query :
    public function        getIndividu($annee, $matricule)
    {
        $select = $this->select();
        $select->setIntegrityCheck(false);
        $select->from(array("INDIVIDUS" => "EAI_TA_INDIVIDUS"));
        $select->joinInner(array("AFF" => "EAI_TA_AFFECTATIONS"), 'INDIVIDUS.IND_ID = AFF.IND_ID');
        $select->where('INDIVIDUS.ANN_ANNEE = ?', (int)$annee);
        $select->where('INDIVIDUS.IND_MATRICULE = ?', $matricule);

        print("QUERY : ".$select."<br>");
       
        return ($this->fetchRow($select));
    }

Here is the query :
SELECT "INDIVIDUS".*, "AFF".*
FROM "EAI_TA_INDIVIDUS" "INDIVIDUS"
INNER JOIN "EAI_TA_AFFECTATIONS" "AFF" ON INDIVIDUS.IND_ID = AFF.IND_ID
WHERE (INDIVIDUS.ANN_ANNEE = 2009) AND (INDIVIDUS.IND_MATRICULE = '17483')


And here is the exception
exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[HY000]: General error: 918 OCIStmtExecute: ORA-00918: column ambiguously defined
(ext\pdo_oci\oci_statement.c:146)' in D:\www\Zend Framework\Zend\Db\Statement\Pdo.php:238

--
Thomas VEQUAUD          http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07

没有评论: