Oracle: PL/SQL Procedure involving two different Schema in two different Databases

I got a scenario like this, I have an existing procedure that looks similar to this.
PROCEDURE A_DATA_B( p_ID IN SCHEMA1.TABLE1.ID%TYPE,
                    p_MATCH IN SCHEMA1.TABLE2.MATCH%TYPE,
                    p_STATUS IN SCHEMA1.TABLE3.STATUS%TYPE, 
                    p_MSG IN SCHEMA1.TABLE1.MSG%TYPE,
  The list goes on...
The SCHEMA1 was residing in the same database previously. Now this needs to be moved to another database in different server as such. But the schema name goes to be different but the Table name and the column name remain the same.  So I changed the procedure to look like this
PROCEDURE A_DATA_B( p_ID IN SCHEMA2.TABLE1.ID%TYPE,
                    p_MATCH IN SCHEMA2.TABLE2.MATCH%TYPE,
                    p_STATUS IN SCHEMA2.TABLE3.STATUS%TYPE, 
                    p_MSG IN SCHEMA2.TABLE1.MSG%TYPE,
  The list goes on..
But when I compile I got the error
PLS-00201: identifier 'SCHEMA2.TABLE1' must be declared
PL/SQL: Declaration ignored
I can understand from this error that SCHEMA2 is not in the database which gives the error. So How should I tackle it?
In the package body where ever am using this SCHEMA2 has been followed by an @db_link. So can I make use of that db_link to solve this?
By looking in to some article I came to know that SYNONYM can also be used. So is this the right way to create a synonym will work?
CREATE SYNONYM SCHEMA2 FOR SCHEMA2@db_link;
Can Someone help me in this regards.
Notes : I may not be able to convert the %type to varchar2 or numbers etc..
Thanks In Advance.

This works for me:
PROCEDURE A_DATA_B( p_ID IN SCHEMA2.TABLE1.ID@dblink%TYPE, 
                    p_MATCH IN SCHEMA2.TABLE2.MATCH@dblink%TYPE,  
                    p_STATUS IN SCHEMA2.TABLE3.STATUS@dblink%TYPE,   
                    p_MSG IN SCHEMA2.TABLE1.MSG@dblink%TYPE,  
Alternatively create a synonym for the table (you can't create a synonym for a schema):
create synonym ref_table1 for SCHEMA2.TABLE1.ID@dblink
PROCEDURE A_DATA_B( p_ID IN REF_TABLE1.ID%TYPE, 
                    p_MATCH IN REF_TABLE2.MATCH%TYPE,  
                    p_STATUS IN REF_TABLE3.STATUS%TYPE,   
                    p_MSG IN REF_TABLE1.MSG%TYPE, 
but I don't like the idea of depending on a schema in another instance at all.
Can you create a reference set of tables in a schema on the current database, to be the source for the data types?

Similar Messages

  • How to enable MSDOS program to be called from Oracle PL/SQL procedure ( Web Service )?

    Hello,
    Dealing with the time demanding procedure where power user is interactively execute sequence
    of steps of procedure:
    1. pl/sql procedure for preparing data in some table
    2. java program that read data from the table and creating input txt file for MSDOS program
    3. MSDOS program is autonomous component that reads input txt file and make
        output txtfile.
        MSDOS program is closed component, can not be modified
    4. java program that insert txtfile into Oracle table.
    5. Steps 1 to 4 are executed in interations driven with select on some table.
    Trying to prepare re-design the procedure  and not sure about which technologies to use ?
    The goal is that whole procedure would be implemented in pl/sql procedure and this way could be executed
    so as from power user from command line as from controlled application on any type of the client.
    So if that MSDOS program would be transformed as Web Service offered on  some MSWin server in the intranet.
    Then PL/SQL procedure would communicate ( call this web service ) and do all the job and at the end
    send status of completion and report through e-mail to the issuer of the procedure?
    Not sure what technologies should I use on Oracle RDBMS server on Linux to communicate with MSWin Web service which is running MSDOS program ?

    > Hi TOM,
    This is not asktom.oracle.com.
    > Can Possible to do in Oacle Pl/Sql...?
    Yes it can be done. Simply consult the applicable manuals that contains all of the details on how to do it. The manuals are:
    - Oracle® Database Application Developer's Guide - Large Objects (refer to Chapter 6 section on Using PL/SQL (DBMS_LOB Package) to Work with LOBs)
    - Oracle® Database PL/SQL Packages and Types Reference (refer to the chapter on DBMS_LOB)

  • Oracle PL/SQL procedure/function to post message into weblogic jms queue

    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    Regards,
    Steve

    904640 wrote:
    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue

  • Oracle PL/SQL procedure to post message into weblogic jms queue

    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    Regards,
    Steve

    904640 wrote:
    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue

  • How to get a rowcount from two different schema in two different databases?

    Hello,
    I want to count of rows in each table in a schema say test, of DEV1 database to another schema say test of DEV2 database. both have same schema data in both the databases. my output should look something like this.
    Tablename
    database name DEV!, schema name test , tablename: count
    database name DEV2, schema name test , tablename: count
    can someone help me please.
    Thanks a lot

    Give this a try in dba1 - assuming there is a db link in dba1 to dba2:
    select 'DBA1', count(*) from table
    union all
    select 'DBA2', count(*) from table@dba2
    Note that if these are large tables, you may want to gather stats on the two tables (IMPORTANT) and then do
    select 'DBA1', num_rows from all_tables where table_name = 'TABLE'
    union all
    select 'DBA2', num_rows from all_tables@dba2 where table_name = 'TABLE'
    If you don't gather stats - the num_rows column in all_tables will reflect the number of rows that were present when stats were last gathered and will not reflect any inserts/deletes that have taken place since.
    The "union all" clause differs from "union" in that "union all" shows every matching result from both halves of the union - whereas union will only show each unique result once.
    Hope this helps!

  • Two ifs schemas on the same database?

    Can I use two different ifs schemas on the same oracle DB for two different IFS instances on two different machines? I don't want to run two databases due to memory issues, but I wanted to run two different ifs schemas (one for development/testing, and one for production). Are there any issues associated with this?

    I am not aware of any iFS-specific issues if you are running the database on a separate machine from your middle-tier iFS boxes.
    But you will have the standard problems of having one database for development and production (e.g. if you need to bring down the development database for any reason, you impact the production database, since they're the same).
    The only problem I can think of related to iFS is that you will be sharing one Context queue, so that if you have any documents loading in from your development environment which cause problems in the queue, your production iFS will suffer.

  • How to re-use a PL/SQL procedure on 2 different logical schemas

    Hi all,
    I need to run the same Oracle PL/SQL procedure on 2 databases (source/target).
    How can I re-use the code without having to duplicate the codeof the procedure because as it is a Oracle procedure, I need to declare the logical schema ?
    ==> does the procedure need to be re-written in Jython ?
    Thanks to your all .
    Nb my procedure code :
    CREATE TABLE COUNT_ROWS AS SELECT TABLE_NAME , NUM_ROWS FROM DBA_TABLES WHERE OWNER_NAME = 'SYSADM'
    Edited by: Meapri on Mar 18, 2011 3:37 AM

    The only problem is when writing an ODI procedure using the Oracle Technology in ODI Designer, ODI asks for the Schema.
    If I do not assign a value to the schema field when I run my ODI procedure I get the error message :
    java.lang.Exception: Internal error: object ConnectConnection
    ColConnectId:null
    ColContextCode:CTX_SRC
    ColConName:null
    ColIndCommit:null
    ColIsolLevel:null
    ColLschemaName:null
    ColPlanComp:null
    ColTechIntName:null
    DefConnectId:null
    DefContextCode:CTX_SRC
    DefConName:null
    DefIndCommit:null
    DefIsolLevel:null
    DefLschemaName:null
    DefPlanComp:null
    DefTechIntName:ORACLE
    ExeChannel:J
    IndErr:0
    IndLogMethod:null
    IndLogNb:null
    LogLevDet:3
    Nno:1
    OrdTrt:0
    ScenTaskNo:1
    SessNo:4152001
    TaskName1:Traitement
    TaskName2:CNT_SRC_ALL
    TaskName3:DROP COUNT_ROWS

  • Reading an EXCEL file from Oracle PL/SQL (HP-Unix server)

    Hi,
    I have the following requirement:
    1. Get the EXCEL file from the remote FTP location
    2. Read the EXCEL file and convert it into the CSV file format.
    3. Put the CSV file into another FTP location.
    I need to get all these points done using Oracle PL/SQL procedure.
    I am using the Oracle 9i installed in HP-Unix environment.
    Please help me in getting this done.
    Thanks

    Ok, setting up Excel as an External Database connection....
    1- Go to Control Panel>Administrative Tools>Data Sources (ODBC)>System DSN and create a data source with appropriate driver. Name it EXCL.
    2- In %ORACLE_HOME%\Network\Admin\Tnsnames.ora fie add entry:
    EXCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.0.24)(PORT = 1521))
    (CONNECT_DATA =
    (SID = EXCL)
    (HS = OK)
    Here SID is the name of data source that you have just created.
    3- In %ORACLE_HOME%\Network\Admin\Listener.ora file add:
    (SID_DESC =
    (PROGRAM = hsodbc)
    (SID_NAME = <hs_sid>)
    (ORACLE_HOME = <oracle home>)
    under SID_LIST_LISTENER like:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = d:\ORA9DB)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = ORA9DB)
    (ORACLE_HOME = d:\ORA9DB)
    (SID_NAME = ORA9DB)
    (SID_DESC =
    (PROGRAM = hsodbc)
    (SID_NAME = EXCL)
    (ORACLE_HOME = D:\ora9db)
    Dont forget to reload the listener
    c:\> lsnrctl reload
    4- In %ORACLE_HOME%\hs\admin create init<HS_SID>.ora. For our sid EXCL we create file initexcl.ora.
    In this file set following two parameters:
    HS_FDS_CONNECT_INFO = excl
    HS_FDS_TRACE_LEVEL = 0
    5- Now connect to Oracle database and create database link with following command:
    SQL> CREATE DATABASE LINK excl
    2 USING 'excl'
    3 /
    Database link created.
    Now you can perform query against this database like you would for any remote database.
    SQL> SELECT table_name FROM all_tables@excl;
    TABLE_NAME
    DEPT
    EMP
    But you're limited to Windows based servers for this.
    As for converting Excel to CSV and doing it yourself. I hope you know the internal format of MS Excel files cos you're gonna need to know it. It would be far easier if the "user" creating the Excel file could save a copy out in CSV format for you and then it's just a case of FTP'ing the file and using external tables to read the data.

  • Are the Pl/sql procedure and function atomic by themself

    i want to ask a question does oracle pl/sql procedure and function support Atomicity for the database by themself , or they became atomic incase we call them using begin -- end;

    You appear to be discussing transaction scope which is completely independent of PL/SQL blocks like procedures or how you call procedures. It's all in where commits (or rollbacks) are issued.
    If you have a procedure like this
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;where the first statement succeeds and the second statement fails as a result of a duplicate key, there will still be a Foo row in the table but the procedure will have thrown an exception. The caller of the procedure may choose to commit or rollback the change-- that will determine whether the first statement's results are made permanent. If you have a procedure like this,
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      commit;
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;the commit will make the first insert permanent regardless of whether the second statement fails no matter what the calling code does (that's one reason that putting commits in stored procedures is generally a bad idea-- the caller is in a much better position to know what other uncommitted work has been done and whether it is safe to commit.
    Justin

  • How to use pl/sql procedure or function as part of validate the entity obj?

    Hi,
    we are migrating from oracle forms to jdeveloper 11g.
    I have a req. that,i wanted to use oracle pl/sql procedure to validate a attribute in an entity created with ADF BC?
    Is it possible to implement this?
    And how to show the error message from pl/sql procedure?
    Regards
    Murali.

    Hi,
    It is possible by using a method validator for the entity attribute.
    Create a transient attribute 'X'.
    In the validation section of the attribute to be validate, choose method validator.
    In the Error Message tab set error message as {0}.
    Below the value for tokentoken should source.X (X is the transient attribute name)
    In the java code of method validator, call the stored procedure and set the value of transient attribute X with the error message from SP.
    Use setX("ErrorMessage").
    Regards,
    Srinidhi

  • Best Practice for ViewObjects when inserting data through pl/sql procedure

    My applications is oracle form based enterprise level application and we are now developing new module in ADF 11g but there is restriction that all data insertion, updation, and deletion will be through oracle pl/sql procedures. Now my question is that adf pages should be binded with ViewObjects based on Entity Object or with Viewobjects not based on Entity / sql query. Currently I have developed pages with programmatic ViewObjects which are neither based on Entity Objects nor on sql query. In those view objects, i create transient attributes and then used it to create adf pages. Then on save, i extract the data from ViewObject's current row and pass it to procedure. This is working fine but just wondering whether this approach is ok or there is better alternative for that. Ideally i want to create ViewObjects based on EntityObject but don't finding any way to synchronize entityObjects with data inserted through procedures.

    Hi,
    I create a EO for the Database-View and override the doDML()-Method. For insert/update and delete I call the pl/sql-functions.
    See "38.5 Basing an Entity Object on a PL/SQL Package API" in Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development
    Framework.

  • How to create directories with same name in different schemas

    I have two schemas on the same database.
    I am trying to create directories with same name, but different paths in both the schemas.
    When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    Is there any solution to create directories with same name, but different path in two different schemas on the same database.
    Thanks,
    Sridhar.

    Hi,
    >>When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    If you have removed the REPLACE clause of your create statement, then you would see that is not possible.
    SYSTEM> connect scott/tiger
    Connected.
    SCOTT> create directory mydir as '/tmp';
    Directory created.
    SCOTT> connect legatti/pwd
    Connected.
    LEGATTI> create directory mydir as '/tmp';
    create directory mydir as '/tmp'
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    LEGATTI> select owner,object_name,object_type,created
      2  from dba_objects where object_name='MYDIR';
    OWNER     OBJECT_NAME    OBJECT_TYPE         CREATED
    SYS       MYDIR          DIRECTORY           19/12/2007Cheers
    Legatti

  • Error during calling PL/SQL procedure

    Hi,
    Error occurs while calling the oracle PL/SQL procedure from Java using Callable Statement.
    Below is my code
    cs = conn.prepareCall("{call prc_ins(?, ?, ?, ?, ?, ?,?)}");                              cs.setString(1, strAryCols[11]);
         cs.setString(2, strAryCols[5]);
         cs.setString(3, strAryCols[8]);
         cs.setString(4, strAryCols[10]);
         cs.setString(5, strAryCols[7]);
         cs.setString(6, "ER");     
         cs.registerOutParameter(7, Types.VARCHAR);
         cs.execute();
    I receive the following Error Message
    Error in Inserting: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PRC_INS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Can somebody help?
    Regards,
    RPS15

    RPS15 wrote:
    Hi,
    Error occurs while calling the oracle PL/SQL procedure from Java using Callable Statement.
    Below is my code
    cs = conn.prepareCall("{call prc_ins(?, ?, ?, ?, ?, ?,?)}");                              cs.setString(1, strAryCols[11]);
         cs.setString(2, strAryCols[5]);
         cs.setString(3, strAryCols[8]);
         cs.setString(4, strAryCols[10]);
         cs.setString(5, strAryCols[7]);
         cs.setString(6, "ER");     
         cs.registerOutParameter(7, Types.VARCHAR);
         cs.execute();
    I receive the following Error Message
    Error in Inserting: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PRC_INS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Can somebody help?
    Regards,
    RPS15Most of the times I see people calling stored procedures which return an output parameter, the SQL looks like this:
    {? = call blah(?, ?, ...)}
    [http://www.google.com/search?hl=en&q=prepareCall+call+registerOutParameter]

  • Data filter when migrating Oracle to SQL

    How can I use a data filter (via t-sql or ??) when using SSMA to migrate data from Oracle to SQL Server ?

    Hi sqlworker,
    SQL Server Migration Assistant for Oracle are designed to migrate data from Oracle to SQL Server, we can convert and synchronize the schema of database, the particular category of the schema, and the attributes of objects. However, we can only use data filter
    to help you retrieve from a database table by using the WHERE clause to specify search conditions in SQL. According to your description, we need to verify if you just want to migrate some specific data from Oracle to SQL Server, or just use data filter in
    SQL Server after migration. You can post more information for analysis.
    For more information, you can review the following article.
    migrating
    data form Oracle to SQL Serve via SSMA.
    Filtering Data Retrieved from Database Table in SQL
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • JDBC Lookup - Import table data from a different schema in same DB

    Hi XI Experts,
    We are facing an issue while importing a Database table into the external definition in PI 7.1.
    The details are as below:
    I have configured user 'A' in PI communication channel to access the database. But the table that I want to access is present in schema "B". Due to this, I am unable to view the table that I have to import in the list available.
    In other words, I am trying to access a table present in a different schema in the same database. Please note that my user has been given all the required permissions to access different schema. Even then, I am unable to access the table in different schema.
    Kindly provide your valuable suggestions as to how I can import table which is present in another schema but in the same Database.
    Regards,
    Subbu

    If you are using PI 7.1, then you can do JDBC Lookup to import JDBC meta data (table structures from DB). Configure a jdbc receiver communication channel where you specify username and password which has permission to access schema A and Schema B of database. Specify database name in the connection string. Then you might have access to import both schema.
    Please refer these links
    SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups
    How to use JDBC Lookup in PI 7.1 ?

Maybe you are looking for

  • Unable to open X5 project

    The project I work on is created with RoboHelp X5. One of my clients is updating his own help for my project and uses RoboHelp6. Now the project he just sent back to me won't open in RoboHelp X5 anymore. I always get error: "This project is from a ne

  • Cant sync from 2 diffrent computers (movies/games)

    I bought 2 games and 2 movies from my other laptop,then sync it to my ipod classic. but now when i try to load all my audio from my main computer it will ask me to either erase and sync or tranfer purchases. also said that this ipod is all ready has

  • Airport only works on certain computers...

    I have two APX and two AX. Even if I use just one APX still only my 15in powerbook will have inernet. My other computers (G4 Cube, and two older iBooks) will recognize my network, but in the network status pane in system preferences it registers yell

  • Delivery posting

    i am using IDOC_INPUT_DESADV1 for updating Purchase Order Confirmation Tab Details. I dont want to create a Inbound Delivery for that. I only need confirmation details but not inbound delivery. Can anyone help me out ....

  • Sattelite C55-A recovery media order taking forever

    I ordered recovery media on 3/22/15 at a cost of $39. I received an email saying it was shipped on 3/23 with a tracking number, but DHL has still not received it on 3/28. Support tells me to 'be patient', and one Rep actually told me that it was 'in