Re: [cx-oracle-users] How do you use Aliases?
Brought to you by:
atuining
From: Shai B. <sh...@pl...> - 2015-06-09 22:21:44
|
I suspect this is because UID is a reserved word. That does not explain why the query would work on plsql or perl and not with Python; but see if it works with a different name, say "UIZ". HTH, Shai. On Wednesday 10 June 2015 00:50:56 Jay wrote: > Yes, > > It also results in "cx_Oracle.DatabaseError: ORA-00923: FROM keyword > not found where expected" > > I know when I run the command from plsql, or perl, I can quote the > Alias "UID" and the query works as expected. But I've tried every way I can > find on the Internet of quoting a string to Oracle with Python, and none of > it seems to work. for some reason, python just refuses to pass that string > to Oracle as a quoted value it would seem. > > -= Jay =- > > > On Tue, Jun 9, 2015 at 3:27 PM, Fawcett, David (MNIT) < > > Dav...@st...> wrote: > > Have you tried > > > > 'SELECT EMPLID AS UID FROM TABLE WHERE EMPLID=:emplid' > > > > > > > > *From:* Jay [mailto:ja...@sc...] > > *Sent:* Tuesday, June 09, 2015 3:49 PM > > *To:* cx-...@li... > > *Subject:* [cx-oracle-users] How do you use Aliases? > > > > > > > > Trying to use an alias with cx_Oracle and nothing I'm trying seems to > > work: > > > > > > > > cursor.execute('SELECT EMPLID "UID" FROM TABLE WHERE EMPLID=:emplid', > > {'emplid':'123456'}): > > > > > > > > fails with: > > > > > > > > cx_Oracle.DatabaseError: ORA-00923: FROM keyword not found where expected > > > > > > > > I've tried every way I can find on the internets to quote/insert that > > Alias, but nothing seems to work. All I'm trying to do is alias EMPLID as > > UID. > > > > > > > > Is this just something that can't be done with this driver?? or Python? > > or?? > > > > > > > > -= Jay =- > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > ----- > > > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |