Hello every1,

I want to ENTER Sr.No. and Name in the table using procedures.
My table has attributes
1. Sr.No. (which is my primary key(int datatype))
2. Name (which is not null(string datatype))

I want to write a procedure in mysql to automate the process of entering data in the table using procedures..It would be like ..

--At first table is empty
--CALL the procedure
--After Calling procedure table will have 400,000 (4lacs) entries..


Thanking you in advance
Thank You

Consider the table name "Person"

What exactly is your problem? Go ahead and code a procedure. Come back if it does not work and show us what you did.

create procedure enter_data()
begin
declare x int default 0;
repeat
insert into Person values('AAAA');
x=x+1;
until X>10000
end repeat;
end //

this gives me an error :(

What exactly is your problem? Go ahead and code a procedure. Come back if it does not work and show us what you did.

sorry for late reply...

In collaborative debugging it's deemed good practice not only to state that an error occured but to cite the error message as precisely as possible.
Your code in my test installation gives not only one but two errors.
1) You have to set the delimiter to //
2) x = x + 1 is not a valid SQL statement. Probably you mean set x = x + 1 Also it's deemed good practice to stick to the spelling of variable names. Try this one:

delimiter //
create procedure enter_data()
begin
	declare x int default 0;
	repeat
		insert into Person values('AAAA');
		set x=x+1;
		until x > 10000
	end repeat;
end //

@smantscheff How to enter random name in the table, i m aware of using rand() function but cant get the logic..

You can get random strings with md5(rand())

@smantscheff How to declare global variables:
is it like :
@@var=0;
or
set @@var=0;
or
set global var=0;

This is a new question. Start a new thread with it and close this one.