CREATE TABLE student (ID VARCHAR2 (5) Primary key,name VARCHAR2 (+), not null,sex char (2) Check (sex= ' male ' or sex= ' female ')--to Stude NT inserts a piece of data, using a function to verify that the insert is correct create or replace function (f_id in Varchar2,f_name in Varchar2,sex in varchar2) return VARCHAR2 isc_ ID number;beginif f_id is null thenreturn (' number cannot be empty, record is not successfully inserted '), end if;if f_name is null return (' name cannot be empty, record is not successfully inserted '); end if;if S Ex! = ' Male ' or sex!= ' female ' return (' gender limited to male or female, record not successfully inserted ') end If;insert into student values (f_id,f_name,sex); commit; --The commit command of the SQL control transaction is explained in detail: The commit command is used to save the changes made by the transaction to the database, and it saves all the transactions after the last commit or ROLLBACK command to the database. Return (' record inserted successfully '); end dd;================================================================================= Create function Average1 (@cnum char (20))--Creates an argument returns INT--an integer with a return value of type int as BEGIN declare @aver INT--Declares a @aver variable Sele CT @aver =---Query this variable (--assign value to a variable select AVG (score) from XS_KC where course number [email Protected]group by course number) return @aver--return variable End Go Select Dbo.average1 (101)--Drop the function you just created Average1