如何在Oracle 18c中通过用户定义的过程访问HR模式对象?

问题描述 投票:0回答:1

我已经给出了尝试创建过程为[[user1时得到的代码和错误消息。我尝试在Oracle XE 18c的示例hr模式中访问employee表。我可以知道如何通过用户定义的过程访问hr模式对象吗

CREATE OR REPLACE PROCEDURE proc_1 IS v_name hr.employees.first_name%TYPE; v_num NUMBER; BEGIN SELECT first_name INTO v_name FROM hr.employees WHERE employee_id=100; v_num:=5; DBMS_OUTPUT.PUT_LINE('test'||v_name); DBMS_OUTPUT.PUT_LINE(v_num); END; /
警告:创建过程时出现编译错误。

SQL> show errors Errors for PROCEDURE PROC_1: LINE/COL ERROR -------- ----------------------------------------------------------------- 2/8 PL/SQL: Item ignored 2/8 PLS-00201: identifier 'HR.EMPLOYEES' must be declared 5/1 PL/SQL: SQL Statement ignored 5/39 PL/SQL: ORA-00942: table or view does not exist 7/1 PL/SQL: Statement ignored 7/38 PLS-00320: the declaration of the type of this expression is incomplete or malformed

oracle plsql procedure
1个回答
0
投票
您将需要向用户user1授予对HR对象的访问权限。

已连接为用户HR:

grant select on employees to user1;

© www.soinside.com 2019 - 2024. All rights reserved.