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...

Similar Messages

  • Error : The ORDER BY clause is invalid in views, inline functions, derived

    Hi All,
    I am on 11g 6.2, Windows Server 2008, my db SQL server 2008, I am facing the error for the reports in which I am trying to edit one the column formula and do something like 'abc/sum(abc)*100'.
    10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 16001] ODBC error state: 37000 code: 8180 message: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.. [nQSError: 16001] ODBC error state: 37000 code: 1033 message: [Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
    One of the solutions to this which I have found is to edit the EXPRESSION_IN_ORDERBY_SUPPORTED feature in the db properties.
    I want to know what does EXPRESSION_IN_ORDERBY_SUPPORTED means?
    When I create a calculations in 11g like abc/sum(abc) in the column formula for a column then i get this error.
    What does this error mean? Does OBIEE 11g doesn't support using these expressions in the report and the fact that it applies the order by clause to the reports, the report fail?
    Could anybody please explain the issue. There is very limited information on this over the web.
    Thanks in advance.
    Ronny

    Thanks svee for the quick response, actually i had resolved the issue by unchecking the EXPRESSION_IN_ORDERBY_SUPPORTED option in the database. I want to understand how does that makes the difference?
    What does EXPRESSION_IN_ORDERBY_SUPPORTED mean? Does it mean that if I give any expression in my answers report and since obiee uses a order by for all the queries, the expression won't be supported?
    Please explain.

  • 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.

  • Mac Mini won't turn over

    Hi folks,
    A mac mini in my household won't turn over. It gets to the grey Apple screen with the spinning search circle, but stays that way.
    The strange behaviour began after I installed the latest security and safari update via Software Update.
    I tried resetting the pram, using the included install disk to check the HD with disc first aid with no results. Will I have to re-install the OS now?
    Mac Mini PowerPC g4 / 1.5ghz / 512 mb RAM
    Your collective help is appreciated.

    Welcome to Apple Discussions!
    The symptoms you describe and the circumstances in which it occurred are often indicative of a problem with prebinding, and can be caused for example by running the system on other tasks while also applying updates. Prebinding is the process whereby MacOS links executables with their library files, and when it is damaged it can cause the system to become unresponsive or fail.
    When you say that you used the install disk to check the HD 'with no results' I assume you mean that it found no problem. Given that you were able to boot the system with that disk, it demonstrates that the system is healthy, so at that point and assuming you did not get any errors when testing with Disk Utility, I would suggest you boot to the install disk again, and select the option to 'archive and install' (an option that is reached by clicking the button for a custom installation). Archive and Install will put a fresh copy of macOS on the drive, but leave your applications and files untouched. Once the new MacOS copy is installed, you can boot as normal and then I would urge you to download the 10.4.11 combo update from the Apple downloads page (http://www.apple.com/downloads/macosx/apple/macosx_updates/macosx10411comboupdat eppc.html) and install that, before running Software Update to grab any additional updates required.
    Ensure you are not running any applications or performing any other tasks on the system when performing updates - particularly not when you see the system reporting 'Optimizing system' towards the end of an update. This is when the system is actually updating prebinding, and where running anything else can cause problems. This was a known issue and was resolved in MacOS 10.5.x by a different routine for updates.
    As always when doing this kind of work, it is strongly advised that you ensure you have a good backup of all your data first.

  • My comcast mail won't transfer over to my apple mail

    my comcast mail won't transfer over to my apple mail

    Hello Jud,
    Is Comcast POP or IMAP account?
    Where eactly are you having the problem with it? Setup in Mail?
    http://home.comcast.net/~bethkatz/MacMailSetup.html

  • Itunes won't copy over some of my podcasts and purchases since I have moved it to an external hardrive

    So I Have moved over all my purchases and everything to an external hardrive. I did everything right and my itunes story works perfectly fine. However one of my podcasts (yugioh the abridged series) won't copy over along to the ipod saying its file type is not supported by the ipod. It only does this with the first 8 episodes (if you find it you will see them) one of which (the bbt movie) worked perfectly fine on my ipod before but now for some reason it won't. It also won't work on a few of the tv shows that are in hd and one music album that had american boy in it. I'm wondering what I can do to solve this problem. My itunes and my computer (windows vista operating system) is up to date and I have an ipod classic with plenty of room what should I do.

    This doesn't work. The iOS4 upgrade has wiped out synchronization to Outlook to the phone and back. There are many threads on this here, and Apple has yet to address this issue.

  • Using {ts 'yyyy-mm-dd'} escape clause won't work

    Hello,
    I hope someone might answer this on this generic e-mail address
    I found on the page.
    I'm having problems with the {ts} esapce syntax in a SQL query.
    Could anyone help me?
    Here is a list of the following attempts with the {ts} call and
    the Oracle Errors that I'm receiving.
    "Thu Nov 18 15:12:56 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME >=
    {ts 'yyyy/mm/dd'} )ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:12:56 CST 1999","SQLException
    java.sql.SQLException: ORA-00911: invalid character
    "Thu Nov 18 15:13:54 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME >=
    {ts 'yyyy/mm/dd'}) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:13:54 CST 1999","SQLException
    java.sql.SQLException: ORA-00911: invalid character
    "Thu Nov 18 15:15:04 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    = '1999/12/05' {ts 'yyyy/mm/dd'}) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:15:04 CST 1999","SQLException
    java.sql.SQLException: ORA-00907: missing right parenthesis
    "Thu Nov 18 15:16:16 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    = '1999/12/05') {ts 'yyyy/mm/dd'} ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:16:16 CST 1999","SQLException
    java.sql.SQLException: ORA-00933: SQL command not properly ended
    "Thu Nov 18 15:18:58 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME >=
    {ts '1999/12/05'}) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:18:58 CST 1999","SQLException
    java.sql.SQLException: ORA-00911: invalid character
    "Thu Nov 18 15:19:47 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    = '{ts '1999/12/05'}') ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:19:47 CST 1999","SQLException
    java.sql.SQLException: ORA-00907: missing right parenthesis
    "Thu Nov 18 15:20:43 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    = '{ts '1999/12/05'}')) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:20:43 CST 1999","SQLException
    java.sql.SQLException: ORA-00907: missing right parenthesis
    "Thu Nov 18 15:21:25 CST 1999","SELECT * FROM CC_TRANSACTION
    WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    = '{ts '1999/12/05'}')) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    "Thu Nov 18 15:21:25 CST 1999","SQLException
    java.sql.SQLException: ORA-00907: missing right parenthesis
    I've tried everything under the "Sun"...!!!
    I don't really want to hard code the oracle to_char function for
    the app for other RDBMS databases.
    Any Help would be extremely appreciated.
    Thanks,
    Nicholas Neuberger
    E-mail: [email protected]
    null

    Nicholas Neuberger (guest) wrote:
    : Hello,
    : I hope someone might answer this on this generic e-mail
    address
    : I found on the page.
    : I'm having problems with the {ts} esapce syntax in a SQL
    query.
    : Could anyone help me?
    : Here is a list of the following attempts with the {ts} call
    and
    : the Oracle Errors that I'm receiving.
    : "Thu Nov 18 15:12:56 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME >=
    : {ts 'yyyy/mm/dd'} )ORDER BY CC_TRANSACTION.TRANS_DATE_TIME
    ASC;"
    : "Thu Nov 18 15:12:56 CST 1999","SQLException
    : java.sql.SQLException: ORA-00911: invalid character
    : "Thu Nov 18 15:13:54 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME >=
    : {ts 'yyyy/mm/dd'}) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME
    ASC;"
    : "Thu Nov 18 15:13:54 CST 1999","SQLException
    : java.sql.SQLException: ORA-00911: invalid character
    : "Thu Nov 18 15:15:04 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    : >= '1999/12/05' {ts 'yyyy/mm/dd'}) ORDER BY
    : CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    : "Thu Nov 18 15:15:04 CST 1999","SQLException
    : java.sql.SQLException: ORA-00907: missing right parenthesis
    : "Thu Nov 18 15:16:16 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    : >= '1999/12/05') {ts 'yyyy/mm/dd'} ORDER BY
    : CC_TRANSACTION.TRANS_DATE_TIME ASC;"
    : "Thu Nov 18 15:16:16 CST 1999","SQLException
    : java.sql.SQLException: ORA-00933: SQL command not properly
    ended
    : "Thu Nov 18 15:18:58 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME >=
    : {ts '1999/12/05'}) ORDER BY CC_TRANSACTION.TRANS_DATE_TIME
    ASC;"
    : "Thu Nov 18 15:18:58 CST 1999","SQLException
    : java.sql.SQLException: ORA-00911: invalid character
    : "Thu Nov 18 15:19:47 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    : >= '{ts '1999/12/05'}') ORDER BY
    CC_TRANSACTION.TRANS_DATE_TIME
    : ASC;"
    : "Thu Nov 18 15:19:47 CST 1999","SQLException
    : java.sql.SQLException: ORA-00907: missing right parenthesis
    : "Thu Nov 18 15:20:43 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    : >= '{ts '1999/12/05'}')) ORDER BY
    CC_TRANSACTION.TRANS_DATE_TIME
    : ASC;"
    : "Thu Nov 18 15:20:43 CST 1999","SQLException
    : java.sql.SQLException: ORA-00907: missing right parenthesis
    : "Thu Nov 18 15:21:25 CST 1999","SELECT * FROM CC_TRANSACTION
    : WHERE (MERCHANT_ID = 'merchant21') AND (TRANS_DATE_TIME
    : >= '{ts '1999/12/05'}')) ORDER BY
    CC_TRANSACTION.TRANS_DATE_TIME
    : ASC;"
    : "Thu Nov 18 15:21:25 CST 1999","SQLException
    : java.sql.SQLException: ORA-00907: missing right parenthesis
    : I've tried everything under the "Sun"...!!!
    : I don't really want to hard code the oracle to_char function
    for
    : the app for other RDBMS databases.
    : Any Help would be extremely appreciated.
    : Thanks,
    : Nicholas Neuberger
    : E-mail: [email protected]
    Don't know it this helps, but I don't have any trouble reading
    from the Oracle DB, its writing that's the problem. Here's what
    I do to read: (using IBM Visual Age as dev tool & jsp webpages)
    1. Register Oracle Driver.
    2. Connection con = java.sql.DriverManager.getConnection
    ("jdbc:oracle:thin:@cs10k1f:1521:oracldb", "username",
    "passwd");
    3. Statement stmt = con.createStatement();
    4. SQL statement: sqlstmt = " select create_dt from table where
    condition;
    5. rset = stmt.executeQuery(sqlstmt);
    6. this.setCreate_date(rset.getDate("CREATE_DATE"));
    setCreate_date(java.sql.Date var_name) where method sets a
    private var declared to be java.sql.Date. Date comes back as
    'yyyy-mm-dd'.
    That's really all there is to it. Please notice that we're
    using the Oracle "thin" driver.
    Sorry if this is too much info, but I'm kind of new to all of
    this, and I know what I'd like to see in reply. Let me know if
    you get the db write solved.
    Steve Hadfield
    [email protected]
    null

  • The ORDER BY clause is invalid in views, inline functions, derived tables..

    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 16001] ODBC error state: 37000 code: 8180 message: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.. [nQSError: 16001] ODBC error state: 37000 code: 1033 message: [Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
    I have already tried to follow this thread below, but no change.
    HI
    In this specific report ran above the offending sql uses a CTE.
    I am on 11.1.1.6.1, Windows Server 2008
    Currently in testing phase in migration from 10g.
    I know what the error means, just not how to resolve it or what setting may be causing this.

    In Physical layer, go to specific database(Physical layer's) properties, database features tab -> Un check the EXPRESSION_IN_ORDERBY_SUPPORTED.
    For that failed report, go to Answers-> advance tab-> Look for 'Advanced SQL Clauses'
    Check this box to issue an explicit Select Distinct
    Let me know updates
    If helps Pls mark correct or helpful

  • Where condition on a function

    Hello,
    I'm having little troubles while writing a query for which is needed a where condition on a function.
    Here a little example:
    select id_vehicle from vehicle_list where id_user = 1 and function(id_vehicle) = 1;
    that function is using locator (quite heavy).
    as I would like to execute the function just for the id_user = 1 and not for the whole table (like it seemed it does in the privous query) I tried this second:
    select id_vehicle from (select id_vehicle from vehicle_list where id_user = 1) where function(id_vehicle) = 1;
    Nothing changed, neither the execution explain.
    Finally I found this syntax, that works as I would:
    select id_vehicle from vehicle_list where id_user = 1 group by id_vehicle having function(id_vehicle) = 1;
    Is this the only solution to achieve my goal?
    Thanks in advance,
    Samuel Rabini

    Karthick_Arp wrote:
    Samuel Rabini wrote:
    Hello,
    I'm having little troubles while writing a query for which is needed a where condition on a function.
    Here a little example:
    select id_vehicle from vehicle_list where id_user = 1 and function(id_vehicle) = 1;
    that function is using locator (quite heavy). Locator? I don't get you what is that? Probably some geo/spatial stuff.
    >
    as I would like to execute the function just for the id_user = 1 and not for the whole table (like it seemed it does in the privous query) I tried this second:
    select id_vehicle from (select id_vehicle from vehicle_list where id_user = 1) where function(id_vehicle) = 1; For oracle both the query are the same. Search the document for predicate pushing and read it.
    You are in a wrong assumption that the function is applied for all the row in the table. Its only applied on the rows for which id_user is 1. How to check it? just pas id_user as and parameter to the function and print it in the function. You will get to know that. not always. it depends on many factors. The CBO might decide that the condition with the function will return less values then the id_use=1 condition. Therefore it might choose to execute the function first. An execution plan including join predicates would also show this.
    There are some ways to influence the optimizers behaviour regarding function. One is to make it deterministic (if possible). Also one could give addition info to the optimizer about the function. Dynamic sampling could also be helpful, altough I'm not so sure in this case.
    I myself would prefer to write the query in such a way that the optimizer is forced to execute it as late as possible.
    There are different ways how to do this.
    Using a subquery and a sort operation (order by, group by ) is one. That's why it was working for the op. Problem is this additional sort operation has its own performance cost.
    Using COALESCE can be another way. It might be difficult rewrite the query in this case. But coalesce is one of the few commands (or the only one?) where the second parameter is not executed if the first one is fulfilling the condition.
    Last but not least you can use hints to prevent the subquery rewriting.

  • Convert WHERE condition to OBIEE using available OBIEE function

    I have this WHERE condition which has to be attached to a Logical Table Source (Content Tab). This condition exists in my BO Universe and has to be applied to my OBIEE project.
    TRUNC(SYSDATE) >= NVL(QP.QP_LIST_LINES.start_date_active, TRUNC(SYSDATE))
    AND TRUNC(SYSDATE) < NVL(QP.QP_LIST_LINES.end_date_active,TRUNC(SYSDATE)+1)
    Using the functions in OBIEE, I ended up with this WHERE condition but seems not to work because when I compared the results, they are different.
    CURRENT_DATE >= IFNULL(ABCDE."Price List Lines"."Item Start Date", CURRENT_DATE ) AND CURRENT_DATE < IFNULL(ABCDE."Price List Lines"."Item End Date", CURRENT_DATE + 1)
    Please help me correct this.
    Thank you in advance.
    Message was edited by:
    user595459

    Hi, The TIMESTAMPADD function helped. I will take note of this. It's now working but noticed the performance (generating the report) is taking a long time. Would appreciate your advice. Thanks.

  • Error message (-51) keeps coming up when I try to send music from iTunes to my iPhone and then the music won't come over.  How can I fix this message?

    Error message (-51) keeps coming up when I try to send music from iTunes to my iPhone and then the music won't come over.  How can I fix this message?

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • Issue with Dynamic WHERE condition in Cursor in FUNCTION.

    Hi All,
    I am facing an issue with cursor having dynamic WHERE condition in a function.
    Below is the FUNCTION:
    CREATE OR REPLACE FUNCTION EXCEPTION_MERGE(TABLE_NAME IN VARCHAR2, TAB_NAME IN VARCHAR2)
    RETURN VARCHAr2
    IS
    stmt_tabcols VARCHAR2(32767);
    v_columnname VARCHAR2(32767);
    CURSOR C1 IS
    SELECT 'A.'||A.COLUMN_NAME ||' = '|| 'B.'||B.COLUMN_NAME COLUMN_NAME
    FROM
    SELECT COLUMN_ID, COLUMN_NAME
    FROM USER_TAB_COLUMNS
    WHERE TABLE_NAME  = TABLE_NAME
    AND COLUMN_NAME NOT IN ('ERROR_TAB_ID','ERROR_LOAD_DATE')
    ) A,
    SELECT COLUMN_ID, COLUMN_NAME
    FROM USER_TAB_COLUMNS
    WHERE TABLE_NAME = TAB_NAME
    ) B
    WHERE A.COLUMN_ID = B.COLUMN_ID;
    BEGIN
    FOR TABCOL IN C1
    LOOP
        stmt_tabcols := stmt_tabcols ||TABCOL.COLUMN_NAME||',';
    END LOOP;
        stmt_tabcols := RTRIM(stmt_tabcols, ',');
        RETURN stmt_tabcols;
    END;
    SELECT EXCEPTION_MERGE('WC_W_TEST_FS','WC_W_TEST_FS_GBL') FROM DUAL;It throws, below error:
    ORA-06502 : PL/SQL : Numeric or value error : character string buffer too smallIf I REPLACE TABLE_NAME and TAB_NAME with hard coded values , it works fine. Can somebody look at the code and let me know the issue.
    Edited by: ace_friends22 on Sep 9, 2012 1:08 PM

    Etbin neatly demonstrating the value of posting code in a manner which makes it easy to read.
    It's obviously an naming/scoping issue. Faced with a join like this:
    where table_name = table_namethe engine looks for something called table_name in the current scope. It finds it, a column on USER_TAB_COLUMNS and applies it to both sides of the filter. It has no way of knowing that there is also a parameter called TABLE_NAME, because that is outside its current scope. Consequently the query will join every table in your schema regardless of what values you pass, and that's why you blow the buffer.
    Takw etbin's advice and name your parameter with a prefix:
    where table_name = p_table_nameThis isn't a column in USER_TAB_COLUMNS which will force the engine to look in the next scope up, which in your case is the function, where it will find your parameter and so generate a query for the passed values only.
    Cheers, APC
    Edited by: APC on Sep 9, 2012 8:03 AM

  • 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;

  • ITunes 11.4 updated won't sync over wifi

    I just updated iTunes 11.4.  Either my iPhone 6 or iPad mini won't sync over wifi with my iTunes. Sometime work and some time not. I try everything to fixing the problem. But nothing seem to be work. I need help.  Hopefully apple fixing this issue soon....

    Get a e-mail from Apple Senior Advisor today said about wifi sync issue.
    Hi, Roy
    This appears to be an issue that we are currently working on.  I appreciate you reaching back out to me to update me.  I will continue to monitor what happens moving forward and relay any new information from our engineers as it comes.  Thank you for your patience, but at this time we do not have an immediate fix.
    Sincerely,
    David Graham
    Senior Advisor
     Apple
    -P.S. if you need to contact me about your case.
    CALL: (877) 416-4271 ext 1114079
    EMAIL: [email protected]
    HOURS: 9AM - 6PM EST Sun - Thurs

  • 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

Maybe you are looking for

  • Spry SubMenu problem

    Hello,    I have created a spry menu for my website and am having problems making the submenu look the way I want it to. The menu item bar needs to stay invisible until it is hovered over...which I have done. However, once I hover over that menu item

  • After truncation space not reclaiming

    HI, During our health check we found one of the tables in our database occupying more than 11 GB of space. We got approval from APP team to truncate the table. And i truncated accordingly. But after truncation also the table is still showing the same

  • Capture error in procedure

    Hi, I'm running a procedure, i would like that if any error occures there will be a message that an error cccured, don't want to specifiy the error. tried: procedure... EXCEPTION htp.p('an error occured'); end;doesn't seem to work. thx Esther

  • Re-Install Missing Apps

    Is there a way to re-install individual missing apps (Apple DVD Player and Apple Mail) either from the install disc or a download site? Please don't ask how they went missing.

  • T400S full SSD speed for secondary drives (eSATA, ultrabay, dock)?

    Does the T400s delivier the full speed of SSDs (SATA-II 3 Gbps, ex: 220MB/Sec seq transfer of the X25-M) when the SSD is used - in ultrabay - on eSATA port - on eSATA port of the Mini Dock (Plus Series 3) The T400 seems to deliver the full speed of S