I have two tables say
table1:
create table Person(
Id int primary key auto_increment,
name varchar(20),
Gender char(1)
);
table2:
create table Details(
Age int,
Phone int(10) primary key,
Address varchar(100)
Id foreign key(Id) references Person(Id),
Name foreign key(Name) references Person(Name)
);
i will have to create a stored procedure to insert data into table:'Details'
create procedure usp_insert(
IN Name varchar(100),
IN Age int,
IN Phone int(10),
IN Address varchar(100),
OUT Id int
)
begin
//want to output the Id as QW001 on inserting the data into the Details table.
insert into Details(Name,Age,Phone,Address) values(name,age,phone,address)
end
How can i achieve the Id in the following format 'QW001' as output parameter. Can someone help me out in correcting the above stored procedure,since i'm new to this. Any help is appreciated. TYIA!