您好:
我參考網路上範例,針對原有的employee block去建立 Program Units (程式單元)。
1.我先於 employee block 上先新增一個item,但屬性 Database Item: No
2.接著於該fmb中,新增一個procedure。
-- Given an Employee's SSN, return the number of other employees
-- in the same department.
PROCEDURE OTHER_DEPARTMENT_MEMBERS (IN_EMPLOYEE_SSN IN NUMBER,
OUT_COUNT_OTHER_MEMBERS OUT NUMBER) IS
TEMP_COUNT NUMBER; -- Placeholder for count
BEGIN
TEMP_COUNT := 0; -- Initialize to 0
-- Try and fill TEMP_COUNT with the count of other
-- Employees in the department
SELECT COUNT(*)
INTO TEMP_COUNT
FROM EMPLOYEE
WHERE EMPLOYEE.DNO =
(SELECT EMPLOYEE.DNO FROM EMPLOYEE WHERE EMPLOYEE.SSN = IN_EMPLOYEE_SSN);
-- See if we got a meaningful result
IF (NVL(TEMP_COUNT, 0) <> 0) THEN
OUT_COUNT_OTHER_MEMBERS := (TEMP_COUNT - 1 );
ELSE
OUT_COUNT_OTHER_MEMBERS := 0;
END IF;
END;
但要compile時,卻出現 "必須宣告 識別項employee"
可是這原版就是使用employee 的範例,為何還需要 宣告?
這該如何解決?
謝謝!
---以下為原始檔,請去掉 .jpg即可
------解决思路----------------------
是不是表名写错了?employees?
------解决思路----------------------
1、检查你是否连接了数据库,未连接时就会报这个错
2、检查你的表在数据库中是否存在,另外你当前连接的用户是否此表所在用户
3、检查拼写