Professional Documents
Culture Documents
ASSIGNMENT 3 Dbms APURBA
ASSIGNMENT 3 Dbms APURBA
1.(SOLUTION)
1. DECLARE
2. N NUMBER;
3. M NUMBER;
4. BEGIN
5. DBMS_OUTPUT.PUT_LINE('ENTER A NUMBER');
6. N:=&NUMBER;
7. DBMS_OUTPUT.PUT_LINE('ENTER A NUMBER');
8. M:=&NUMBER;
9. IF N<M THEN
10. DBMS_OUTPUT.PUT_LINE(''|| N ||' IS GREATER THAN '|| M
||'');
11. ELSE
12. DBMS_OUTPUT.PUT_LINE(''|| M ||' IS GREATER THAN '|| N
||'');
13. END IF;
14. END;
15. /
2.(SOLUTION)
1. IN parameter
It indicates that the parameter will accept a value from the user.
2. Out parameter
It indicates that the parameter will return a value to the user.
3. IN OUT
It indicates that the parameter will either accept a value from the user or return a
value to the user.
1. DECLARE
2. a number;
3. PROCEDURE squareNum(x IN OUT number) IS
4. BEGIN
5. x := x * x;
6. END;
7. BEGIN
8. a:= 2;
9. squareNum(a);
10. dbms_output.put_line(' Square of (2): ' | | a);
11.END;
12./
Output:
Square of (2): 4
3.(SOLUTION)
CREATEORREPLACEPROCEDUREprocOneINOUTParameter(genericParam
INOUT VARCHAR2)
IS
BEGIN
genericParam :='Hello'||genericParam;
END;
/
Copy
Run it
DECLARE
genericParam VARCHAR2(100) :='Apurba Ghosh';
BEGIN
procOneINOUTParameter(genericParam);
DBMS_OUTPUT.PUT_LINE(genericParam);
END;
/
Copy
Output