0

I create a procedure for insert statement with some input parameters. But i want to get the inserted id or inserted row from the same procedure.I created using oracle, that is working fine. But i don't know in mysql. And spend more time to get this.i can't.

user3085540
  • 275
  • 3
  • 12
  • 27

1 Answers1

1

MySQL solution:

After running the insert statement, execute

select last_insert_id() into lastId;

Change your SP to include an OUT parameter as

OUT lastId bigint

or simply run

select last_insert_id();

to return a result set by the SP;

Refer to:

Ravinder Reddy
  • 23,692
  • 6
  • 52
  • 82