I am for this but this will trigger a migration in existing Oracle
installations and they may break.

All in favor? Against?

Massimo

On Apr 6, 5:36 am, SergeyPo <ser...@zarealye.com> wrote:
> However migrations still do not work in Oracle, namely: when you have
> string or text (varchar2/nvarchar2 or clob/nclob) field in a table and
> want to modify it, e.g. change length, you get the error:
>
> Traceback (most recent call last):
>   File "c:\web2py\gluon\restricted.py", line 98, in restricted
>     exec ccode in environment
>   File "c:/web2py/applications/advantage/models/db.py", line 76, in
> <module>
>     SQLField('kind', 'string'),
>   File "c:\web2py\gluon\sql.py", line 860, in define_table
>     raise e
> DatabaseError: ORA-00911: bad symbol
>
> Web2py code snippet:
>
> #BEFORE:
> db.define_table('phones',
>     SQLField('phone', 'string', length=32),
>     SQLField('header', db.headers),
>     SQLField('type', 'integer'),
>     SQLField('kind', 'string'),
> )
>
> #AFTER (want to make length =100, migration)
> db.define_table('phones',
>     SQLField('phone', 'string', length=100),
>     SQLField('header', db.headers),
>     SQLField('type', 'integer'),
>     SQLField('kind', 'string'),
> )
>
> SQL.LOG shows:
>
> timestamp: 2009-04-06T14:27:33.031000
> ALTER TABLE phones ADD phone__tmp NVARCHAR2(100);
> UPDATE phones SET phone__tmp=phone;
> ALTER TABLE phones DROP COLUMN phone;
> ALTER TABLE phones ADD phone NVARCHAR2(100);
> UPDATE phones SET phone=phone__tmp;
> ALTER TABLE phones DROP COLUMN phone__tmp;
>
> There are no obvious bad symbols here. The only workaround I have
> found for now is manual removing the field from the table and running
> a 'migration'. This makes me suspect that '__tmp' part of name is
> bad...
>
> On 6 апр, 14:22, SergeyPo <ser...@zarealye.com> wrote:
>
> > One problem resolved: "ProgrammingError: LOB variable no longer valid
> > after subsequent fetch "
> > this error can be eliminated. In gluon/sql.py modify SQL_DIALECTS for
> > oracle: make
> > 'string': 'NVARCHAR2(%(length)s)',
> > 'text': 'NCLOB',
>
> > instead of
> > 'string': 'VARCHAR2(%(length)s)',
> > 'text': 'CLOB',
>
> > Reason of cx_Oracle error while fetching UTF-encoded data from
> > database is, that Oracle can output national symbols only for
> > NVARCHAR2 and NCLOB data types, VARCHAR2 and CLOB are intended only
> > for ASCII. Since we are all multinational and Python encourages us all
> > to use UTF-8 please, Massimo, consider changing these datatypes in
> > Oracle dialect! With this patch all basic operations including web2py
> > admin pages start to work.
>
> > On 1 апр, 19:48, "A. C. Censi" <acce...@gmail.com> wrote:
>
> > > *
>
> > > ORA-00911:*invalid character*Cause:*identifiers may not start with any 
> > > ASCII
> > > character other than letters and numbers. $#_ are also allowed after the
> > > first character. Identifiers enclosed by doublequotes may contain any
> > > character other than a doublequote. Alternative quotes (q'#...#') cannot 
> > > use
> > > spaces, tabs, or carriage returns as delimiters. For all other contexts,
> > > consult the SQL Language Reference Manual.
>
> > > Error:
> > > ORA-00911: invalid character
>
> > > Cause:
> > > You tried to tried to execute an SQL statement that included a special
> > > character.
>
> > > Action:
> > > The options to resolve this Oracle error are:
>
> > >    1. This error occurs when you try to use a special character in an SQL
> > >    statement. If a special character other than $, _, and # is used in 
> > > the name
> > >    of a column or table, the name must be enclosed in double quotations.
> > >    2. This error may occur if you've pasted your SQL into your editor from
> > >    another program. Sometimes there are non-printable characters that may 
> > > be
> > >    present. In this case, you should try retyping your SQL statement and 
> > > then
> > >    re-execute it.
> > >    3. This error occurs when a special character is used in a WHERE
> > > clause<http://www.techonthenet.com/sql/where.php>and the value is not
> > > enclosed in single quotations.
>
> > >  For example, if you had the following SQL statement:
>
> > > SELECT * FROM suppliers
> > > WHERE supplier_name = ?;
>
> > > You would receive the following error message:
>
> > > ORA-00911: invalid character
> > > You could correct this error by enclosing the ? in single quotations as
> > > follows:.
>
> > > SELECT * FROM suppliers
> > > WHERE supplier_name = '?';
>
> > > From the Oracle side, ORA-00911 happens, as explained above, because of an
> > > invalid char in statements. It is not an invalid symbol!.
>
> > > I hope that this help to isolate the error.
>
> > > A. C. Censi
>
> > > On Wed, Apr 1, 2009 at 11:52 AM, mdipierro <mdipie...@cs.depaul.edu> 
> > > wrote:
> > > > ORA-00911 error (bad symbol!)
>
> > > --
> > > A. C. Censi
> > > accensi [em] gmail [ponto] com
> > > accensi [em] montreal [ponto] com [ponto] br
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to