Re: [newbie] Get ID from previous INSERT?
Posted by:
John Doe
Date: February 15, 2023 08:47AM
Done:
=========
CREATE TEMPORARY TABLE dummy (id MEDIUMINT NOT NULL AUTO_INCREMENT,name CHAR(30) NOT NULL,PRIMARY KEY (id));
INSERT INTO dummy (name) VALUES ('blah');
SET @id=LAST_INSERT_ID();
SELECT @id;
INSERT INTO dummy (name) VALUES (@id);
SELECT * FROM dummy;
DROP TABLE dummy;
=========
Subject
Written By
Posted
February 15, 2023 07:42AM
Re: [newbie] Get ID from previous INSERT?
February 15, 2023 08:47AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.