快速建立測試資料
begin
for x in 80..90 loop
dbms_output.put_line('' || x);
insert into tbl_user values(x,'mao'||x,5);
end loop;
end;
3.攜帶引數的oracle儲存過程
CREATE or replace PROCEDURE mao_text (id1 number,name1 varchar2,cell number )
is
progname varchar2(40);
ccount number(10);
BEGIN
progname := 'mao_text';
ccount := 0;
--查詢的值放入變數ccount
select count(*) into ccount from tbl_user t where t.id = id1;
--add
IF ccount=0 THEN
insert into tbl_user values(id1,name1,cell);
commit;
else
update tbl_user t set t.name = name1,t.cell = cell where t.id = id1;
commit;
END IF;
END;