Home » SQL & PL/SQL » SQL & PL/SQL » Creating a Stored procedure
Creating a Stored procedure [message #19961] Sun, 21 April 2002 22:47 Go to next message
Vidya Anand
Messages: 4
Registered: February 2002
Junior Member
Can we create a Stored procedure which already exists on a server in another server using a DBLink?
Re: Creating a Stored procedure [message #19962 is a reply to message #19961] Sun, 21 April 2002 23:38 Go to previous messageGo to next message
Epe
Messages: 99
Registered: March 2002
Member
Hello,

if you have a DBLink, you can open a session on the remote server, so you can create a stored procedure in that session (as long as you have the rights...).

Success,

epe
Re: Creating a Stored procedure [message #19964 is a reply to message #19961] Mon, 22 April 2002 01:12 Go to previous messageGo to next message
Epe
Messages: 99
Registered: March 2002
Member
It's just the same as on a local system :
1. make a script starting like :
Create or replace procedure...
2. open a sql+ session on the remote DB
3. run the script on that session

Make sure that the stored procedure doesn't exist on the remote DB before you create it. If you are not sure, don't use "create or replace procedure..." but use "create procedure..."

epe
Re: Creating a Stored procedure [message #19968 is a reply to message #19961] Mon, 22 April 2002 05:31 Go to previous messageGo to next message
Vidya Anand
Messages: 4
Registered: February 2002
Junior Member
I want to create a copy of an existing stored procedure without giving the entire procedure text.
i.e,the way we create a copy of a table using the syntax : create table t2 as select * from t1
where t1 is already existing and t2 is created.
I want to know whether we can do the same with procedures, triggers etc.
Re: Creating a Stored procedure [message #19995 is a reply to message #19961] Tue, 23 April 2002 04:41 Go to previous message
hanu
Messages: 21
Registered: March 2002
Junior Member
I think the following script works. Let me whether it works or not.

set head off
set spool proc.sql
select 'create ' from dual
/
select text from user_source@&db_link where
name='&proc_name'
/
spool off
spool procrun
start proc.sql
spool off

Thanks,
Hanu.
Previous Topic: character string buffer too small
Next Topic: Oracle SQL Loader
Goto Forum:
  


Current Time: Fri Apr 19 17:46:00 CDT 2024