SET linesize 2000;
SET pagesize 1000;
SET long 9999999;
SET ECHO off;
SET FEED off;
SET HEAD off;
SET time off;
COLUMN DDL FORMAT a9999;
exec dbms_metadata.SET_transform_param(dbms_metadata.session_transform,'SQLTERMinATOR',true);
SELECT 
	dbms_metadata.get_ddl('PROCEDURE','KILL_SESSION_FACMUTUO','SYSTEM') "DDL" 
FROM 
	dual;
SPOOL OFF
SET FEED on;
SET HEAD on;
SET time on;

SELECT 'create '||DECODE(U.NAME,'PUBLIC','public ')||'databASe link '||CHR(10)
       ||DECODE(U.NAME,'PUBLIC',Null, U.NAME||'.')|| L.NAME||chr(10)
       ||'connect to ' || L.USERID || ' identified by '
       ||L.PASSWORD||' using ''' || L.host || ''''
       ||chr(10)||';' TEXT
 FROM sys.link$ L, sys.user$ U
WHERE L.OWNER# = U.USER#;


SET lines 200;
SET pages 200;
SELECT 
	'create '
	||decode(owner#,1,'public ',' ')
	||'databASe link '
	||NAME||' connect to '
	||USERID||' identified by values '''
	||password||''' using '''
	||host||''';' 
FROM 
	sys.link$;

hostgator