2009年2月27日星期五

Re: [fw-db] Column ambiguously defined

I don't use Oracle, but when I get 'ambigious columns' it means that you
select 2 columns with the same name in your select. So do the tables
EAI_TA_INDIVIDUS and EAI_TA_AFFECTATIONS have a same column name? e.g. id or
something?


Thomas VEQUAUD wrote:
>
> 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
>
>


-----
visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
--
View this message in context: http://www.nabble.com/Column-ambiguously-defined-tp22248675p22249199.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: