Working with Other Schema Objects

Nasza ocena:

3
Wyświetleń: 357
Komentarze: 0
Notatek.pl

Pobierz ten dokument za darmo

Podgląd dokumentu
Working with Other Schema Objects - strona 1 Working with Other Schema Objects - strona 2

Fragment notatki:

Working with Other Schema Objects
You can manage other schema objects with SQL Developer, including the following:
■ Sequences
A sequence is a database object that generates unique integers. Each time that you
query the sequence, it increments its current value by a designated amount and
returns the resulting integer. Sequences can be simultaneously queried by multiple
users, and each user receives a unique value. For this reason, using a sequence to
See Also:
Oracle Database Concepts for more information about schema object
dependencies
■ Oracle Database Administrator's Guide for information about
managing object dependencies
Working with Other Schema Objects
8-30 Oracle Database 2 Day DBA
provide the value for a primary key in a table is an easy way to guarantee that the
key value is unique, regardless of the number of users inserting data into the table.
■ Synonyms
A synonym is an alias for any schema object, such as a table or view. Synonyms
provide an easy way to hide the underlying database structure from an
application or a user. Synonyms can be private or public. A public synonym does
not have to be qualified with a schema name, whereas a private synonym does, if
the user referencing the private synonym is not the synonym owner. For example,
consider the following query, issued by a user who has been granted the SELECT
object privilege on the HR.EMPLOYEES table:
SELECT employee_id, salary
FROM hr.employees
ORDER BY salary
Now suppose you create a public synonym named PERSONNEL as an alias for the
HR.EMPLOYEES table, and you grant the SELECT privilege on the HR.EMPLOYEES table
to PUBLIC (all database users). With the public synonym in place, any user can
issue the following simpler query:
SELECT employee_id, salary
FROM personnel
ORDER BY salary
The user who created this query did not need to know the name of the schema
that contains the personnel data.
An additional benefit of synonyms is that you can use the same synonym in a
development database as in the production database, even if the schema names
are different. This technique enables application code to run unmodified in both
environments. For example, the preceding query would run without errors in a
development database that had the EMPLOYEES table in the DEV1 schema, if the
PERSONNEL synonym is defined in the development database to point to the DEV1
schema.
Because a synonym is simply an alias, it requires no storage other than its
... zobacz całą notatkę



Komentarze użytkowników (0)

Zaloguj się, aby dodać komentarz