declare 声明
into 类似于赋值,
declare
v_rowcount integer;
begin
select count(*) into v_rowcount from dual where exists(
select * from all_tab_columns
where table_name = upper('his_elecagreemodeljour')
and column_name = upper('busin_type')
and owner= upper('crh_his') );
if v_rowcount = 0 then
execute immediate 'ALTER TABLE crh_his.his_elecagreemodeljour ADD busin_type number(10,0) DEFAULT 0 NOT NULL';
end if;
end;
上面的意思就是就是声明一个变量 v_rowcount,将查询到的结果赋值给 v_rowcount。
execute immediate 的意思是执行后面的sql语句。