Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Creating DB link inside stored procedure
On Thu, 26 Jul 2007 19:34:19 -0000, kathar.km_at_gmail.com wrote:
>I am trying to create DB link from stored procedure. I create a
>procedure like the following.. but when i executed the query i got
>error "ORA-01031: insufficient privileges". When i ran the following
>query,it was working.
>
>create database link TESTING3 connect to user1 identified by "pwd"
>using 'user1.system.COM'
>
>But when i kept it inside Stored procedure,it was not working. It may
>be related with single quotes,but i couldn't fix it. Any help on this
>would be appreciated.
>
>
>CREATE OR REPLACE PROCEDURE PROC1 IS
>BEGIN
>execute immediate 'create public database link TESTING5 connect to
>user1 identified by "pwd" using' ||''''|| 'user1.system.COM'||'''';
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> NULL;
> WHEN OTHERS THEN
> -- Consider logging the error and then re-raise
> RAISE;
>END PROC1;
Does the user have explicit 'create db link' priv (not through a role)
.......
We run Oracle 9iR2,10gR1/2 on RH4/RH3 and Solaris 10 (Sparc)
remove NSPAM to email
Received on Thu Jul 26 2007 - 14:51:53 CDT
![]() |
![]() |