Re: Create synonym

From: J Davis <josh_d_at_magicnet.net>
Date: 1996/05/01
Message-ID: <4m85hi$ers_at_comet2.magicnet.net>#1/1


Hong Zhou <hzhou_at_icarus.cc.uic.edu> hurled up:

>I have 50 or so tables, now I want to create synonym for them,
>same name as table name. How can I do this without manully one by one?
 

>Thanks in advance.

This solution works in unix..

execute this in sqlplus

spool file.lst
select table_name from all_tables where owner=&TABLEOWNER; (exit sqlplus)
here is the shell script - pass in the owner of the tables set $*
owner=$1
rm -f synonyms.sql
cat file.lst | while read gus
do
t=$gus
echo "create public synonym"$t"for"$owner"."$t";">>synonyms.sql done



The above script will create a sqlplus script to create the public synonyms.

good luck

Josh Davis Received on Wed May 01 1996 - 00:00:00 CEST

Original text of this message