First, why use db.executesql rather than a regular DAL query? Second, you 
should move the call to get_new_amcno to the controller function where you 
need to do this insert and set the defaults there -- otherwise, you are 
doing this database query on every single request to the app, even all the 
requests where it is not needed. To set the defaults after the table 
definition, just do:

db.mytable.myfield.default = 'some value'

Anthony

Thanks Anthony for the guidance. I have moved get_new_amcno to the 
controller. I use executesql for calling stored procedure which gives the 
coined amcno as result. For coining of amcno it uses other tables like 
amcdivn, amcsection which I have not defined in my model because I never am 
to do any crud on these tables. So I thought an sp would do fine. Is that 
approach OK? Regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to