Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: "ALTER SYNONYM"?

Re: "ALTER SYNONYM"?

From: Ron Thomas <rthomas_at_hypercom.com>
Date: Mon, 02 Jul 2001 11:30:10 -0700
Message-ID: <F001.0033F415.20010702103605@fatcity.com>

The problem with this would be any dependent objects on the view would need to be recompiled
whenever the view was created. How about a synonym to a periodically recreated view?

Ron.
rthomass_at_hypercom.com
ron_at_karaoke-time.com
"Karaoke: Japanese for migraine."

                                                                                       
                        
                    Jim.Conboy_at_tr                                                      
                        
                    w.com                To:     ORACLE-L_at_fatcity.com                  
                        
                    Sent by:             cc:                                           
                        
                    root_at_fatcity.        Subject:     Re: "ALTER SYNONYM"?             
                        
                    com                                                                
                        
                                                                                       
                        
                                                                                       
                        
                    07/02/01                                                           
                        
                    08:35 AM                                                           
                        
                    Please                                                             
                        
                    respond to                                                         
                        
                    ORACLE-L                                                           
                        
                                                                                       
                        
                                                                                       
                        




Can you use a view instead?

SVRMGR> create table temp1 (temp1 varchar2(1)); Statement processed.
SVRMGR> create table temp2 (temp1 varchar2(1)); Statement processed.
SVRMGR> insert into temp1 values ('a');
1 row processed.
SVRMGR> insert into temp1 values ('a');
1 row processed.
SVRMGR> insert into temp1 values ('a');
1 row processed.
SVRMGR> insert into temp1 values ('a');
1 row processed.
SVRMGR> insert into temp2 values ('b');
1 row processed.
SVRMGR> insert into temp2 values ('b');
1 row processed.
SVRMGR> insert into temp2 values ('b');
1 row processed.
SVRMGR> create or replace view temp as select * from temp1; Statement processed.
SVRMGR> select * from temp;
T
-
a
a
a
a
4 rows selected.
SVRMGR> create or replace view temp as select * from temp2; Statement processed.
SVRMGR> select * from temp;
T
-
b
b
b
3 rows selected.
SVRMGR> Maybe some unwanted overhead with the view, but it might help out.

Jim

>>> osterber_at_fas.harvard.edu 06/30/01 04:56PM >>>
Is there a way to do what would be an ALTER SYNONYM?

I've got a synonym created that rotates between pointing to two different tables. Sometimes it points to TABLE_A, sometimes to TABLE_B. (This is so that behind the scenes, I can truncate and reload TABLE_A, and then swap, etc. so the table "never disappears".)

However, when I want to switch the SYNONYM from pointing to TABLE_A to pointing to TABLE_B, the only way is to:

drop synonym table_syn;
create synonym table_syn for table_b;

Is there a way to make that instantaneous for the database? If someone does a select at the exact instant between those two commands, it'll error out, because the table "won't exist".

-Rick

+--------------------------------------------------------------------------+
|                 Rick Osterberg   osterber_at_fas.harvard.edu                |
|         Database Applications Specialist     FAS Computer Services       |
+--------------------------------------------------------------------------+

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Rick Osterberg
  INET: osterber_at_fas.harvard.edu

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ron Thomas
  INET: rthomas_at_hypercom.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jul 02 2001 - 13:30:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US