pl/sql 编程入门

 1、简单的存储过程

CREATE OR REPLACE PROCEDURE testprocedure(name IN VARCHAR2(200))
IS
var1 varchar2(50) :='aaaaaa';//变量申明
var2 varchar2(50):='bbbbbb';
BEGIN
DBMS_OUTPUT.put_line(name || ' var1:' ||var1 || 'var2:' || var2);
END;


2创建游标

CREATE OR REPLACE PROCEDURE testprocedure
IS
name varchar2(200):='aa';
password varchar2(200):='bb';
begin
cursor cur is select username,password from users;
open cur;
loop
fetch cur into name,password;
exit when cur%NOTFOUND;
dbms_output.put_line(name);
end loop;
end;

你可能感兴趣的:(编程,存储)