Home > Database > Oracle > What are the parameter types of Oracle stored procedures?

What are the parameter types of Oracle stored procedures?

青灯夜游
Release: 2022-01-25 15:03:03
Original
6206 people have browsed it

The parameter types of oracle stored procedures are: 1. Input type, which means the caller passes the value to the process; 2. Output type, which means the process passes the value to the caller (can return multiple values); 3 , input and output types, which not only means that the caller passes in values ​​to the process, but also means that the process passes values ​​to the caller.

What are the parameter types of Oracle stored procedures?

The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.

Parameter type of oracle stored procedure

1. in: input type, that is, the data is transmitted by the application program Into the Oracle stored procedure, it means that the caller passes the value to the procedure; this parameter is a read-only parameter in the stored procedure, and this type of parameter cannot be modified in the stored procedure;

2. out: Output type, indicating that the process passes the value to the caller.

3. In out: Input and output type, which has both the above characteristics, but is readable and writable; it means that the caller passes a value to the process, and it means that the process passes a value to the caller.

Verify input parameters:

Since the default parameters are of input type, in the above figure, an error is reported when assigning a value to the BAcount parameter.

Solution:

CREATE OR REPLACE PACKAGE body BAWQ_PROC_JGZX IS
PROCEDURE PROC_CSJGZX
(
    pproc VARCHAR2,
    BAcount int :=3
)
IS
 i int :=BAcount;  --定义变量,通过变量替代参数
BEGIN
     i:=BAcount;
dbms_output.put_line(i);
  delete CSJGZX;
  while i>0 LOOP
       i := i-1 ;  
           insert into CSJGZX (CSJGZX_PROC,id,bh,mc,data) values(pproc,SYS_GUID(),SYS_GUID(),'济南',cast(DBMS_RANDOM.VALUE(1,200) as int));
       commit;
   end loop;

END PROC_CSJGZX;
END BAWQ_PROC_JGZX;
Copy after login

Simply put, in is the message passed to the stored procedure when the stored procedure is called. out is the message sent by the stored procedure to the caller. in out means communication between the two.

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of What are the parameter types of Oracle stored procedures?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template