Home > database >  Oracle stored procedures simple newbie on the road is applied to solve
Oracle stored procedures simple newbie on the road is applied to solve

Time:09-30

Write a stored procedure: input students student number, if the student age is more than 18 years old, is displayed "adult", if under 18, it shows "minor"

CodePudding user response:

Yang Ge, I know it's you, where to go? ~!

CodePudding user response:

 CREATE OR REPLACE PROCEDURE SP_NL (in_xh IN an XSB, XH % TYPE) 
AS
I_NL an XSB. NL % TYPE;
V_SQLSTMT VARCHAR2 (300);
The BEGIN
='SELECT V_SQLSTMT: NL FROM EMP WHERE XH=: IN_XH';
The EXECUTE IMMEDIATE V_SQLSTMT
INTO I_NL
USING in_xh;
IF I_NL & gt; 18 THEN
DBMS_OUTPUT. PUT_LINE (' adult ');
The ELSE
DBMS_OUTPUT. PUT_LINE (' minor ');
END;
- the call
DECLARE

The BEGIN
SP_NL (& amp; Xh);
END;
  • Related