Synonyms and sequences of PL/SQL Basics
PL/SQL: a programming Language combined with a Structured Language (Structured Query Language). It is an extension of SQL and supports multiple data types, such as large objects and Collection types, you can use control statements such as conditions and loops to create stored procedures, packages, and triggers, and add program logic to SQL statement execution, tightly integrated with Oracle servers and Oracle tools, it is portable, flexible, and secure.
Synonym:
/*
Synonym: an alias of an existing object;
Advantages: 1. Simplified SQL; 2. Hiding the Object Name and owner; 3. providing public access to the object
*/
-- Create a private synonym, which can only be accessed in the mode and cannot be the same as the current object
create or replace synonym em for emp;select *from em;drop synonym em;
-- Create a public Synonym that can be accessed by all database users. Of course, other users must have access permissions.
create or replace synonym em for emp;select *from em;drop synonym em;
/*
Sequence: an object used to generate a unique and continuous sequence number. It can be in ascending or descending order.
*/
create or replace synonym em for emp;select *from em;drop synonym em;
-- Query Sequence
Select my_seq.nextval from dual; -- next value of the sequence select my_seq.currval from dual; -- create table person (pid number primary key, pname varchar2 (20 ))