1. stored procedures are a good technique.
2. PSD (PL/SQL Developer) is a good tool that can greatly improve efficiency.
3. Use PSD to connect to the database and start creating the stored procedure:
Create or replace procedure Test_ADD2 (VAR_NAME in VARCHAR2, VAR_SEX out VARCHAR2) is
Begin
IF VAR_NAME = 'yuer' THEN
VAR_SEX: = 'male ';
ELSE
VAR_SEX: = 'female ';
End if;
End Test_ADD2;
Create or replace procedure indicates re-creation when the stored procedure exists, VAR_NAME indicates the parameter name, in indicates the input parameter, and out indicates the output parameter,
VARCHAR2 is a parameter type. Pay attention to the if statement and the semicolon.
4. Run F8 until the compilation is successful.
5. Test the stored procedure:
Create a test window and fill in the test code:
Declare
-- Local variables here
V1 varchar2 (20 );
Begin
-- Test statements here
Test_add2 ('hh ', v1 );
Dbms_output.put_line (v1 );
End;
6. Run
In the DBMS Output window, we can see the v1 value of the Output, which is actually the role of dbms_output.
It is useful to add a group. Many enthusiastic netizens thank them.