stored procedures - Return row ID from StoredProcedure MySQL -


i attempting return value of row statement:

insert systemname (systemname) select * (select v_systemname) tmp not exists (     select * systemname systemname = v_systemname ) limit 1; set id = last_insert_id(); 

if insert need return row id, otherwise needs return new row id. tried use last_insert_id() didn't return needed because if didn't insert give wrong result. have idea make work?

http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_last-insert-id

assuming procedure expects row id , no further processing done can try: select last_insert_id();


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -