NLS over dblink

we have two oracle 8.1.7 databases - the first one with charset EE8MSWIN1250 the second with WE8DEC.
In the second db there is a dblink to the first one.
Users have their NLS_NCHAR environment variable set to EE8MSWIN1250.
When they are connected to the second database and are accessing tables from the first db through the link data conversion occurs (I guess) two times first from EE8MSWIN1250 to WE8DEC (over dblink) and then from WE8DEC back to the EE8MSWIN1250 (to user code page) and some chars are replaced by '?'.
Is there any way how to get those data unchanged ?

Hi Janus,
Unfortunately what you are seeing is the expected behavior. Assuming for now that the two databases were created with the correct database character sets.
EE8MSWIN1250 is for Eastern European languages; hence you must be storing one or more of these language data inside your database: Croatian, Hungarian, Polish, Romanian, Czech or Slovenian.
WE8DEC is for Western European languages; this is for storing French, German and Spanish etc.
Now if you start pushing data from one database character set to another, Oracle will always try and apply character set conversion to preserve your data; however these two character sets are not compatible, when Oracle encounters any characters than can not be stored in the target database character set, replacement characters such as '?' will be used. See below for the differences between the 2 character sets.
Characters in WE8DEC that are not in EE8MSWIN1250
INVERTED EXCLAMATION MARK
CENT SIGN
POUND SIGN
YEN SIGN
FEMININE ORDINAL INDICATOR
SUPERSCRIPT TWO
SUPERSCRIPT THREE
SUPERSCRIPT ONE
MASCULINE ORDINAL INDICATOR
VULGAR FRACTION ONE QUARTER
VULGAR FRACTION ONE HALF
INVERTED QUESTION MARK
LATIN CAPITAL LETTER A WITH GRAVE
LATIN CAPITAL LETTER A WITH TILDE
LATIN CAPITAL LETTER A WITH RING ABOVE
LATIN CAPITAL LETTER AE
LATIN CAPITAL LETTER E WITH GRAVE
LATIN CAPITAL LETTER E WITH CIRCUMFLEX
LATIN CAPITAL LETTER I WITH GRAVE
LATIN CAPITAL LETTER I WITH DIAERESIS
LATIN CAPITAL LETTER N WITH TILDE
LATIN CAPITAL LETTER O WITH GRAVE
LATIN CAPITAL LETTER O WITH TILDE
LATIN CAPITAL LETTER O WITH STROKE
LATIN CAPITAL LETTER U WITH GRAVE
LATIN CAPITAL LETTER U WITH CIRCUMFLEX
LATIN SMALL LETTER A WITH GRAVE
LATIN SMALL LETTER A WITH TILDE
LATIN SMALL LETTER A WITH RING ABOVE
LATIN SMALL LETTER AE
LATIN SMALL LETTER E WITH GRAVE
LATIN SMALL LETTER E WITH CIRCUMFLEX
LATIN SMALL LETTER I WITH GRAVE
LATIN SMALL LETTER I WITH DIAERESIS
LATIN SMALL LETTER N WITH TILDE
LATIN SMALL LETTER O WITH GRAVE
LATIN SMALL LETTER O WITH TILDE
LATIN SMALL LETTER O WITH STROKE
LATIN SMALL LETTER U WITH GRAVE
LATIN SMALL LETTER U WITH CIRCUMFLEX
LATIN SMALL LETTER Y WITH DIAERESIS
LATIN CAPITAL LIGATURE OE
LATIN SMALL LIGATURE OE
LATIN CAPITAL LETTER Y WITH DIAERESIS
Characters in EE8MSWIN1250 that are not in WE8DEC
NO-BREAK SPACE
BROKEN BAR
DIAERESIS
NOT SIGN
SOFT HYPHEN
REGISTERED SIGN
ACUTE ACCENT
CEDILLA
MULTIPLICATION SIGN
LATIN CAPITAL LETTER Y WITH ACUTE
DIVISION SIGN
LATIN SMALL LETTER Y WITH ACUTE
LATIN CAPITAL LETTER A WITH BREVE
LATIN SMALL LETTER A WITH BREVE
LATIN CAPITAL LETTER A WITH OGONEK
LATIN SMALL LETTER A WITH OGONEK
LATIN CAPITAL LETTER C WITH ACUTE
LATIN SMALL LETTER C WITH ACUTE
LATIN CAPITAL LETTER C WITH CARON
LATIN SMALL LETTER C WITH CARON
LATIN CAPITAL LETTER D WITH CARON
LATIN SMALL LETTER D WITH CARON
LATIN CAPITAL LETTER D WITH STROKE
LATIN SMALL LETTER D WITH STROKE
LATIN CAPITAL LETTER E WITH OGONEK
LATIN SMALL LETTER E WITH OGONEK
LATIN CAPITAL LETTER E WITH CARON
LATIN SMALL LETTER E WITH CARON
LATIN CAPITAL LETTER L WITH ACUTE
LATIN SMALL LETTER L WITH ACUTE
LATIN CAPITAL LETTER L WITH CARON
LATIN SMALL LETTER L WITH CARON
LATIN CAPITAL LETTER L WITH STROKE
LATIN SMALL LETTER L WITH STROKE
LATIN CAPITAL LETTER N WITH ACUTE
LATIN SMALL LETTER N WITH ACUTE
LATIN CAPITAL LETTER N WITH CARON
LATIN SMALL LETTER N WITH CARON
LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
LATIN SMALL LETTER O WITH DOUBLE ACUTE
LATIN CAPITAL LETTER R WITH ACUTE
LATIN SMALL LETTER R WITH ACUTE
LATIN CAPITAL LETTER R WITH CARON
LATIN SMALL LETTER R WITH CARON
LATIN CAPITAL LETTER S WITH ACUTE
LATIN SMALL LETTER S WITH ACUTE
LATIN CAPITAL LETTER S WITH CEDILLA
LATIN SMALL LETTER S WITH CEDILLA
LATIN CAPITAL LETTER S WITH CARON
LATIN SMALL LETTER S WITH CARON
LATIN CAPITAL LETTER T WITH CEDILLA
LATIN SMALL LETTER T WITH CEDILLA
LATIN CAPITAL LETTER T WITH CARON
LATIN SMALL LETTER T WITH CARON
LATIN CAPITAL LETTER U WITH RING ABOVE
LATIN SMALL LETTER U WITH RING ABOVE
LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
LATIN SMALL LETTER U WITH DOUBLE ACUTE
LATIN CAPITAL LETTER Z WITH ACUTE
LATIN SMALL LETTER Z WITH ACUTE
LATIN CAPITAL LETTER Z WITH DOT ABOVE
LATIN SMALL LETTER Z WITH DOT ABOVE
LATIN CAPITAL LETTER Z WITH CARON
LATIN SMALL LETTER Z WITH CARON
CARON
BREVE
DOT ABOVE
OGONEK
DOUBLE ACUTE ACCENT
HORIZONTAL BAR
LEFT SINGLE QUOTATION MARK
RIGHT SINGLE QUOTATION MARK
LEFT DOUBLE QUOTATION MARK
RIGHT DOUBLE QUOTATION MARK
EURO SIGN
TRADE MARK SIGN
However, there is also a very likely possibility that your current database character sets may not reflect the encoding of the data inside your database; in that case you need to change the database character set of your current database. Please refer to the White Paper (Character Set Migration Best Practices on the Globalization Support Home Page on OTN.http://technet.oracle.com/tech/globalization/content.html
Regards
Nat

Similar Messages

  • ORA-01653 error while executing a select query over DBLINK

    Hi,
    We have a query that is running to extract some data from a remote DB over DBLINK.
    The query is failing by throwing the error "ORA-01653 -- Unable to extend.........".
    Is this a problem with the "temp" tablespace of local database or is this with the "temp" tablespace of remote DB.
    As far as my knowledge goes, I guess any statement , selecting data over dblink where the query is being fired actually in remote db over dblink uses the temp tablespace of that DB only and hence the problem should be with the temp tablespace of remote db only but I am not very sure about this.
    Is there any chance that it can be problem with "temp" tablespace of local DB from where the query is being fired over dblink.
    It would be really helpful if anyone can throw some light on this.
    Thanks

    The error stack will normally tell you if the exception is raised in the remote database.
    You might try using the driving_site hint (see performance guide) to push work to the remote site or pull it local. It all depends on your particular query and explain plan.
    Remember to use { code } (without the embedded spaces) tags to frame your code and explain plan so it remains formatted, if you post it here.

  • Purge MV logs over dblink

    Is it possible to purge MVlogs over dblink? what syntax needs to be followed?
    begin
    dbms_snapshot.purge_log('testing_mview@ORCL10R2',1,'DELETE' );
    END;
    ORA-20000: ORA-00979: illegal reference to remote database
    ORA-06512: at "SYS.DBMS_IREFRESH", line 77
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2693
    ORA-06512: at line 2

    Hi,
    I'd rather try something like this:
    BEGIN
    dbms_snapshot.purge_log@ORCL10R2('testing_mview',1,'DELETE' );
    END;

  • Pass a type over dblink

    Hi,
    If I have defined a type as:
    create or replace type MyType is table of number(10);
    , can I so something like this (this block is executed from machine A):
    declare
    varType MyType;
    begin
    varType := MyType();
    for i in 1..10 loop
      varType.extend;
      varType(varType.last) := i;
    end loop;
    -- then call a remote procedure, for which the 3rd parameter is of MyType type
    <schema>.<procedure_name>@<dblink_name<(param1, param2, varType);
    So can I call from machine A, a remote procedure (from machine B), and pass to it that varType parameter of that type? Is this supported over dblink?
    That MyType type is created on both machines.
    Thank you.

    Perhaps this will convince you then:
    Restriction on Using User-Defined Types with a Remote Database
    Objects or user-defined types (specifically, types declared with a SQL CREATE TYPE statement, as opposed to types declared within a PL/SQL package) are currently useful only within a single database. Oracle Database restricts use of a database link as follows:
    You cannot connect to a remote database to select, insert, or update a user-defined type or an object REF on a remote table. You can use the CREATETYPE statement with the optional keyword OID to create a user-specified object identifier (OID) that allows an object type to be used in multiple databases. See the discussion on assigning an OID to an object type in the Oracle Database Data Cartridge Developer's Guide. You cannot use database links within PL/SQL code to declare a local variable of a remote user-defined type.
    You cannot convey a user-defined type argument or return value in a PL/SQL remote procedure call.
    http://docs.oracle.com/cd/E11882_01/appdev.112/e11822/adobjbas.htm#ADOBJ7083

  • ORA-00904 over DBLINK

    Hi,
    I have a cursor which queries some tables over a DBLINK. The remote
    database is Oracle 8.1.7.4 and package is being compiled on 10.2.0.3
    Since this morning I am getting the below error message while trying
    to compile the package:
    112/10 PL/SQL: ORA-00904: "MIL"."ORGANIZATION_ID": invalid
    identifier
    However, when I run the cursor query in a different SQL session, it
    fetches data. The cursor definition is
    CURSOR curLocators(pOrganizationId NUMBER) IS
    SELECT ood.organization_code organization_code
    ,NULL row_organization_id
    ,mil.segment1||'.'||mil.segment2||'.'||mil.segment3||'.'||
    mil.segment4 Concatenated_Segments
    ,NULL row_item_id
    ,mil.description
    ,mil.inventory_location_type --no longer used
    ,mil.picking_order
    ,mil.location_maximum_units
    ,mil.subinventory_code
    FROM mtl_item_locations@convsourcedb mil
    ,mtl_material_statuses_vl@convsourcedb mms
    ,org_organization_definitions@convsourcedb ood
    ,(SELECT sum(total_qoh) total_qoh,
    subinventory_code,
    organization_id,
    locator_id
    FROM mtl_onhand_locator_v@convsourcedb
    GROUP BY locator_id, subinventory_code,
    organization_id
    ) mol
    WHERE 1=1
    AND NVL(mil.status_id,1) = mms.status_id(+)
    AND ood.organization_id = mil.organization_id
    AND mms.status_code = 'Active'
    AND mil.enabled_flag = 'Y'
    AND mol.organization_id = mil.organization_id
    AND mol.locator_id = mil.inventory_location_id
    AND mil.organization_id = pOrganizationId
    The column definetely exists in the base table
    SQL> select organization_id from mtl_item_locations@convsourcedb where
    rownum=1;
    ORGANIZATION_ID
    216
    I tried to comment out the where clause which is throwing the error,
    but the package compilation fails with another Where clause error.
    All this was working absolutely fine till last evening and I have not
    changed the cursor query since then.
    How can I rectify this?
    Any inputs would be greatly appreciated.
    Thanks,
    Ashish

    Hi Ashish,
    Maybe the link user and the owner of the remote table are not the same?
    What do you have here :
    select tab.owner remote_owner, lnk.username link_user
      from all_db_links lnk, all_tables@convsourcedb tab
    where tab.table_name = 'MTL_ITEM_LOCATIONS'
       and lnk.db_link = 'CONVSOURCEDB';Regards
    Peter

  • ORA-02063 when selecting over DBLINK

    Hey, I'm having an issue where a complex select is returning a 02063 (it has an 'invalid identifier' on a column that clearly exists)
    I would post the query but it's pretty large and joins 2 views. One of the views selects through a dblink, so it's imbedded pretty far in. I cannot isolate parts of the query that are causing the issue because of this.
    What I wanted to know is the best way to write the link or the view to avoid these parser issues. Here's the complete error message I get as well as the script for the link:
    ORA-00904: "A"."BUYING_MEMBER_ID": invalid identifier
    ORA-02063: preceding line from WEBAPP6
    create public database link "WEBAPP6.REGRESS.RDBMS.DEV.US.ORACLE.COM"
    connect to ABC_WEBAPP
    identified by "<pwd>"
    using 'abcdb';
    And the script for the view which uses the link:
    SELECT a.ID member_id, a.NAME member_nm, a.url member_url, a.address_1,
    a.address_2, a.city, a.fda_license, a.is_abc_board_member,
    a.is_gsabc_board_member, a.is_abc_foundation_board_member,
    c.short_name state_id, d.code zip_cd, e.code county_cd, a.phone_main,
    a.phone_alt, a.fax, b.financial_ctr_id, b.benchmarking_ctr_id,
    b.piag_ctr_id
    FROM MEMBER@webapp6 a LEFT OUTER JOIN lu_member_dw b ON a.ID = b.member_id
    JOIN state@webapp6 c ON a.state_id = c.ID
    JOIN zip@webapp6 d ON a.zip_id = d.ID
    JOIN county@webapp6 e ON a.county_id = e.ID
    UNION
    SELECT member_id, member_nm, member_url, ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', financial_ctr_id, benchmarking_ctr_id,
    piag_ctr_id
    FROM lu_member_dw
    WHERE member_id NOT IN (SELECT ID
    FROM MEMBER@webapp6)

    Always use alias names! If you have no alias name, create one. Without alias the database can just guess where this column is coming from.
    Consider UNION ALL instead of union (not sure if it is the same result).
    Consider to create a view on the other database that joins all tables and that you access over the DB-Link.
    There are also some hints that influences where the selects are executed (on your DB or on the other one), however I forgot the name of them (PUSH_SUB?).

  • Increase speed over dblink

    Hey Guys,
    I am trying to perform the following select statement over a DBLINK.
    SELECT SUM(COLUMN1) one,
           SUM(COLUMN2) two,
           SUM(COLUMN3) three,
           SUM(COLUMN4) four
    FROM MY_TABLE@DBLINK MY_TABLEThe table I a selecting from has 12 million rows and to perform a simple SELECT COUNT(1) takes three and a half minutes. Any suggestions on how to increase the speed of the select statement over the DBLINK. I tried looking for a similar post but I didn't find anything.
    Thank you,
    Tyson Jouglet

    user526523 wrote:
    Seems like your are trying to get summary information from a table through Dblink. Performance of such action will directly depends on your network speed.In this case, though, the query itself is only returning 1 row of data, so network speed should be inconsequential. If Oracle is trying to pull all the data over the network to do the aggregation locally, that would be network bound, but that would be the wrong query plan-- we want the remote database to do the aggregation.
    If the actual queries are doing aggregations that return lots of data (i.e. pivoting by different dimensions), then network speed might well start coming in to play. But as long as the aggregate queries are returning relatively few rows and the query plans are correct so that it's just the aggregate result getting shipped over the database link, network performance shouldn't be a big deal.
    Justin

  • Poor CLOB performance over dblink

    These statements take 4 seconds to complete:
    drop table t_test purge;
    create table t_test as
    SELECT CONTENT_ID,SITEID
    from sitecontent@remotedb;These statements don't complete after at least 10 minutes of waiting:
    drop table t_test purge;
    create table t_test as
    SELECT CONTENT_ID,SITEID, BODY
    from sitecontent@remotedb;The only difference is that the second SQL contains a reference to BODY, which is a CLOB column.
    The SITECONTENT table consists of just 2815 records. The CONTENT_ID and SITEID columns are NUMBER. A max(length(body)) returns a result of 29,005. And a count where length(body)>15000 returns just 115. So we are not talking about huge amounts of data for the table, nor large amounts for very many rows. Certainly not enough, I would have thought, to explain a difference in completion times between about 4 seconds and apparently forever.
    Is this a known issue with CLOBs over database links? (I have looked, but not found anything relevant). Is there anything I can do to remedy the situation (not asking for quick fixes, just any steps I can plod my way through!). When I look at the local database, it's just constantly waiting on SQL*Net message from dblink.
    This is 11.2.0.1 on RHEL5.5 x86_64.
    Thanks in advance.

    Well, I tried that:
    Connected.
    SQL> set autotrace traceonly explain statistics;
    SQL> create table t_test as select ctext from clobtest@remotedb;
    Table created.
    SQL>No statistics were displayed, in other words. (Same result when selecting vtext, as it happens). I don't think autotrace works on DDL statements, does it? It's working fine for selects, though. So, ignoring the create table bit for now, here's the Vtext statistics:
    SQL> select vtext from clobtest@remotedb;
    2831 rows selected.
    Execution Plan
    Plan hash value: 1402521094
    | Id  | Operation              | Name     | Rows  | Bytes | Cost (%CPU)| Time     | Inst   |
    |   0 | SELECT STATEMENT REMOTE|          |  2994 |  5853K|   312   (1)| 00:00:04 |        |
    |   1 |  TABLE ACCESS FULL     | CLOBTEST |  2994 |  5853K|   312   (1)| 00:00:04 |   RMDB |
    Note
       - fully remote statement
       - dynamic sampling used for this statement (level=2)
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
        3629480  bytes sent via SQL*Net to client
           2428  bytes received via SQL*Net from client
            190  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
           2831  rows processedI can't produce the equivalent Ctext statistics, of course, since a select from a remote clob simply generates an ORA_22992.
    I'm sort-of stumped at this point.

  • Reading bytea column over dblink

    Hi,
    I try to read bytea column from postgresql db over a dblink in Oracle DB. But I could not. How can I solve the problem?
    In windows environment there is a parameter in odbc driver bytea as LO. I could not find how to set it on unix odbc.
    Versions of products I Use:
    Postgresql 8.3.3 on redhat
    Oracle DB : 10.2.0.4 on HP/UX
    HSODBC : 10.2.0.4

    CURRENT_DATE is not supported:
    Supported SQL Syntax and Functions
    However, from reading this part:
    Supported SQL Syntax and Functions
    it becomes clear that you'll need to use a string of DATE datatype (in a fixed format) or select from a DATE column.
    You could just boldly try: to_date(CURRENT_DATE) , but you'll probably receive ORA-02070 again...

  • Pass PL/SQL collection as function parameter over DBLink

    Hi all,
    I am trying to do the following;
    ---Remote database
    --create SQL type
    create type attributeidarray as table of varchar2(255);
    --create a package specs
    CREATE OR REPLACE PACKAGE testp
    AS
    TYPE ref_res IS REF CURSOR;
    FUNCTION foo (i NUMBER)
    RETURN NUMBER;
    FUNCTION foo1 (i NUMBER, j attributeidarray)
    RETURN NUMBER;
    END;
    --create package body
    CREATE OR REPLACE PACKAGE BODY testp
    IS
    --Function does nothing other than return number
    FUNCTION foo (i NUMBER)
    RETURN NUMBER
    IS
    res ref_res;
    a array_n;
    BEGIN
    OPEN res
    FOR
    SELECT *
    FROM DUAL;
    RETURN 1;
    END;
    --Function takes the collection as imput and does nothing with it. Function just returns number
    FUNCTION foo1 (i NUMBER, j attributeidarray)
    RETURN NUMBER
    IS
    res ref_res;
    a array_n;
    BEGIN
    OPEN res
    FOR
    SELECT *
    FROM DUAL;
    RETURN 1;
    END;
    END;
    --"Near" Database ..
    --create a SQL type
    --This is the exactly the same as in remote database
    create type attributeidarray as table of varchar2(255);
    --create a DBLink
    create database link con_to_remote_db
    connect to remotedbuser
    identified by "swordfish"
    using 'remotedb'
    --call the remote functions and pass a collection object
    SQL> DECLARE
    2 a attributeidarray;
    3 BEGIN
    4 SELECT CAST (attributeidarray (1, 2) AS attributeidarray)
    5 INTO a
    6 FROM DUAL;
    7
    8 :b := testp.foo@con_to_remote_db (2);
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    SQL> print b
    B
    1
    SQL>
    --so far so good...
    SQL> DECLARE
    2 a attributeidarray;
    3 BEGIN
    4 SELECT CAST (attributeidarray (1, 2) AS attributeidarray)
    5 INTO a
    6 FROM DUAL;
    7
    8 :b := testp.foo1@con_to_remote_db (2, a);
    9 END;
    10 /
    :b := testp.foo1@con_to_remote_db (2, a);
    ERROR at line 8:
    ORA-06550: line 8, column 10:
    PLS-00306: wrong number or types of arguments in call to 'FOO1'
    ORA-06550: line 8, column 4:
    PL/SQL: Statement ignored
    --Oops...doesn't seem to recognize the collection type :( /b]
    So I wish to know the following;
    - Even though the definition for type is the same, why is the remote DB not recognizing my type?
    - It would be helpful if any one can let me know the correct method to pass a collection type with a example.
    I would appreciate any help in resolving this issue.
    Thanks,
    prashant

    Not possible. For valid technical reasons.
    Definitions are local to a database. You can define a SQL user type called TMyType in your database. I can define one in mine with the same name.
    Can you now call my database, passing a collection of your TMyType to me? How do we (or Oracle) know that your definition and my definition is the same? Or if they were the same when you compiled your code (and your Oracle checked my Oracle to confirm), that they still are the same and that I did not in the meantime altered the type? Or even dropped it?
    For types/collections to be transparently passed across to database links, we need something along the lines of:
    a) global types
    b) runtime checking of types
    Both are problematic to implement and maintain. With (a) there is the issue of dependencies. The global type cannot be changed before all dependencies on all subscribers have been resolved. With (b) there is the issue of performance, checking the type definitions with every single call on the local & remote instances to compare.
    It would be a nice feature to have... but it would fail to live up to expectation if not implemented in a robust and performant way.
    Alternative. "Insert" data via a remote proc into a remote collection. This allows you to push data into a PGA memory structure on the remote side and when done, allows you to tell that remote proc to "flush" (forall insert/update/delete) the contents of that structure to disk.

  • Impdp over dblink from 10.1.0.3 to 10.1.0.2

    Hello everybody,
    I am trying to copy some schemas from a test environment (Oracle EE 10g 10.1.0.3 on Linux ) to my development environment (my PC with Ora10g 10.1.0.2 on Win XP) using impdp and a dblink but I get an error (ORA-39006 , ORA-39022) stating that version 10.1.0.3 is not supported...
    Any idea of a workaround?
    Thanks in advance,
    Paolo

    Patch everything to the same version, better still patch to 10.1.0.4.
    or just use cgood old fashioned exp and imp
    Ian

  • Workaround for ORA-14551 WHILE CALLING FUNCTION IN SQL OVER DBLINK

    Hi,
    any idea how to workaround such issue in 9.2.0.8 (I know this is working with 11.2).
    create table mylog(id number, data date , mess clob);
    create or replace function myfunc(id in number, data in date ,mess in varchar2)
    return number is
    pragma autonomous_transaction;
    retval number;
    begin
       insert into mylog values (id , data ,mess);
    commit;
    retval := id;
    return retval;
    end;
    SQL> select schema.myfunc@dblink(2,sysdate,'bbbbbbb') from dual;
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "SCHEMA.MYFUNC", line 6
    ORA-06512: at line 1Regards
    GregG

    DBMS_SQL is documented in what I think 9i calls "Supplied Oracle Packages and Types" manual.
    The basic concept behind this is that it allows you to manually create a cursor and execute it (via an OCI like interface). For example, it can be used to issue remote DDLs via a database link as described in {message:id=10323373}.
    DBMS_SQL provides flexibility and power that is beyond the standard cursor constructs in PL/SQL. The system package version even enables you to execute SQL and PL/SQL code as any other schema in the database.
    You will have however to play around with DBMS_SQL (locally and remotely) to determine how to hide the fact that a local select (which Oracle assumes, correctly, does not change database state), actually changes the state of a remote database.
    Personally I would not bother with such a hack. I would use the problem to enforce an upgrade to the latest Oracle version, or kick out the crappy app that needs to use a SQL select to make database changes.

  • Where clause won't propagate over dblink / function as where condition

    Hi there,
    I've here an rather complex problem with whom google couldn't help me.
    <h3>The Situation</h3>
    I've got two databases ( local db : oracle 10XE, remote db: non-oracle) which are connected via dblink. The connection works perfectly. On local db I want to execute this query:
    select sum(revenue), year, brand1
    from revenues@remote
    where cus_encryptData('MFGR#12', 'mykey') = category -- <--
    group by year, brand1
    order by year;whereas cus_encryptData(<str>, <str>) is user defined function which turns a plaintext into a ciphertext. This function can for security and technical reasons only reside on the local db. Here is the definition:
    create or replace function cus_encryptData2(plain varchar2, pw varchar2)
    return varchar2 deterministic PARALLEL_ENABLE is [...]<h3>The Problem</h3>
    This query works, although very slowly (because a lot of data has to exchanged between remote and local db). The execution plan suggests that the where condition is not propagated to the remote db. The only thing that happens on the remote db is the column select. But when I change the query to:
    select sum(revenue), year, brand1
    from revenues@remote
    where 'dLWEfksdaAWE321asDcASd2' = category --'dLWEfksdaAWE321asDcASd2' == cus_encryptData2('MFGR#12', 'mykey')
    group by year, brand1
    order by year;the where condition is propagated and everything works as it is supposed to (only the aggregation is done locally, but thats ok).
    <h3>The Question</h3>
    Does anybody know how to get oracle to just send the result of cus_encryptData to the remote db or rather to resolve the function first before sending it to the remote db? Moreover, the solution should be as simple as possible, i.e. if possible only standard SQL.
    Thanks a lot
    Chris

    user12047719 wrote:
    I've here an rather complex problem with whom google couldn't help me.A colleague ran into the exact same type of problem, dealing with a db-link to SQL-Server some weeks ago. I created a work-around for hm, but now I'm struggling to recall what it is... Sheez... it has been a long week and it is late Friday afternoon.. ;-)
    The basic issue was to get the local SQL parser to send the literal result (of the function) to the remote server to be parsed.
    If memory serves, I winded up using dynamic SQL. Not actually dynamic string SQL, but passing the value as a bind variable instead of using a function in the SQL statement.
    So instead of something line this:
    begin
      insert into local_table select * from remote_table@external_db where col1 = funkyFoo(123);
      ...Remove the function call and pass a bind variable instead:
    begin
      localVar := funkyFoo(123);
      insert into local_table select * from remote_table@external_db where col1 = localVar;
      ...I'm not sure why Oracle behaves like this. I would have expected the driving_site hint to basically do the same - resolve the local function and use the returned value as a bind variable value in the predicate for the remote SQL.. and I vaguely recall this working when I had to use a foreign database (via the Oracle Transparent Gateway for Informix). But it could have been that the Gateway s/w was more intelligent than the generic ODBC agent typically used today...

  • Calling procedure over dblink - PLS-00306: wrong number or types of args

    Getting the above error when calling a procedure residing in a package on another database over a link.
    The arguments are an object and, a table of objects. The variables being passed are based on objects declared locally that look exactly like the ones the procedure is expecting.
    I haven't done this before so - I'm not sure what the issue is. The execute privilege has been granted on the dependent objects remotely as well as locally. I don't know what else to try and, I have not had any luck looking for a similiar issue online. Please help.

    Thanks but - before doing that I just wanted to see if someone can review this and see if this is my problem:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjbas.htm#466038
    We are using objects declared on the remote database. And, my variables I'm passing are of reference to exact copies on the host. But, from what I understand from the link above - you can't use object types across links. I'm completely lost as to whether this is the issue or not. It seems like a fairly obscure topic as far as documentation goes. If this is the issue however - what is the way around it? We are loading a table of objects with 40,000 plus rows of data to pass to a procedure remotely. If we can't pass the object type - how do we get the rows to the procedure (and, we aren't against modifying the remote procedure - just need to know the best method).
    Thanks in advance for your time - help.

  • Problem with reading data over dblink

    Hi,
    I have a dblink from Oracle 10.2.0.3 db(on windows) to Postgresql 8.3.3 (on centos 4) .
    When trying reading data from Postgresql table , I cannot read varchar colums, in he result set there is no error message.
    In the hs trace file it says "unrecognized data type" for the varchar colums.
    I tried character,text data types, but the error message is the same.
    With Oracle 9.2.0.8 ( on hp/ux platform) there is no problem reading that data types.
    How can I handle this problem?
    Thanks

    Hi,
    i had a similiar problem with 10.2.0.3 querying MS/SQL2000 and Oracle support told me it is a bug which was fixed in 10.2.0.4, however, i couldn't upgrade as SAP was not certified with this version so i had configured a workarround with Oracle support:
    create a DB link from 10.2.0.3 to a 9.2.0.8 DB, in the 9.2.0.8 i have created synonyms through DB link (HS) to the MS/SQL and it solved the problem.
    i know it is not a best solution but it works and production system continue to function.
    dBarak.

Maybe you are looking for

  • How do I prevent Mail from using a particular signing certificate?

    I use Apple Mail for my emails, on a MacBook Pro running Lion 10.7.5. In my Mail client, I have two email accounts configured. One (we'll call this the Signed Account) has a signing certificate purchased from Verisign; the other (the Unsigned Account

  • Is it fair that apple make your device out of date

    It really is not right that apple can make your device outdated when there is nothing wrong with it. I have 2 ipads ones, 1 ipad two,  1 iphone four, 1 iphone two, and 1 ipod touch two. The Ipod touch and the iphone 2 work fine but are becoming more

  • Using External Library in a DC problem (SP16)

    Hi, I've been trying to get the example that Valery is outlining in his <a href="/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro">Blog</a>. I've done it exactly as Valery says, but I can't get it to work. I create

  • White Macbook has delayed start with a blue screen and will not wake when it goes to sleep

    I have a late 2006 MacBook that I recently bought used.  When I got it I was experiencing very long boot times.  It would have the apple logo then go into a blue screen for about 5 minutes before loading to the OS.  Nothing I did fixed the issue.  I

  • HELP with Motorola MotoKRZR K1m

    I purchased a Motorola (MotoKRZR K1m) phone and it syncs with Windows media player to get my music. When I browse to get all of my music files (that I Paid for), none of the iTunes music can be played by Windows Media Player?!? I tried changing the f