Re: How do you use Aliases?
Shai Berger <shai-9mtU2oJkgntWk0Htik3J/[email protected]> Wed, 10 Jun 2015 01:02:12 +0300
| Newsgroups | gmane.comp.python.db.cx-oracle |
|---|---|
| Organization | Platonix Joint Ventures |
| Message-ID | <[email protected]> |
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) < > > [email protected]> wrote: > > Have you tried > > > > 'SELECT EMPLID AS UID FROM TABLE WHERE EMPLID=:emplid' > > > > > > > > *From:* Jay [mailto:[email protected]] > > *Sent:* Tuesday, June 09, 2015 3:49 PM > > *To:* cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > > *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-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users ------------------------------------------------------------------------------