Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop and create links

Status
Not open for further replies.

jayjaybigs

IS-IT--Management
Jan 12, 2005
191
CA
Hello, I have several links in a database.

My object is to:
1)Output each link.
2)drop the link
3)re-create the link with a new password.

Here is my effort:
========================

begin

for r in (select owner,db_link,username,host from dba_db_links where owner = 'PUBLIC')

loop

dbms_output.put_line('Link: '||r.db_link||', host: '||r.host||', username: '||r.username);

execute immediate 'drop public database link '||r.db_link';
execute immedaite 'create public database link '||r.db_link' connect to '||r.username identified by
hello12 using '||r.host'

end loop;
end;
/

================
However, this is not working. Please advise.
 
you might get better answers in the correct forum for your particular database (db2? oracle?)

this forum is for ANSI SQL

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top