Calling Remote Procedure using DB Link
In Oracle v8 or earlier DB link can be used only to Insert/Update/Delete Or Select Data with the Remote DB. But, Oracle 8i, allows us to call A procedure stored in a remote DB. I have oracle8i server and not sure about the other Oracle svr version (Could be 7.3 under unix/8 under unix or so).
Is it possible to call a procedure stored in a remote DB(different version)from oracle 8i?
null
GUNN3R wrote:
I have a package in a database defined this way:
CREATE OR REPLACE PACKAGE BODY xx_dummy_package
IS
FUNCTION dummy_procedure RETURN NUMBER
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('I am now in dummy_procedure');
RETURN 1;
END dummy_procedure;
END xx_dummy_package;
And I'm trying to call this package from an external database using the next code:
DECLARE
num NUMBER;
BEGIN
-- user package db link function
num := [email protected]_PROCEDURE();
END;
But I'm getting the next error:
ORA-06550: line 7, column 12:
PLS-00352: Unable to access another database 'APPSRHREM.XX_DUMMY_PACKAGE.DUMMY_PROCEDURE'
ORA-06550: line 7, column 12:
PLS-00201: identifier '[email protected]_DUMMY_PACKAGE.DUMMY_PROCEDURE' must be declared
ORA-06550: line 7, column 5:
PL/SQL: Statement ignored
Anyone knows why is this happening?
Thanks :)incorrect syntax
Similar Messages
-
Calling remote procedure through database link
Hi,
I have a procedure in a package with a type I delcared as follows:
Database1 :
create or replace package p1
is
TYPE dependents_rec IS RECORD (
name VARCHAR2 (80),
dob date);
TYPE dependents IS TABLE OF dependents_rec
INDEX BY BINARY_INTEGER;
procedure proc1 (p_id in number,
p_dependents out dependents );
end;
On another database database2 i want to call the above procedure from within a procedure in a package that works as a wrapper package with similar structure.
I recieve the error "Wrong number or types of parameters" error because type dependents is not the same as within the package in database 1.
How can I call the procedure p1.proc1 over a database link ?
Thank youHi,
On database1:
CREATE OR REPLACE PACKAGE types_pkg is
TYPE dependents_rec IS RECORD (
NAME VARCHAR2 (80),
sex NUMBER (1),
birth_date DATE,
birth_place NUMBER (3),
status NUMBER (1),
unique_id VARCHAR2 (15)
TYPE dependents IS TABLE OF dependents_rec
INDEX BY BINARY_INTEGER;
end;
CREATE OR REPLACE PACKAGE wrapper_pkg_demo
AS
PROCEDURE read_person_no (
p_person_id NUMBER,
p_dependent_info OUT types_pkg.dependents
END;
CREATE OR REPLACE PACKAGE BODY wrapper_pkg_demo
AS
PROCEDURE read_person_no (
p_person_id NUMBER,
p_dependent_info OUT types_pkg.dependents
IS
BEGIN
person_pkg.read_person_no (p_person_id, p_dependent_info);
END;
END;
On database 2:
CREATE OR REPLACE PACKAGE person_pkg
AS
PROCEDURE read_person_no (
p_person_id NUMBER,
p_dependent_info OUT types_pkg.dependents@database1
END;
CREATE OR REPLACE PACKAGE body person_pkg
AS
PROCEDURE read_person_no (
p_person_id NUMBER,
p_dependent_info OUT types_pkg..dependents@database1
IS
BEGIN
null;
END;
END;
When compiling the package body on database 1
ORA-04052: error occurred when looking up remote object TYPES@MOI
ORA-00604: error occurred at recursive SQL level 1
ORA-02019: connection description for remote database not found
Noting that the database link are working properly and when compiling the package on database 2, it compile successfully
Thank you -
Weird Problem calling Stored Procedure using JDBC
Scenario is..
I have J2EE application and calling stored procedure using JDBC.
My application connects to instance "A" of testDB.
Schema "A" does NOT own any packages/procedure but granted execute on oracle packages/procedures that reside in schema "B" of testDB.
In java code I call procedure(proc1) in package(pac1) which internally calls procedure(proc2) in package(pac2).
The problem occurs when procedure pac2.proc2 is modified. After the modification, my java code fails and throws an exception "User-Defined Exception" and I am also getting "ORA-06508: PL/SQL: could not find program unit being called". This clears up only if I bounce the web container. (This doesn't happen if I modify pac1.proc1 and run my application)
Has any one faced this problem? Please suggest if any thing can be changed in jdbc code to fix this problem.
ThanksHi,
I assume these are PL/SQL packages and that the changes are made at the package specification level?
If so, it looks like you are hitting the PL/SQL dependencies rules. In other words, if the spec of proc2 is changed, then proc1 is invalidated, since proc1 still depends on the old version of proc2's spec. As a result, if you try to run proc1, its spec must either be explicitly rewritten before it could run again or implicitly recompiled first, if the (implicit) recompilation fails, it won’t run.
Kuassi http://db360.blogspot.com -
Calling Stored Procedure using J2EE (CMP/BMP)
Hi guys,
Can anyone please help me of how to call a stored procedure using a bean in J2EE? I am using Sybase as a database. I am not sure of how to call a stored procedure that is stored in the database server.
I have one more problem that I am getting in my application. I have 6 entity beans for 6 tables (3 temporary which are deleted and created as and when deployed and 3 permanent which are not deleted when deployed). When I access and manipulate data in temporary tables, everything works fine. But when I try to insert records in the 3 permanent tables, i get an error saying...
ejbexception.transactionrolledbackerror - Client's transaction rolledback
Your suggestions would be very valuable.
Thanks in advance,
ashishActually, I was getting the RolledBack exception before I was using stored procedure. The bean was supposed to make a few transactions in the tables within the Sybase database. Since it gave me rolledback error, I decided to write a stored proc. in the database and to call that procedure using the bean.
Now, I am not sure of how to call that procedure using the bean. Also, the syntax of calling that procedure using CallableStatement. I believe, I would have to use Bean Managed Persistence (BMP) if I want to use CallableStatement. I am fooling around with it right now and would let you know if I am getting any exceptions or errors. Meanwhile, any help on the syntax of calling the stored proc. would be highly appreciated.
Thanks in advance
Ashish -
Calling a procedure using JDBC-OCI
When I use setPlsqlIndexTable for calling a procedure using JDBC-OCI
ps.setPlsqlIndexTable(1,str,10,str.length,OracleTypes.VARCHAR,8);
always throw a Exception :
java.sql.SQLException: Non supported character set: oracle-character-set-832
at oracle.gss.util.NLSError.throwSQLException(NLSError.java:46)
at oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSetFactoryThin.java:171)
at oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThin.java:135)
at oracle.sql.CHAR.<init>(CHAR.java:133)
at oracle.sql.CHAR.<init>(CHAR.java:157)
at oracle.jdbc.oracore.OracleTypeCHAR.toDatum(OracleTypeCHAR.java:145)
at oracle.jdbc.oracore.OracleType.toDatumArray(OracleType.java:145)
at oracle.jdbc.oracore.OracleTypeCHAR.toDatumArray(OracleTypeCHAR.java:173)
at oracle.jdbc.driver.OraclePreparedStatement.setPlsqlIndexTable(OraclePreparedStatement.java:2622)
When can tell me how to solve it? ThanksI hava resolve this problem, we must add the
class nls_charset12.zip to classpath. -
Calling a remote procedure with db link - SQL Plus hangs
I am trying to call a procedure from a remote database with a db link, within a local procedure. The purpose of the calling the procedure is to get the server time from that database. When I try to compile this procedure on the local database SQL Plus hangs without giving any error message, I have to close SQL Plus. Below are my two procedures:
Local procedure:
CREATE OR REPLACE PROCEDURE get_server_time(p_remotetime IN OUT VARCHAR2)
IS
/*Grabs the system time from remote database .
l_remotetime varchar2(16) ;
BEGIN
get_remote_time(l_remotetime);
p_remotetime := l_remotetime;
END ;
Remote procedure:
CREATE OR REPLACE PROCEDURE get_remote_time(p_remotetime in out VARCHAR2)
IS
/* Grabs the system time from remote database and returns it to the
calling proc.
l_remotetime varchar2(16) ;
BEGIN
SELECT to_char(sysdate,'YYYYMMDDHH24MISS')
INTO l_remotetime
FROM dual ;
p_remotetime := l_remotetime ;
END ;
I personaly do not see anything unusall with the two procedures, but cant figure out what is making SQL*Plus hang.
Any help would be much appreciated.
Thanks In AdvanceHello
Are you able to run the procedure connected to the livetolocal database directly? It looks as if you either have a missing table or the permisions for the user associated with the database link are not sufficient.
As for calling the procedure, it would probably be more managable if you created a public synonym for it to hide the actual location. That way if you want to change the name of the DB link, or where it points to, no-one has to change their code, you just have to change the synonym.
HTH
David -
Calling store procedure using class cl_sql_statement not running
Hello together
i want to call a stored procedure that has an input and an output parameter but when i using my coding i m getting the following error
ORA-06550: line 1, column 7:#PLS-00201: identifier 'STORED_PROC_NAME' must be declared#ORA-06550: line 1, column 7:#PL/SQL: Statement ignored
GET REFERENCE OF lv_input IN lr_dref."in
lr_cl_sql_statement->set_param( data_ref = lr_dref
inout = cl_sql_statement=>C_PARAM_IN ).
GET REFERENCE OF lv_out INTO lr_dref. "out
lr_cl_sql_statement->set_param( data_ref = lr_dref
inout = cl_sql_statement=>C_PARAM_OUT ).
TRY.
data lv_ROWS_PROCESSED type i.
CALL METHOD LR_CL_SQL_STATEMENT->EXECUTE_PROCEDURE
EXPORTING
PROC_NAME ='Stored_Proc_Name'
RECEIVING
ROWS_PROCESSED = lv_ROWS_PROCESSED
i my oppinion there could be an error in setting the parameters. Has anyone an running solution for calling a stored procedure with in and out parameter. I already tested the ADBC Programs and even had a sight in the class documentation but there is no example with in and output parameter.
Thank your for your help!Hi
Not sure as the exact solution , but you can try the following :
You are executing the "stored procedure" as which user , is it under your schema and do you have execute priveleges on it.
Please see below links , might be helpful to you :
http://forums.devshed.com/java-help-9/call-stored-procedure-337312.html
http://bytes.com/topic/oracle/answers/643380-pls-00201-identifier-user-procedure-name-must-declared
Thanks
Rishi -
Call remote procedure from mapping
Hi All,
Can anybody help to explain in details how to call a remote procedure in OWB's mapping? I need to pass some parameters from my mapping to this procedure ant then get the output to my mapping.
qtphamHi,
My problem is that I want to repeatedly call the remote procedure in my mapping, which pass data from a target table to the remote procedure and get data back and use the data to update to the target table. How can I do it?
As I understand, the pre/poss-mapping procedure is not valid for SQL*Loader mapping, which is the target table
Thx,
qtpham -
Creating and calling stored procedure using jdbc
When I try to create and call a stored procedure using JDBC a very confusing error message about non-existence of the procedure just created is thrown. Using Informix database (IDS 10). Any pointers to point out what am doing wrong would be great!
Thanks
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;
public class CreateStoredProc {
public static void main(String args[]){
if (0 == args.length)
return;
try {
Class.forName("com.informix.jdbc.IfxDriver");
Connection conn = DriverManager.getConnection("jdbc:informix-sqli://10.76.244.120:30000/sampledb:INFORMIXSERVER=krisunda;user=root;password=cisco");
String q = " create procedure runproc() "+
" define i int; "+
" let i = 0; "+
" end procedure; "+
" execute procedure runproc(); ";
Statement stmt = conn.createStatement ();
stmt.execute (q);
} catch (Exception e) {
e.printStackTrace();
The stack trace:
java.sql.SQLException: Routine (runproc) can not be resolved.
at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3204)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2157)
at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2132)
at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:378)
at com.informix.jdbc.IfxStatement.a(IfxStatement.java:1299)
at com.informix.jdbc.IfxStatement.executeImpl(IfxStatement.java:1269)
at com.informix.jdbc.IfxStatement.c(IfxStatement.java:989)
at com.informix.jdbc.IfxStatement.execute(IfxStatement.java:875)
at CreateStoredProc.main(CreateStoredProc.java:37)
Caused by: java.sql.SQLException
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3523)
... 10 moreDriverManager.getConnection("jdbc:informix-sqli://10.76.244.120:30000/sampledb:INFORMIXSERVER=krisunda;user=root;password=cisco");check with ur sys admin wheather the particular user in the database has >execute privilage(rights) also.i mean execute the SP in the DB level.I guess that a root user will have the enough right.
String q = " create procedure runproc() "+
" define i int; "+<" let i = 0; "+
" end procedure; "+
" execute procedure runproc(); ";
Statement stmt = conn.createStatement ();
stmt.execute (q);Try to use the following code:
String q = " create procedure runproc() "+
" define i int; "+
" let i = 0; "+
" end procedure; "
Statement stmt = conn.createStatement ();
stmt.execute (q);
q=" execute procedure runproc(); ";
stmt.execute (q);
Because maybe the driver failed to precompile your sql once, so that nothing happen. -
Calling Stored Procedure Using OSB 10g R3
Hi Guys,
I wanted to know what is the best way to call a Stored Proc from OSB 10 g R3.
I am using MS SQL 2005 server.The DB Adapter does, in fact, support SQL Server in 10.1.3.x. The adapter configuration wizard does not support SQL Server so a command-line utility is necessary in order to generate the BPEL artifacts (XSD and WSDL). Once the artifacts are created, it is very easy to create a partner link to a SQL Server stored procedure. The adapter runtime has no restrictions beyond what is stated in the documentation. Note that the wizard will support SQL Server in 11g.
-
Unable to create publication item for remote database using db link
The mobile repository is in instance A.
I have to access and sync data from a table in remote database instance B.
I have run the consolidator_rmt.sql script in instance B under schema_B. I have created a private fixed user db link in instance A under schema_A to access schema_B's tables. I then created a synonym test_B for table test_B in schema_B using the DB link.
While creating publication item for test_B using MDW, the column list for test_B appears blank. Has anyone encountered this problem and what is the solution.
Thanks for your help.
Rosa.Hello Pruthvi ,
See these threads
Uninstalling MaxDB
Work process Ended.
Thanks
Chandran -
Calling stored procedures using forms & ruleframe
Does anybody know how I should call a stored procedure (which does some DML on tables) from forms when ruleframe is used? Should a transaction be opened before the procedure is called and closed afterwards? What should happen in the exception handler of the stored procedure, and how should exceptions be handled in the form?
Mike,
When calling code that performs DML, you must explicitly code the open and close transaction call. In that call, specify a program name that is specific to that piece of code. And you have to have an exception handler (see below).
What will happen, is that the open transaction call checks if a transaction is already open. If it is, it does nothing, and also the close transaction call will then do nothing, as the transaction was opened by another program unit.
If there is no open transaction yet, your call will open one, and then your close-call will also close it because it has the same program name. If at that moment errors are raised, you have to catch them with the standard Headstart exception handler (which you ought to have in all your Forms program units):
when form_trigger_failure
then
raise;
when others
then
qms$errors.unhandled_exception(<program unit>);
This exception handler will recognize the ruleframe exception and show the messages.
We have updated the CDM RuleFrame documentation for 6i to make this more clear, to avoid confusion in the future.
Hope this helps,
Sandra -
Taking control back while calling stored procedure using java programme
I have stored procedure to load data. This procedure is invoked by java program.
The stored procedure take around 10 to 15 minutes to do complete loading of database. I want to write stored procedure when it starts loading of database at the same return the control to calling java programme so that java program can do other operation i.e. java program can not wait for control back from stored procedure.
In short stored procedure runs in background and return control back to java program when stored procedure is invoked. Is it possible then How we can achieve this.U can acheive this using Java Threads. Create a thread submit this loading job. Once you submit the thread, you will get the control back to do other stuff.
Documentation:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html
-aijaz -
SSIS - Failure when calling stored procedure using sp_executesql
Hi
Newbie here so if it doesn't make sense I apologise.
I have an SSIS (Visual Studio 2012) package that basically gets data from tables and inserts them into staging tables.
There are 2 containers each having 20 Execute SQL Tasks running in parallel inside and the 2nd one is failing when I try to call a stored procedure that is using sp_executesql.
All the connections are fine as I can change the call of sp_executesql to an insert statement and it works ok.
Property Settings for the container have TransactionOption = Required. Inside the Execute SQL's have Supported.
Settings for the Execute SQL Tasks have the isStoredprocedure = TRUE and the procedure name is correct.
I have tried to change the procedure name to pass in parameters etc but it seems that every time the calls hit the sp_executesql it falls over if more than 3 are called at the same time.
Anybody got any ideas?
Thanks in advanceThanks for the quick reply the error is
failed with the following error: "The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly.
The parameters getting passed are correct as I'm using them in the Insert statement that I substituted for the sp_executesql. It looks like as soon as there is a lot of connections then it falls over. It works fine with 1 or 2 execute sql tasks but not any
more than that. -
Problem of retrieve a set of data when calling store procedure using vb with ODBC
when I use ODBC, it can return 1 record (1 field) using pass and retrieve the parameter. but it cannot success when return a set of data (using recordset to store it), when i do it, the error message (Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if availabl. No work was done.). Why ? and how can solve it ?\
Thanks in advance.oh, really ? it is not use ODBC to connecto to oracle ?
Here is my program code:
STORE PROCEDURE:
PROCEDURE getInforcePolicy(PClient_ID IN VARCHAR2, PPolicy_No IN VARCHAR2, BasicCur OUT oraoledb.m_refcur, RiderCur OUT oraoledb.m_refcur)
IS
BEGIN
OPEN BasicCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No = 1;
OPEN RiderCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No <> 1;
END getInforcePolicy;
PACKAGE oraoledb AS
TYPE m_refcur IS REF CURSOR;
END oraoledb;
Program:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim paramclient As New ADODB.Parameter
Dim parampolicy As New ADODB.Parameter
Dim I As Integer
cn.Open "ridev", "abc","abc"
cmd.ActiveConnection = cn
Set paramclient = cmd.CreateParameter("PClient", adVarChar, adParamInput, 10)
Set parampolicy = cmd.CreateParameter("PPolicy", adVarChar, adParamInput, 10)
paramclient.Value = "0000023011"
parampolicy.Value = "HK0010021U"
cmd.Parameters.Append paramclient
cmd.Parameters.Append parampolicy
cmd.CommandText = "{call getInforcePolicy}"
Set rs = cmd.Execute
Do While Not rs.EOF
Loop
Set rs2 = rs.NextRecordset
Do While Not rs2.EOF
loop
Where the RIDEV is a datasource that created from Data Source in Control Panel using the driver call "Microsoft ODBC for ORACLE"
Maybe you are looking for
-
Publishing iCal group to web WITH colors
Here is my problem. I can publish my iCal group to the web and view the group calendars just fine, but the colors do not show up in web view like they do in the application. What am I doing wrong, or is there a solution? Thanks!
-
I have been building a Flex application using Flex 3 SDK Beta 2. I have run into a very anoying problem and I can't seem to find a solution. I have several TextInput controls scattered around my application. I would love if these fields could accept
-
"Battery low connect to..."
Hallo, my iPod mini is still having problems with the battery. I did select+menu and then put it to recharge, but when i listen to music it keeps telling me that the battery is low even if it's full, and the battery image comes up. Any ideas? It's re
-
When i burn cds, they wont play on any other device? what am i doing wrong?
-
Hello I need to create custom business content in NW2004s (cubes and data store object for Siebel). Does somebody know how to create custom business content in BW 3.5/ BI NW2004s? Thanks