here’s what I’d like to do in mySQL… I’m getting the feeling that this is simply not feasible, but would love to be wrong…
create procedure foo(IN MYTABLE varchar(50) , IN COLNAME varchar (50), IN MYTYPE varchar(50)) begin IF (select count(*) from information_schema.columns where table_name =MYTABLE and column_name = COLNAME) = 0 THEN alter table MYTABLE add column MYNAME MYTYPE; end; call foo( 'table_foo' , 'column_bar' , 'varchar(100)' );
Don’t know why on Earth you would want it, but it’s possible: