Calling public package functions and variables through dblink
Is it possible to call a global public variable in a package in one database from another package procedure in another database using a database link? If so, could you let me know the syntax? Same question for package functions.
Hi,
check this documentation link especially the stmt...
http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/appdev.102/b14251/adfns_packages.htm#i1007858
You cannot access remote package variables and constants.May be you can write a function in the remote db which when called will return the variable value.
for calling remote package functions...
syntax from documentation is [[schema.]package.]function_name[@dblink][(param_1...param_n)]
an example given in the above link for this...
EXECUTE fire_emp1@boston_server(1043);
Ravi Kumar
Edited by: ravikumar.sv on Aug 31, 2009 11:29 AM
Similar Messages
-
How to call PL/SQL function and pass parameter to ODI variable?
Can I call PL/SQL function and assign a return value to an ODI variable? Also can I assign ODI variable to IN paramter and assign OUT parameter to ODI variable? What ODI doc has that information?
ThanksHi,
Refer this http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi
Thanks,
Sutirtha -
Calling a package function inside a sql
Hi friends!!!
First of all happy Christmas! And them please help! :)
We have a query calling a package function:
SELECT * FROM DW025H WHERE DW025H_NR=MPPCI.ENCR ('0000000000000000');There is a primary key just with one column DW025H_NR and the problem is that is not accessing by INDEX UNIQUE SCAN,
it's accessing by TABLE ACCESS FULL.
May be the problem is that we are calling a procedure inside the query?
I have been able to run that query accessing by primary key from my computer but a workmate hasn't!
We both are connecting the same data base 10.2.0.4 and using Oracle SQL Developer!
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5343K| 1406M| 15670 (7)| 00:02:43 |
|* 1 | VIEW | DW025H | 5343K| 1406M| 15670 (7)| 00:02:43 |
|* 2 | FILTER | | | | | |
| 3 | TABLE ACCESS FULL| DW025H | 5343K| 1406M| 15670 (7)| 00:02:43 |
Predicate Information (identified by operation id):
1 - filter("DW025H_NR"="MPPCI"."ENCRIPTAPAN"('0000000000000000'))
2 - filter(CASE "OPS$SISINFO"."IS_USER_DNI"() WHEN 1 THEN
SYS_AUDIT('OPS$SISINFO','DW025H','CMINFOGR001',3) ELSE NULL END IS
NULL)
The correct path would be:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 276 | 3 (0)| 00:00:01 |
|* 1 | FILTER | | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| DW025H | 1 | 276 | 3 (0)| 00:00:01 |
|* 3 | INDEX UNIQUE SCAN | PK_DW025H | 1 | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter(CASE "OPS$SISINFO"."IS_USER_DNI"() WHEN 1 THEN
SYS_AUDIT('OPS$SISINFO','DW025H ','CMINFOGR001',3) ELSE NULL END IS NULL)
3 - access("DW025H_NR"="MPPCI"."ENCR"('0000000000000000'))
Please any ideas!?!?!
Thanks a lot!
José
Edited by: jamv on Dec 20, 2011 10:50 AMHello
Have a read of this and try to pull together the information in it and post it up here. That will help immensely with getting to the root of your problem...
HOW TO: Post a SQL statement tuning request - template posting
In the mean time:
From the execution plan you have extra predicates that aren't present in the query you supplied, so that's either not the SQL or you have something like VPD switched on.
Anyway, there could be lots of reasons for the difference in execution plan. Sorry if this is very basic and possibly patronising question but it's always worth checking the basics I think - are you both definitely connecting to the same database? If so, have a look in v$sqlarea for this SQL statement and find the SQL_ID, use this to query v$sql and look at the child_number column.
select
sql_id
from
v$sqlarea
where
sql_text like '%SELECT * FROM DW025H WHERE DW025H_NR=MPPCI.ENCR%(''0000000000000000'')%'
and
sql_text not like '%v$sqlarea%'
select child_number from v$sql where sql_id='<enter the sql id returned by the query above>'as an example...
XXXX> select /* my sql statement*/ rownum id from dual;
ID
1
1 row selected.
Elapsed: 00:00:00.10
XXXX> select sql_id from v$sqlarea where sql_text like '%my sql statement%'
and sql_text not like '%v$sqlarea%';
SQL_ID
a6ss4v79udz6g
1 row selected.
Elapsed: 00:00:03.56
XXXX> select child_number from v$sql where sql_id='a6ss4v79udz6g'
2 /
CHILD_NUMBER
0
1 row selected. If you have more than one row in v$sql there could be differences in the optimiser environment. The supplied like shows you how to gather the information that should help find what the differences are if any.
Also as a side note if you're calling PL/SQL functions from SQL, you can take advantage of subquery caching to help reduce the number of calls (depending on your version). As it stands, your function is most likely going to be called for every row - when there is only a single row returned, that's not necessarily a problem but for multiple rows, the overhead can quickly grow. If there's no way to get rid of the function call, select the function from dual instead i.e.
SELECT * FROM DW025H WHERE DW025H_NR= (SELECT MPPCI.ENCR%('0000000000000000') FROM dual);This also (as I learnt a couple of weeks ago) works when you're using columns in the table your selecting from as parameters to the function.
HTH
David -
How to use type, packages, functions, and procedures in another schema ?
I have two target schema in one OWB project, such as A and B. In a mapping of A, I would like to use some types, packages, functions, and procedures from B. I have tried the method of synonym as suggested, but I could not find the metadata of these when importing ... The only type of synonym I can import is the synonym for table. Is there a bug for synonym?
If I cannot use synonym for this issue, is there another way to solve the problem?Now, in some instances you will absolutely need to create the second module as Carsten describes, however it should also be noted that you can reference objects in things like Expressions even if you have not loaded up the metadata. It is only when you need strong binding that it becomes neccessary to import objects. For everything else, as long as the reference will resolve at compile-time then you are good to go.
For example, I have a function in one target schema (S1) and a private synonym to it in another(s2). A mapping in the S2 schema has an expression object that uses the synonym to the function in the expression property for a couple of the output attirbutes. The synonym has not been loaded into metadata - indeed OWB has no knowledge of its existance. But it resolves at compile time so the mapping validates and generates successfully.
Mike -
cannon 8800F not working with OS X yosemite 10.10.1 . I have downloaded the latest drivers and firmware from Canon. I called Canon for support and went through all the checks , but, still my iMac did not see the scanner. Any new ideas?
Have you done any of the following?
http://support.apple.com/kb/PH18614 OS X Yosemite: Reset the printing system
Repaired permissions & restarted your comp after the installations of the drivers?
Sometimes, installing the GIMP drivers help with printing issues: http://gimp-print.sourceforge.net/MacOSX.php
What to do when you can't print
=============
not working with OS X yosemite 10.10.1
Per your profile
Mac OS X (10.7.3)
Conflicting info: Please update/correct your profile so that you can receive the correct troubleshooting suggestions. This will assist the users in trying to help you. Thank you. -
"You can only rename functions and variables"
G’day
I have this:
<!--- this comment breaks it --->
<cfloop from="1" to="5" index="idx">
<cfoutput>#idx#<br /></cfoutput>
</cfloop>
If I select "idx" and go right click > refactor > rename, I get a popup saying "You can only rename functions and variables."
If I take the comment out... works fine.
Weird.
Adami have a problem to opening my firfox home page . help me please
-
How to call package function and procedure by PL/SQL
Dear all,
I created a package and I want test it by a select statement. e.g. select packagename.function(1, 'A') . However, there is an error message. "ORA-14551: cannot perform a DML operation inside a query ".
In the package, there is a function and I passed two parameters to the function and return a number. These two parameters will be used in the cursor select statment. Is there sth wrong that I use the cursor with the parameters? What can I do then?
On the other hand, I want to test the package procedure by using select statement in SQL Plus. How can I call it (with parameter)?
Remark: I am using Oracle 8i.
Thanks for advance!!
Regrads.Hi!
I don't know why it is not running in ur computer. Pls check the script --
SQL> ed
Wrote file afiedt.buf
1 create or replace package pack_test
2 is
3 function try_test(eno in number,depno in number)
4 return number;
5* end;
SQL> /
Package created.
SQL> create or replace package body pack_test
2 is
3 function try_test(eno in number,depno in number)
4 return number
5 is
6 saln number(10);
7 begin
8 select sal
9 into saln
10 from emp
11 where empno = eno
12 and deptno = depno;
13
14 return saln;
15 end;
16 end pack_test;
17 /
Package body created.
SQL>
SQL> select pack_test.try_test(7777,30) from dual;
PACK_TEST.TRY_TEST(7777,30)
3456-it is working fine in my system.
Regards.
Satyaki De. -
Calling Oracle Package Function from Visual Basic
Hi,
Oracle Client 8.04
Oracle ODBC Driver 8.00.04
VB 6.0
Windows 2000
I'm stumped here. I want to have a Oracle stored procedure run a
query and return a result set which I can assign to a recordset
object in VB. Based on things I've read here and on MS's site,
here's what I've done:
In the Oracle Schema Manager under the Packages folder I created
the following package:
PACKAGE test
IS
TYPE test_cur IS REF CURSOR;
FUNCTION mycur RETURN test_cur;
END test;
and under the Package Body folder created:
PACKAGE BODY test
IS
FUNCTION mycur RETURN test_cur
IS
c_return test_cur;
BEGIN
OPEN c_return FOR
SELECT * FROM table_A;
RETURN c_return;
CLOSE c_return;
END mycur;
END test;
They both compile without errors and in Oracle SQL Worksheet I
can enter the following:
variable x refcursor;
execute :x :=test.mycur;
print x;
and the query results are displayed as expected.
The problem is trying to get the result back into a VB recordset
object.
In VB 6.0 I have done this:
Dim RS As ADODB.Recordset
Dim Conn As ADODB.Connection
Dim sConnection As String
Dim sSQL As String
sSQL = "{call test.mycur}"
sConnection = "Provider=MSDASQL;UID=" & sUserID & ";PWD=" &
sPassword & ";Driver={Microsoft ODBC for Oracle}; Server=" &
sInstance & ";"
Conn.Open sConnection
RS.CursorLocation = adUseClient
RS.Open sSQL, Conn, adOpenForwardOnly, adLockOptimistic,
adCmdStoredProc ' or adCmdText
but get:
?err.Number -2147217900
?err.Source Microsoft OLE DB Provider for ODBC Drivers
?err.Description [Microsoft][ODBC driver for Oracle]Syntax error
or access violation
The problem is not with the connection or permissions, since the
query works fine when I just use the select statement in the
package function as the string, instead of calling the function
in the package (eg sSQL = "Select * from table_A") and can
process the resulting recordset in VB.
I've also tried variations using:
Set RS = Conn.Execute("{call test.mycur}")
or using a Command object something like:
Dim com As ADODB.Command
Set com = New ADODB.Command
With Conn
.ConnectionString = sConnection
.CursorLocation = adUseClient
.Open
End With
With com
.ActiveConnection = Conn
.CommandText = sSQL
.CommandType = adCmdText
End With
Set RS.Source = com
RS.Open
But still get the same errors. Any help is appreciated. Also, in
my package body, is it necessary to explicitly close the cursor,
or does the function just exit when it executes the return and
not ever hit the close statement?
Thanks,
Ed HollomanHi
i don't know if you got your answer, but i work with VB and
Oracle.
the procedure in the DB should have the cursor like you writen
in your mail.
to call a procedure in Oracle and get the data back
into a recordset you shuld use a Command object like this:
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Set conn = CreateObject("adodb.connection")
Set cmd = CreateObject("adodb.command")
Set rs = CreateObject("adodb.recordset")
With conn
.ConnectionString = ""
.CursorLocation = adUseClient
.Open
End With
'THE IMPORTENT SECTION IS THIS WHERE YOU SET THE COMMAND TO THE
STORE PROCEDURE TYPE
With cmd
.ActiveConnection = conn
.CommandText = "proc.fun"
.CommandType = adCmdStoredProc
End With
'Then you set the rs to the command
Set rs = cmd.Execute
Set conn = Nothing
Set rs = Nothing
Set cmd = Nothing -
Invalid packages, functions and procedures
Hi,
Ok, I think I screwed up. Maybe someone can help me.
Our dev db which I just created a few days ago is 10.2.01. I was reading to see what needed to be done to this base for it to accept a 9.2 version. Data. I came upon oracle documentation that said to run the catalog.sql script. This had something to do with the Import full database and export full database procedures, they had to be added. So I did. I then noticed all these packages, procedures and functions listed on my oem tool as invalid. To correct this problem I ran the following scipts several times
On individual schemas: EXEC DBMS_UTILITY.COMPILE_SCHEMA (SCHEMA => ‘OLAPSYS’);
And this one: EXEC UTL_RECOMP.recomp_serial(); for all of them.
But yet I still get invalid objects ( 6 different schemas) when I run this script the SYS owner being the outstanding one.
COLUMN object_name FORMAT A10
Column owner format a10
Column object_name format a40
SELECT owner,
object_type,
object_name,
status
FROM dba_objects
WHERE status = 'INVALID'
--And owner = 'PUBLIC'
ORDER BY owner, object_type, object_name;
Any suggestions on repairing this damage short of recreating the database?
Any suggestions would help.
Regards,
alI just did a flashback database to time. Before I did any of these procedures above. That db came up ok and you would think that everything is fine. I went in to check with the same query
COLUMN object_name FORMAT A10
Column owner format a10
Column object_name format a40
SELECT owner,
object_type,
object_name,
status
FROM dba_objects
WHERE status = 'INVALID'
--And owner = 'PUBLIC'
ORDER BY owner, object_type, object_name;
and found the same amount of objects still invalid. I know that I didn't do any work at that time because I was in a meeting. I even logged out and back in on the oem tool and sql plus and got the same invalid in the column.
Anyone knows what is going on here?
regards,
al -
Calling a package function in the data template
Hello All,
I am not able to understand the concept of calling a function from the data template.
In my data template, I put the sql statement as
<sqlStatement name="Q_SEL">
<![CDATA[ Select l_period_name PERIOD_NAME
from xla_tb_ap_report_pvt.get_period_name(1) ]]>
</sqlStatement>
Is it possible to call a specific package function as shown above in a select statement?
I am getting the message "ORA-00933: SQL command not properly ended" when I tried with the above. Could you pls. point out what the error is in the above sqlStatement?
1) My instance is R12.1.3
2) The base pkg function 'xla_tb_ap_report_pvt.get_period_name' expects a number to be passed in as 'IN' parameter.
Thanks,
MonkeyI tried another version of the sql statement (after going through some older posts) like:
<sqlStatement name="Q_SEL">
<![CDATA[ Select xla_tb_ap_report_pvt.get_period_name(1) PERIOD_NAME
from dual]]>
</sqlStatement>
My group is :
<group name="G_PERIOD_NAME" source="Q_SEL">
<element name="PERIOD_NAME" value="PERIOD_NAME"/>
</group>
Now getting the error message:
ORA-00904: xla_tb_ap_report_pvt.get_period_name : invaild identifier
What is it that i am doing wrong?
Thanks,
Monkey
Edited by: OAF_Monkey on Mar 26, 2012 11:52 AM -
Error calling a package function
Hi all,
I've created one package and inside it, I've two different functions. The package definition and body are OK.
Now, I want use it but, I've an error:
ORA-06550: line 16, column 13:
PLS-00201: 'BB.PKG_BB_TEMP' must be declared
this is the function declaration on package declaration:
FUNCTION busca_municipio (gest varchar2) RETURN number;
Procedure solu (codi_ges number, muni number);
And this is the code from I'm calling:
DECLARE
CURSOR datos IS
select a.id from bb.cr_agent a, bb.cr_branchoffice b, bb.cr_professionalorder p, bb.cr_user u where a.branchoffice_id = b.id
and b.professionalorder_id = p.id and p.externalsystem_id = 42 and a.id = u.id and u.address_id is null;
cod_ag number;
muni number;
BEGIN
muni:=0;
open datos;
loop
fetch datos into cod_ag;
exit when datos%notfound;
muni:=bb.pkg_bb_temp.busca_municipio(cod_ag);
bb.pkg_bb_temp.solu (cod_ag,muni);
end loop;
close datos;
END;
This package is owned by user BB, and I'm connected like sys to execute the code I put before.
Any ideas?
Regards,
dbajugdbajug wrote:
Hi all,
I'm having problems to grant:
SQL> select object_name, object_type, status from dba_objects where owner like 'BB' and object_type like 'PACK%';
OBJECT_NAME OBJECT_TYPE STATUS
PKG_bb_temp PACKAGE VALID
PKG_bb_temp PACKAGE BODY VALID
SQL> GRANT EXECUTE ON BB.PKG_bb_temp to sys;
GRANT EXECUTE ON BB.PKG_bb_temp to sys
ERROR in line 1:
ORA-04042: procedure, function, package or package body doesn't exist
SQL> conn bb/*******
Conected.
SQL> GRANT EXECUTE ON PKG_bb_temp to sys;
GRANT EXECUTE ON PKG_bb_temp to sys
ERROR in line 1:
ORA-04042: procedure, function, package or package body doesn't exist
Any ideas?
Regards,
dbajugHave you created the package with a case sensitive name i.e. did you put double quotes around it?
select owner, object_name from all_objects where upper(object_name) = 'PKG_BB_TEMP';The owner should show as "BB" and the object_name should be in upper case (hopefully). If it's not upper case then it's been created case sensitive and you you'll have to either recreate the package without using double quotes around the name or make sure you always reference the package with double quotes and the case exact version of the name.
e.g.
GRANT EXECUTE ON "PKG_bb_temp" TO <user>;Hopefully, you are not running your other code as SYS, so you should ensure you grant permission to the correct user, not to SYS. -
2.1.0.62: Problem with Package.Functions and Unit Tests
I like the new Sqldeveloper - I startet trying Unit Tests as described here: Link: [http://www.oracle.com/technology/obe/11gr2_db_prod/appdev/sqldev/sqldev_unit_test/sqldev_unit_test.htm#t4]
It worked with a test-procedure. Now i am trying to test my package functions, but all i get is this:
Die folgende Prozedur wurde ausgeführt.
Ausführungsaufruf
BEGIN
:1 := "PKG_MYPACK"."CREATEFUNCTION"(IN_PROGRAMMEID=>:2,
IN_AMOUNT=>:3,
IN_SWS=>:4);
END;
Bind-Variablen verwendet
1 INTEGER OUT (null)
2 INTEGER IN 1
3 INTEGER IN 10
4 INTEGER IN 11
Ausführungsergebnisse
ERROR
Ungültige Konvertierung angefordert
oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:439)
oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7723)
oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7496)
oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7978)
oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4063)
oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:221)
oracle.dbtools.raptor.datatypes.strategies.callablestatement.CallableBindingDatum.customBindIN(CallableBindingDatum.java:135)
oracle. ...
what can i do?Created
Bug 8976245 - EA1: UNIT_TEST: INVALID CONVERSION ERROR USING INTEGER PARAMETER
and have asked bug responder to keep you updated on status here in the forum.
Bad news is that any INTEGER parameter for which you specify a non-null value will fail.
Possibly helpful news is that if you create a 'clone' of you function using NUMBER as the data type, you can continue to experiment with how unit testing may be of use to you.
Sorry no instant answer. :(
Brian
SQL Developer Team -
Calling PL/SQL Functions And Open Oracle Reports From ADF Application
Hi all,
My company will convert some projects from Oracle forms to Oracle ADF so, we need to call the PL/SQL functions and open the Oracle Reports (which are already exist) from ADF Application.
Thank You..
Jack.NHi Jack.N,
calling PL/SQL Functions -----> http://sameh-nassar.blogspot.com/2010/01/create-plsql-function-and-call-it-from.html
Open Oracle Reports ---------> http://radio-weblogs.com/0137094/2008/06/15.html
You will find The Integration between ADF and other systems in ---> http://wiki.oracle.com/page/ADF+Integration
Sameh Nassar -
Call External C++ function and pass XML
Hi,
I need to call external C++ function from Oracle and pass to it XML file from Oracle table? Can you give short guide how to do it?
RegardsYour question sounds like is about using an Oracle database (or other application), and not about C++ programming or the using the C++ compiler. You are more likely to find a helpful answer in an Oracle database (or other application) forum.
-
Vb-functions and variables vs GPI-functions
I want to use the new diadem 9.0 features like channel groups and custom properties within a GPI-dll.
I have figured out their usage in VB-Scripts but for GPI I was not successful.
Is there a list that shows all VB-Commands and Variables and their related GPI-Functions?Hello d.s.
Thanks for contacting National Instruments!
I'm sorry but there is no document cross-referencing the GPI functions with the corresponding VBScript functions. The GPI-DLL specification has not been updated for DIAdem 9.0, so there is not yet a way to access the new features of this version. We are considering updating the GPI spec in the near future, and would welcome any feedback you have!
David McClelland
NI Applications Engineering
Maybe you are looking for
-
Remote Function module to wait for the response.
Hi . i just created the remote function module to call the webmethod by putting the parameters in tables (tab) for webmethods to pick the data from RFC and parameters in changing (tab) to collect the reponse from webmethods ,i just want to know if th
-
Cisco ISE PRA Periodic Reassment
Hi Experts, i have a good challenge. Nac Agent 4.9.0.51 I've set the periodic reassment to 1 hour, the behaviuor is that, in one hour, the client pass to compliant state, to unknown posture state (with the respective WLC acl applied), and then to com
-
Help with Adobe Content Viewer ???
please any one help .. i make my folio with Indesign CS5 and i test it on the Adobe desktop Viewer - i found it is a great but when i try to move it to my ipad i don`t found the Adobe Content Viewer in the file sharing section in the ituns .so
-
I need help with audio in my Premiere Pro edit
I recently recorded a gameplay with a song track in it. In the beginning of my video, i did a voiceover explaining what the video was going to be about. When im talking, i want to lower the song, then raise the volume when im done talking. How can i
-
Photoshop CS6 Update Keeps Failing
Why does my Photoshop CS6 update (13.0.1.1) keep failing? The rest of CS6 updated just fine, but this one has failed 3 times. There were no other programs open.