What is the output of the following procedure forCustState=’NY’?
PROCEDURE Get_cust_names (CustState IN char(2)) IS
cust_name varchar(25);
CURSOR c1(CustState char(2)) IS
SELECT CustomerName FROM Customer_T
WHERE CustomerState = CustState;
BEGIN
OPEN c1(CustState);
LOOP
FETCH c1 INTO cust_name;
EXIT WHEN C1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Customername: ’||cust_name);
END LOOP;
CLOSE c1;
END;
- The use of %TYPE and %ROWTYPE attributes:
Create the following code:
CREATE PROCEDURE Get_emp_rec (Emp_number IN Employee_T.EmployeeID %TYPE,
Emp_ret OUT Employee_T %ROWTYPE) AS
BEGIN
SELECT EmployeeID, EmployeeName, EmployeeCity,EmployeeState, EmployeeDateHired
INTO Emp_ret
FROM Employee_T
WHERE EmployeeID =Emp_number;
END;
/
Execute this procedure. Comment on %TYPE and %ROWTYPE.
NOTE: CAN YOU PROVIDE THE OUTPUT PF THE FOLLOWING QUESTION?
Answer