[Translated from mos] Create synonym and mossynonym for table partition

Source: Internet
Author: User

[Translated from mos] Create synonym and mossynonym for table partition

Reference:

How to Create a Synonym on a Table Partition (Doc ID 119805.1)

 

How to Create a Synonym on a Table Partition:=============================================You cannot directly create a synonym on a table partition by specifying the partition name and table name with the CREATE SYNONYM command.  You have to create a view on the partition, and then create a synonym on the view.  This is a two-step method instead of a single-step method.Follow the steps in this example to create the synonym: $ sqlplus scott/tiger SQL> create table emp_pt      ( empno number primary key,        ename varchar2(30))      partition by range (empno)      ( partition p8000 values less than (8001),        partition p9000 values less than (9001),        partition p10000 values less than (10001),        partition pothers values less than (99999999)); SQL> insert into emp_pt      select empno, ename from emp;        --- Populated the partition table EMP_PT with existing        --- data from the EMP table. SQL> commit; SQL> select * from emp_pt;      EMPNO ENAME      ----- -----------------      7369  SMITH      7499  ALLEN      7521  WARD      7566  JONES      7654  MARTIN      ...      9999  ANDY SQL> select * from emp_pt partition (p8000);      EMPNO ENAME      ----- ---------------------      7369  SMITH      7499  ALLEN      7521  WARD      7566  JONES      7654  MARTIN       ...      7934  MILLER SQL> create view emp_pt_p8000 as select * from emp_pt partition (p8000); SQL> desc emp_pt_p8000       Name                                Null?    Type      ----------------------------------- ------ -----------         EMPNO                                       NUMBER      ENAME                                       VARCHAR2(30) SQL> create synonym p8000 for emp_pt_p8000; SQL> desc p8000           Name                                Null?    Type      ----------------------------------- ------ -----------         EMPNO                                       NUMBER      ENAME                                       VARCHAR2(30)    SQL> select * from p8000;     EMPNO ENAME     ----- ------------------------------     7369 SMITH     7499 ALLEN     7521 WARD     7566 JONES     7654 MARTIN     ...     7934 MILLER SQL>


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.