Oracle's Stored Procedure Programming Lecture II: How to Create a Stored Procedure.

Step 1: After connecting to the database, find the "procedures" directory in the "object" window, right-click on the directory, and select the "new" menu to create a stored procedure.

 

 

 

After the interface is created, the stored procedure has no parameters.

 

 Step 2: Write a piece of code to compile the stored procedure.

 Creating and compiling stored procedures has been completed here, the next article will be how to use stored procedures.

 

 

 

Errors you may encounter! ! ! ! ! ! ! !

1. The parameter column part is not processed.


 

 

 

 

2. No code is written in the code area. Solution: write an output statement, or write "null".


 

dbms_output.put_line('Print output statement----------');

 

 

Line 1:
  CREATE OR REPLACE PROCEDURE is an SQL statement that informs the Oracle database to create a stored procedure called test01, overwriting it if it exists;
Line 2:
  The IS keyword indicates that a PL/SQL body will follow.
Line 3:
  The BEGIN keyword indicates the start of the PL/SQL body.
Line 4:
  dbms_output.put_line('print output statement----------'); indicates the print output statement. If there is no content to write a " NULL " PL/SQL statement to indicate that nothing is to be done, this sentence cannot be deleted, because at least one sentence is required in the PL/SQL body;   

Line 5:
  The END keyword indicates the end of the PL/SQL body 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326570580&siteId=291194637