Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> ORA-01729: database link name expected
Aruns
post May 24 2007, 02:13 AM
Post #1


Member
**

Group: Members
Posts: 22
Joined: 21-August 06
Member No.: 4,866



Hi

I need to fetch values form another db(Its should be hard coded)

So i used bind variable concept

But it throws an error
ORA-01729: database link name expected


declare
var1 varchar2(100);
var2 varchar2(300);
var3 varchar2(3);
begin
var1:='INT.VERL.COM';
var2:='select * from table_part_num@'||':var1'||'where p_code=:var3';
execute immediate var2 using var1,'''||var3||''';
end;


How to pass the link name in exceute immediate
Go to the top of the page
 
+Quote Post
Aruns
post May 24 2007, 02:31 AM
Post #2


Member
**

Group: Members
Posts: 22
Joined: 21-August 06
Member No.: 4,866



QUOTE (Aruns @ May 24 2007, 07:14 AM) *
Hi

I need to fetch values form another db(Its should not be hard coded)in .Using oracle sqlplus

So i used bind variable concept

But it throws an error
ORA-01729: database link name expected
declare
var1 varchar2(100);
var2 varchar2(300);
var3 varchar2(3);
begin
var1:='INT.VERL.COM';
var2:='select * from table_part_num@'||':var1'||'where p_code=:var3';
execute immediate var2 using var1,'''||var3||''';
end;
How to pass the link name in exceute immediate
Go to the top of the page
 
+Quote Post
burleson
post May 26 2007, 02:48 PM
Post #3


Advanced Member
***

Group: Members
Posts: 11,798
Joined: 26-January 04
Member No.: 13



Hi Aruns,

First, ensure that your command works with a variable:

select * from table_part_num@mydb where p_code=1;

Then, de-bug your code to display your :var values with dbms_put_line.

See Dr. Hall's PL/SQL book for PL/SQL debugging tips:

http://www.rampant-books.com/book_2006_1_plsql_tune.htm


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th December 2014 - 06:27 AM