1. 程式人生 > >oracle PLSQL建立和呼叫儲存過程

oracle PLSQL建立和呼叫儲存過程

我是在PLSQL的command window裡使用的命令

建表 

drop table students;

 create table students(ID int,userName varchar(100),userpass varchar(100),userAge int);
 insert into students values(1,'Jack','jjjaa',23);
 insert into students values(2,'rose','jjjaa',21);
 insert into students values(3,'lucy','jjjaa',22);
 insert into students values(4,'Tony','jjjaa',24);

 commit;

建立儲存過程

create or replace procedure gogogo(uName in varchar, Age in int) is
begin
  update students set UserAge = UserAge + Age where userName = uName;
  commit;
end gogogo;

/



呼叫儲存過程

exec SP_UPDATE_AGE('jack',1);