On Jul 9, 2015, at 9:31 AM, Vamsi Krishna Reddy -T (vamsredd - TATA CONSULTANCY SERVICES LIMITED at Cisco) <vamsredd(at)cisco(dot)com> wrote:
> 1. Insert a row to a table , using cursor.execute()
> 2. To fetch the row id of the above inserted data, we are using cursor.execute() to execute a sql command which fetches the max ‘id’ from the table (id is a column in the table which gets incremented on each insert)
Don't do it that way. Use the RETURNING clause on INSERT to get the inserted value.
--
-- Christophe Pettus
xof(at)thebuild(dot)com