Note for future searchers & people as foolish as I am to try and use Oracle 
for web site backend.

This happened to me after I finally got the auth.wiki installed in my 
application and the application connected to Oracle. I had to manually 
create the wiki_page, wiki_media, and wiki_tab tables in SQLDEveloper and 
not web2py. My first attempt at creating a wiki page produced this error:
Traceback (most recent call last):
  File "C:\web2py_src_2.1.1\web2py\gluon\restricted.py", line 209, inrestricted
    exec ccode in environment
  File 
"C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.py",line 
240, in <module>
  File "C:\web2py_src_2.1.1\web2py\gluon\globals.py", line 187, in <lambda>
    self._caller = lambda f: f()
  File 
"C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.py",line 
20, in index
    return auth.wiki()
  File "C:\web2py_src_2.1.1\web2py\gluon\tools.py", line 3227, in wiki
    return self._wiki.read(slug)['content'] if slug else self._wiki()
  File "C:\web2py_src_2.1.1\web2py\gluon\tools.py", line 4697, in __call__
    return self.edit(request.args(1) or 'index')
  File "C:\web2py_src_2.1.1\web2py\gluon\tools.py", line 4791, in edit
    formstyle='table2cols',showid=False).process()
  File "C:\web2py_src_2.1.1\web2py\gluon\html.py", line 2135, in process
    self.validate(**kwargs)
  File "C:\web2py_src_2.1.1\web2py\gluon\html.py", line 2075, in validate
    if self.accepts(**kwargs):
  File "C:\web2py_src_2.1.1\web2py\gluon\sqlhtml.py", line 1441, in accepts
    self.vars.id = self.table.insert(**fields)
  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 7808, in insert
    ret =  self._db._adapter.insert(self,self._listify(fields))
  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 1160, in insert
    raise e
DatabaseError: ORA-04098: trigger 'UWAVEDAT.WIKI_PAGE_TRIGGER' is invalid 
and failed re-validation


This was caused because although I created the trigger, the trigger did not 
have the sequence. Oracle does not have authoincrement so you need to 
create a sequence.


   CREATE SEQUENCE  "SCHEMANAME"."WIKI_PAGE_SEQUENCE"  MINVALUE 1 MAXVALUE 
9999999999999999999999999999 INCREMENT BY 1 START WITH 2001 CACHE 2000ORDER  
NOCYCLE 
;



Then create your trigger:


CREATE OR REPLACE TRIGGER "SCHEMANAME"."WIKI_PAGE_TRIGGER" BEFORE
  INSERT ON wiki_page FOR EACH ROW BEGIN
  SELECT wiki_page_sequence.nextval INTO :NEW.id FROM DUAL;
END;
/
ALTER TRIGGER "SCHEMANAME"."WIKI_PAGE_TRIGGER" ENABLE;





I did not have this issue with tables created by web2py.

Regards,
Bill

-- 



Reply via email to