The following articles mainly use relevant Code to introduce the actual application solution for creating and calling Oracle procedure in pl/SQL, if you want to create Oracle procedure in pl/SQL and call it, the following articles will provide you with relevant knowledge points.
- Create table
- create table A
- (
- USERID NUMBER(38),
- PWD VARCHAR2(30)
- )
- tablespace USERS
- pctfree 10
- initrans 1
- maxtrans 255
- storage
- (
- initial 64K
- minextents 1
- maxextents unlimited
- );
Create procedure
- create or replace procedure up_sel(cur_test out sys_refcursor)
- is
- begin
- open cur_test for
- select * from a;
- end;
Delete stored procedure
- drop procedure up_sel
Submit
- commit
Execute procedure in PL/SQL
- file-->>new -->>test window
- begin
- Call the procedure
- up_sel(cur_test => :cur_test);
- end;
In variable, enter the defined Cursor name cur_test, Type the Cursor Type Cursor, and click... you can also right-click the stored procedure and click TEST,
Stored Procedure for deleting data
- create or replace procedure up_del
- (userid in varchar2)
- is
- begin
- delete from a where USERID=userid;
- end;
Enter the value to be passed in the value.
Add data
- create or replace procedure up_add
- (
- userid in varchar2,
- pwd in varchar2
- )
- is
- begin
- insert into a(USERID,PWD) values(userid,pwd);
- commit;
- end;
Run
- declare
- begin
- up_add(11,'222');
- end;
This article describes how to create and call Oracle procedure in pl/SQL. We hope this will help you in this regard.