Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, senthilkumar.

Asked: June 01, 2001 - 12:52 pm UTC

Last updated: June 01, 2001 - 7:16 pm UTC

Version: 8.1.6

Viewed 1000+ times

You Asked

Hi Tom,

I have created a Table say table-A and created a synonym TableAX.

When I say Truncate table table-A it is truncating without any problem. But if I give Truncate table TableAX (Synonym) it says table or view doesn't exist. I was surprised by this (I never used synonym before in Truncate statement, but this time I need to use synonym in Truncate). When we use synonym in all other place, why not Oracle doesn't allows us to use synonym in Truncate Statement ?

Is it done purposely not to use Synonym in Truncate or is it a bug?

Thanks,

Senthil.

and Tom said...

A synonym can only be used with some commands. See

</code> http://docs.oracle.com/cd/A81042_01/DOC/server.816/a76989/ch4g8.htm#3702 <code>

For DDL, this is specifically:


AUDIT
NOAUDIT
GRANT
REVOKE
COMMENT

so, truncate does not stand alone:

tkyte@TKYTE816> create procedure p as begin null; end;
2 /

Procedure created.

tkyte@TKYTE816> create synonym p_syn for p;

Synonym created.

tkyte@TKYTE816> alter procedure p compile;

Procedure altered.

tkyte@TKYTE816> alter procedure p_syn compile;
alter procedure p_syn compile
*
ERROR at line 1:
ORA-04043: object P_SYN does not exist


tkyte@TKYTE816> exec p;

PL/SQL procedure successfully completed.

tkyte@TKYTE816> exec p_syn;

PL/SQL procedure successfully completed.

is another example....





Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Senthil, June 01, 2001 - 1:38 pm UTC


A reader, June 01, 2001 - 7:16 pm UTC


mani, June 01, 2001 - 7:16 pm UTC


More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library