oracle对象类型
Today we will learn how to create Oracle Type Object. If you are working on a large project with lots of tables and data, you might have seen the usage of Packages and DB Objects to perform database specific operations.
今天,我们将学习如何创建Oracle类型对象。 如果您正在处理具有大量表和数据的大型项目,则可能已经看到使用包和数据库对象来执行特定于数据库的操作。
Oracle类型对象 (Oracle Type Object)
Here we will see how to create a database object in Oracle DB.
在这里,我们将看到如何在Oracle DB中创建数据库对象。
CREATE OR REPLACE TYPE "MY_DBA"."EMP_OBJ" AS OBJECT
(empFirstName VARCHAR2(80),
empLastName VARCHAR2(80),
empId NUMBER,
);
GRANT EXECUTE on EMP_OBJ to MY_USER;
Notice that you need to be logged in with MY_DBA user to create the object and MY_USER is the application user that I am providing privilege to execute this package.
请注意,您需要以MY_DBA用户身份登录才能创建对象,而MY_USER是我提供执行该程序包特权的应用程序用户。
From Security point of view, it’s always better to have a DBA user for DDL changes and an application specific user that will have only the required privileges to perform the database operations.
从安全性的角度来看,最好是让DBA用户进行DDL更改,而让特定于应用程序的用户仅具有执行数据库操作所需的特权。
If I don’t separate these accesses, then the application user will have full access to the DB Object/Packages and they can drop it also, mistakenly or may be by a hacker.
如果我不分开这些访问权限,那么应用程序用户将具有对数据库对象/软件包的完全访问权限,他们也可能错误地或由黑客将其删除。
oracle对象类型