declare
uid number;
sqltext varchar2(1000) := 'CREATE DATABASE LINK TEST CONNECT TO "TEST_USER" IDENTIFIED BY "TestPWD" USING ''TEST_TNS''' ;
myint integer;
begin
select user_id into uid from all_users where username like 'MYUSER';
myint:=sys.dbms_sys_sql.open_cursor();
sys.dbms_sys_sql.parse_as_user(myint,sqltext,dbms_sql.native,UID);
sys.dbms_sys_sql.close_cursor(myint);
end ;
SQL> select host , db_link , owner from dba_db_links where db_link like '%TEST%' ;
DB_LINK OWNER HOST
----------------------------------------------------------------------
TEST MYUSER TEST_TNS
uid number;
sqltext varchar2(1000) := 'CREATE DATABASE LINK TEST CONNECT TO "TEST_USER" IDENTIFIED BY "TestPWD" USING ''TEST_TNS''' ;
myint integer;
begin
select user_id into uid from all_users where username like 'MYUSER';
myint:=sys.dbms_sys_sql.open_cursor();
sys.dbms_sys_sql.parse_as_user(myint,sqltext,dbms_sql.native,UID);
sys.dbms_sys_sql.close_cursor(myint);
end ;
SQL> select host , db_link , owner from dba_db_links where db_link like '%TEST%' ;
DB_LINK OWNER HOST
----------------------------------------------------------------------
TEST MYUSER TEST_TNS
No comments:
Post a Comment