CREATE SEQUENCE MYSEQ
START WITH 1--从1开始
INCREMENT BY 1--每次增长一个
--NOMAXVALUE 没有最大值
MAXVALUE 99999999999999--最大值
MINVALUE 1--最小值
NOCYCLE--一直累加不循环 CYCLE表示循环
NOCACHE--没有缓存
create or replace procedure proc1(p_para1 in varchar2,
p_para2 in varchar2,
p_para3 out varchar2) as
v_name varchar2(20);
begin
v_name := '五娃';
p_para3 := v_name;
p_para3 := 'p_para1 :' || p_para1 || ' p_para2: ' || p_para2 || ' p_para3: ' ||
p_para3 || ' v_name: ' || v_name;
end;
CREATE OR REPLACE PROCEDURE PROC2(
V_ID in VARCHAR2,
V_NAME IN VARCHAR2
)
AS
BEGIN
UPDATE USERINFO SET NAME=V_NAME WHERE ID=V_ID;
END;
CREATE OR REPLACE PROCEDURE PROC3(
V_ID IN VARCHAR2,
V_NAME IN VARCHAR2,
V_AGE IN VARCHAR2,
V_PWD IN VARCHAR2
) AS
BEGIN
INSERT INTO USERINFO
(ID, NAME, AGE, PWD)
VALUES
(V_ID, V_NAME, V_AGE, V_PWD);
END;
--配合游标和包使用
CREATE OR REPLACE PROCEDURE PROC4(
P_CURSOR OUT GETLIST.TEST_CURSOR
) AS
BEGIN
OPEN P_CURSOR FOR
SELECT * FROM USERINFO WHERE AGE <= 10;
END;
CREATE OR REPLACE PROCEDURE PROC5
AS
BEGIN
INSERT INTO USERINFO(ID,NAME,AGE,PWD) VALUES ((SELECT DBMS_RANDOM.RANDOM FROM DUAL ),sysdate,'1','123');
END;
CREATE OR REPLACE PROCEDURE TESTPROC(
V_ID in VARCHAR2,
V_NAME OUT VARCHAR2
)
AS
BEGIN
select name into V_NAME from userinfo where id =V_ID;
END;
CREATE OR REPLACE PACKAGE GETLIST
AS
TYPE TEST_CURSOR IS REF CURSOR;
END;
![](https://images2015.cnblogs.com/blog/1065841/201704/1065841-20170401095517430-1341815999.png)
![](https://images2015.cnblogs.com/blog/1065841/201704/1065841-20170401095616133-1774092675.png)