Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

performance Tuning 10g reference poster
 
Oracle training in Linux 

commands
 
Oracle training 

Excel
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> private synonym inside a package, Is it possible to make a private synonym only valid inside a package?
Lisette
post Apr 25 2012, 04:51 AM
Post #1


Newbie
*

Group: Members
Posts: 1
Joined: 25-April 12
Member No.: 47,128



Hello,

I'm making a function A that does many calls to procedures in an other package B.
To make this function more readable, I'd like to specify synonyms for the procedures in B.
I only need the synonyms inside this function, I don't want to make database synonyms. Is this possible?

For example:

Function get_all_employees return clob
is
v_emp clob;
begin
for i in (select name,function,dept from employee)
loop
pck_json.g_array := '';

pck_json.add_value_to_array(i.name);
pck_json.add_value_to_array(i.function);
pck_json.add_value_to_array(i.dept);
pck_json.finish_array;

pck_json.add_array_to_array(pck_json.g_array);
end loop;

pck_json.finish_nested_array;
v_emp := pck_json.g_nested_array;

return v_emp;
end;

--------------------
with private synonyms i could do this:
--------------------
Function get_all_employees return clob
is
v_emp clob;

a is synonym of pck_json.g_array;
na is synonym of pck_json.g_nested_array;
add is synonym of pck_json.add_value_to_array;
arr2arr is synonym of pck_json.add_array_to_array
finish_a is synonym of pck_json.finish_array;
finish_na is synonym of pck_json.finish_nested_array;
begin
for i in (select name,function,dept from employee)
loop
a := '';

add(i.name);
add(i.function);
add(i.dept);
finish_a;

arr2arr (a);
end loop;

finish_na;
v_emp := na;

return v_emp;
end;
Go to the top of the page
 
+Quote Post
burleson
post Apr 26 2012, 10:28 AM
Post #2


Advanced Member
***

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



>> I only need the synonyms inside this function, I don't want to make database synonyms. Is this possible?


No, this would not be a good coding practice.


--------------------
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: 24th April 2014 - 11:57 PM