The question is fairly simple. I just couldn't locate the solution so I'm asking, Here is the contents of a *.sql file:
select @max_command_idx=max(command_idx)+1 from command;
insert into command values(3,0,@max_command_idx+1 ,"sub","ctrlr",1,0,"plan",0);
insert into command values(4,1,@max_command_idx+1 ,"sub","ctrlr",1,0,"pla1n",0);
when i executed the script, i expected @max_command_idx to be a fixed value.which means it should substitute "same" value in both of the subsequent insert statements. But it didn't do that. what it did was to give me new value of max_command_idx for each insert statement. why is that? and how may i solve it? Thank you