I am an Oracle enthusiast. The following content is my personal summary of the Oracle stored procedure, including the creation of the stored procedure and the practical application of variable assignment, the following is a description of the specific content of the article. I hope you will gain some benefits.
1. Create a stored procedure
- create or replace procedure test
(var_name_1 in type,var_name_2 out type) as
Declare variables (variable name and variable type)
- begin
Execution body of the Oracle Stored Procedure
- end test;
Print the input time information
- E.g:
- create or replace procedure test(workDate in Date) is
- begin
- dbms_output.putline('The input date is:'
||to_date(workDate,'yyyy-mm-dd'));
- end test;
2. Variable assignment
Variable name: = value;
- E.g:
- create or replace procedure test(workDate in Date) is
- x number(4,2);
- begin
- x := 1;
- end test;
3. Judgment statement
If comparison then begin end; end if;
- E.g
- create or replace procedure test(x in number) is
- begin
- if x >0 then
- begin
- x := 0 - x;
- end;
- end if;
- if x = 0 then
- begin
- x: = 1;
- end;
- end if;
- end test;
The above content is a summary of the Oracle stored procedure, hoping to help you in this regard.