Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    8

    Question Unanswered: How to create an alias

    Hi,
    I have a table called INVOICE, to access the data I have to enter :

    select * from PEREZ.INVOICE;

    I believe the name PEREZ is of the tablespace(or name of the user that created the table) , but I would like to be able to access directly through.

    select * from INVOICE;

    I think is a question of adding a alias, but I do not know how.
    Any help here,

    Thanks a million,

    Maria Eugenia

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: How to create an alias

    Originally posted by Maria Eugenia
    Hi,
    I have a table called INVOICE, to access the data I have to enter :

    select * from PEREZ.INVOICE;

    I believe the name PEREZ is of the tablespace(or name of the user that created the table) , but I would like to be able to access directly through.

    select * from INVOICE;

    I think is a question of adding a alias, but I do not know how.
    Any help here,

    Thanks a million,

    Maria Eugenia
    PEREZ is a schema name.

    Your problem can be solved when ju create view in your actual schema for example SCOTT.

    1. login to PEREZ and run following SQL
    This is for all privileges:
    GRANT ALL ON INVOICES TO SCOTT

    2. login to SCOTT's schema and run following sql:

    CREATE VIEW INVOICES AS SELECT * FROM PEREZ.INVOICES

    Now when you can run SELECT * FROM INVOICES in the SCOTT's schema.

  3. #3
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: How to create an alias

    Originally posted by ika
    PEREZ is a schema name.

    Your problem can be solved when ju create view in your actual schema for example SCOTT.

    1. login to PEREZ and run following SQL
    This is for all privileges:
    GRANT ALL ON INVOICES TO SCOTT

    2. login to SCOTT's schema and run following sql:

    CREATE VIEW INVOICES AS SELECT * FROM PEREZ.INVOICES

    Now when you can run SELECT * FROM INVOICES in the SCOTT's schema.
    sorry for:
    <snip>
    Now when you can run SELECT * FROM INVOICES in the SCOTT's schema.
    </snip>

    Now you can run SELECT * FROM INVOICES in the SCOTT's schema.

  4. #4
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Hi,

    If you're connecting as SCOTT, and the table is owned by PEREZ then do the following when connected as PEREZ.

    PHP Code:
    grant select,insert,update,delete on INVOICES to SCOTT;
    create synonym SCOTT.INVOICES for PEREZ.INVOICES
    The grant has already been done on your instance (as you can select from it when fully qualified as PEREZ.INVOICES).

    The synonym just tells Oracle that when SCOTT says invoices, he actually means PEREZ.INVOICES.

    Hth
    Bill

  5. #5
    Join Date
    Oct 2003
    Posts
    22

    Re: How to create an alias

    PEREZ is the 'schema' name.

    U do not create an alias or your requirement.
    use a synonym which is a stored database object.

    create synonym syn_name for PEREZ.INVOICES

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •