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.

Similar Messages

  • Type error while calling function module with in FOX formula

    Hi,
    I am getting following error while calling function module from FOX Formula:
    "Types of parameter DAY_IN () and variable J_CALDAY(D) are inconsistent"
    Following is the code:
    DATA    I_CALDAY       TYPE  0CALDAY.
    DATA    N_CALDAY       TYPE  0CALDAY.
    DATA    KYF              TYPE KEYFIGURE_NAME.
    FOREACH   I_CALDAY, KYF.
       CALL FUNCTION SLS_MISC_GET_LAST_DAY_OF_MONTH
          EXPORTING
             DAY_IN  =  I_CALDAY
          IMPORTING
             LAST_DAY_OF_MONTH = N_CALDAY.
        {KYF, N_CALDAY}  =  {KYF, L_CALDAY}.
    ENDFOR.
    Import parameter DAY_IN is of type sy-datum (that inturn is data element SYDATUM of data type DATS - same as 0CALDAY). Not sure why error is being thrown. Any idea? Thanks.
    Edited by: SAP_BOY on Dec 4, 2009 5:26 PM

    Hi,
    I think It will not identify ,though you have  (data element SYDATUM of data type DATS - same as 0CALDAY).Check it out by assigning it through a variable of type D.
    Data I_CALDAY TYPE D.
    Hope it may work out.
    Regards,
    Indu

  • ORA-17002 and ORA-17009 while calling Stored Procedures

    Hi,
    We are developing a JDBC application using WebLogic 6.0 as AppServer. When we
    rolled out the application in production, things work fine for about a day or
    so, then calls to Stored Procedures start giving ORA-17002 (io exception) and
    ORA-17009 (Closed Statement) exceptions while calling Stored Procedures. Restarting
    the server 'fixes' the problem for one more day.... We are not able to reproduce
    this behaviour in test or development servers.
    Can anybody suggest something.....
    Regards,
    Usman.

    Usman wrote:
    >
    Hi,
    We are developing a JDBC application using WebLogic 6.0 as AppServer. When we
    rolled out the application in production, things work fine for about a day or
    so, then calls to Stored Procedures start giving ORA-17002 (io exception) and
    ORA-17009 (Closed Statement) exceptions while calling Stored Procedures. Restarting
    the server 'fixes' the problem for one more day.... We are not able to reproduce
    this behaviour in test or development servers.
    Can anybody suggest something.....
    Regards,
    Usman.Hi. Describe how you are obtaining and using pool connections. Also, do download the
    latest thin driver from Oracle, because they have recently fixed some serious
    bugs in it.
    Let me know,
    Joe

  • Workaround for ORA-04030 error

    hi,
    we've encountered the following error:
    ORA-04030: out of process memory when trying to allocate 296 bytes (callheap, koposal dvoid)
    all of the research i've done points to setting up the database with a Very Large Memory configuration, which will be carried out at a later date as we're still in the development stage.
    is there a possible workaround for this error?
    thanks
    santosh sewlal

    hi,
    we're inserting into tables - spatial data and images, from a C#.net application that sends data to the db in a BLOB

  • Calling Function in SQL Server through DBLINK

    Hello
    I need to call a function that exists in other database (*SQL Server*) through DBLINK
    Is It possible? If yes, please give me the syntax
    Thanks

    Hi,
    You can call remote functions on SQL*Server if you create the database link using the Database Gateway for SQL*Server (DG4MSQL).
    You need to install and configure DG4MSQL then you can call remote functions as follows -
    SELECT function1@Remote_DB(7782) FROM dual;
    You need to set the parameter -
    HS_CALL_NAME
    in the DG4MSQL init<sid>.ora file with the owner and name of the function, for example -
    HS_CALL_NAME = "owner1.function1, owner2.function2 "
    and if you want to return values using the function you need to set the parameter in the gateway init file -
    HS_FDS_PROC_IS_FUNC=TRUE
    For full details you need to refer to the documentation -
    Oracle® Database Gateway for SQL Server User’s Guide, 11g Release 2 (11.2)
    Oracle® Database Heterogeneous Connectivity User’s Guide 11g Release 2 (11.2)
    which is available from -
    http://www.oracle.com/pls/db112/homepage
    and click on the 'Integration Information' option on the left.
    The documentation has further details on how to call and use remote functions.
    For information about installing and configuring the gateway and links to further information have a look at the following note -
    Note.1083703.1 Master Note for Oracle Gateway Products
    available in My Oracle Support
    You cannot use the Database Gateway for ODBC (DG4ODBC) to create the database link as it does not supported stored procedures or remote functions.
    Regards,
    Mike
    Edited by: mkirtley on Sep 2, 2011 11:09 AM

  • ORA-6508 while using attached PL-SQL library [SOLVED]

    Hi all,
    we use Developer 10.1.2.0.2 on Windows XP Professional SP 2.
    We have a Linux-based ( 2.6.5-7.287.3) OAS (10.1.2.0.2).
    We received ORA-6508 while starting a report from within a menu. In fact all reports led to the same mistake. I must admit that they all worked fine before. We found a workaround for this problem by recompiling the attached PL-SQL library. The question is: what caused the loss of information ? What reasons can be imagined for such a behaviour ?
    Regards
    Frank
    Message was edited by:
    fwb

    Hi Christian,
    what we have is:
    We have a .mmx in production for quite a while. Within the .mmx you can start several reports by selecting an entry of the menu. It all works without problems. Then suddenly by choosing one of the reports you face ORA-6508 (something that has never happend before even though we made no changes to the system - at least I have no knowledge of any ;)
    The .pll which I recompiled is attached to the menu (.mmb). Recompiling the .pll fixes the issue.
    Regards
    Frank
    Message was edited by:
    fwb

  • Regarding Restrictions on calling functions from sql expressions

    Hi all,
    While going through the functions of oracle 9i plsql documentation i came across restrictions on calling a function, i that i did not understand the following statement. can anyone explain me with an example. Please.........
    Functions called from SQL statements cannot contain statements that end the transactions.
    Regards,
    Sri Ram.

    Some where from google
    http://www.ucertify.com/article/what-are-the-restrictions-on-a-user-defined-function-that-is-called-from-a-sql-expression.html
    >
    •The function cannot contain statements that end the transaction. For example, the function cannot contain transaction control statements (such as COMMIT), session control statements (such as SET ROLE), or system control statements (such as ALTER SYSTEM). Also, it cannot contain DDL statements (such as CREATE) because they are followed by an automatic COMMIT.

  • IN operator is not working correctly while calling,although pl/sql procedur

    CREATE or REPLACE PROCEDURE TEST(
    idListCommaSeparated IN VARCHAR2
    AS
    CURSOR c_emp IS SELECT first_name,last_name,start_date From Employee where id IN(idListCommaSeparated);
    r_emp c_emp%ROWTYPE;
    begin
    insert into temp1 values('B',sysdate,sysdate,'A');
          open c_emp;
          loop
              fetch c_emp into r_emp;
              exit when c_emp%NOTFOUND;
              insert into temp1 values(r_emp.first_name,sysdate,sysdate,'A');
                 --business Logic
      end loop;
          close c_emp;
    end;
    /idListCommaSeparated contains values like (2,3,4). while executing this procedure on sqlplus it is succefully created.
    When i run the query separately on sqlplus
    SELECT first_name,last_name,start_date From Employee where id IN(2,3,4)I got some rows in result.
    why i am not getting via procedure correct result.
    and one more thing the number of elements in 'idListCommaSeparated' values are not fixed,sometimes it may be(2,3,4) or sometimes variable value may (2,3,5,6).
    I am not able to understand,where i am going wrong?

    see whether you find nested table parameter implantation option useful. Also supported by .net/java in case that's your calling appln.
    Below is plsql block having a procedure with input paramater of empid's. It returns a cursor( empno and ename) as out parameter.
    The empid's are hardcoded in the calling block.
    SQL> create type t_id is table of number
      2  /
    Type created.
    SQL> set serveroutput on
    SQL> declare
      2
      3   v_tid t_id;
      4   v_results sys_refcursor;
      5
      6   v_employee_id number;
      7   v_name varchar2(100);
      8
      9   procedure TEST (p_tid in t_id, p_empcursor out sys_refcursor)  as
    10   begin
    11    open p_empcursor for
    12    select empno, ename from scott.emp
    13    where empno in (select column_value from table (p_tid));
    14
    15   end;
    16
    17
    18  begin
    19   v_tid := t_id(7902,7934);
    20
    21   TEST(v_tid,v_results);
    22
    23   IF v_results IS NOT NULL
    24     THEN
    25        LOOP
    26           FETCH v_results
    27            INTO v_employee_id, v_name;
    28
    29           EXIT WHEN (v_results%NOTFOUND);
    30           dbms_output.put_line(v_name);
    31        END LOOP;
    32
    33        IF v_results%ISOPEN
    34        THEN
    35           CLOSE v_results;
    36        END IF;
    37    END IF;
    38
    39  end;
    40  /
    *FORD*
    *MILLER*
    PL/SQL procedure successfully completed.
    SQL>

  • Calling Function in  SQL

    Hi,
    I wrote a function like below:
    create or replace function test_ref_cur
    return sys_refcursor is
    l_ref_cur sys_refcursor;
    begin
    open l_ref_cur for
    select 'Tom' ename from dual
    union
    select 'John' from dual
    union
    select 'Jim' from dual;
    return l_ref_cur;
    end;
    When I call this function in Sql: Select test_ref_cur from dual; it returns 1 row as below
    Test_REF_CURSOR
    (CURSOR)
    I can see the data only when I double click on (CURSOR).
    Is there a way to show the data directly in the result window: like
    Ename
    Jim
    Tim
    John
    Thanks,
    DD

    dd_ram wrote:
    Hi,
    I wrote a function like below:
    create or replace function test_ref_cur
    return sys_refcursor is
    l_ref_cur sys_refcursor;
    begin
    open l_ref_cur for
    select 'Tom' ename from dual
    union
    select 'John' from dual
    union
    select 'Jim' from dual;
    return l_ref_cur;
    end;
    When I call this function in Sql: Select test_ref_cur from dual; it returns 1 row as below
    Test_REF_CURSOR
    (CURSOR)
    I can see the data only when I double click on (CURSOR).
    Is there a way to show the data directly in the result window: likeYou need to understand what a ref cursor is.
    The reason your result is showing "(CURSOR)" (I assume you're using SQL Developer or TOAD) is that the returned result is a cursor, not a set of data. Only when you double click on it, will it actually use that cursor to fetch the data back.
    For more understanding, read the following article...
    PL/SQL 101 : Understanding Ref Cursors

  • Error while calling java in sql

    hi..
    i would like to load and call simple java into oracle database. this is my simple java code.
    public class SimpleJava {
    public void main(String[] args) {
    System.out.println("Here we are");
    then, i created .class file and ready to be loaded into oracle database using loadjava utility. i already loaded it successfully into a database. but, when i use pl/sql to call it in SQl*Plus, i got this error.... can anyone help me to solve this problem?
    SQL> create or replace procedure call_simplejava
    2 as language java
    3 name 'SimpleJava.showMessage()';
    4 /
    Procedure created.
    SQL> set serveroutput on;
    SQL> call dbms_java.set_output(50);
    Call completed.
    SQL> execute call_simplejava;
    java.lang.NoSuchMethodException: No applicable method found
    at
    oracle.aurora.util.JRIExtensions.getMaximallySpecificMethod(JRIExtensions.java:4
    33)
    at
    oracle.aurora.util.JRIExtensions.getMaximallySpecificMethod(JRIExtensions.java:4
    75)
    BEGIN call_simplejava; END;
    ERROR at line 1:
    ORA-29531: no method showMessage in class SimpleJava
    ORA-06512: at "GISDB.CALL_SIMPLEJAVA", line 1
    ORA-06512: at line 1

    The first solution is to not do that in java in the first place.
    DDL should be in script files which are applied to oracle outside of java.
    Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation.

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

  • Ora-06502 while calling oracle function

    I am using 9.2.0.4.0 database.
    I have vb.net application that uses oracle provider for .net to connect to database.
    I am calling Oracle function which returns varchar2 value back.
    when i execute cmd2.ExecuteNonQuery, I get ora-06502 error.
    CREATE OR REPLACE FUNCTION ZZZ_TEMP( p_val IN VARCHAR2) RETURN varchar2
    AS
    BEGIN
    RETURN 'HELLO';
    EXCEPTION WHEN OTHERS THEN
    RETURN SQLCODE||' - '||SUBSTR(SQLERRM,1,100);
    END;
    ************** vb.net code
    Dim cmd2 As New Oracle.DataAccess.Client.OracleCommand(UserSchemaName & ".ZZZ_TEMP", con)
    Dim VAL As String
    Try
    cmd2.Parameters.Add("RetVal", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.ReturnValue)
    cmd2.Parameters.Add("p_val", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.Input).Value = "XYZ"
    cmd2.Connection = con
    cmd2.CommandType = CommandType.StoredProcedure
    cmd2.ExecuteNonQuery()
    VAL = cmd2.Parameters("RetVal").Value
    Catch ex As Oracle.DataAccess.Client.OracleException
    MsgBox(ex.Message)
    End Try

    If I change this function to retrun number rather than Varchar2 and change my
    RetVal parameter as follow it works. I am noticing that there might be a bug when function returns varchar2
    cmd2.Parameters.Add("RetVal", Oracle.DataAccess.Client.OracleDbType.int32, ParameterDirection.ReturnValue)
    cmd2.Parameters.Add("p_Val", Oracle.DataAccess.Client.OracleDbType.int32, ParameterDirection.Input).valu ="XYZ"

  • Webutil crashes while calling Function in when-new-item-instance-trigger

    Hello !
    I use Oracle AS 10.1.2 and webutil 1.0.6 and Oracle Forms Developer Version 10.1.2.
    When I call the webutilfunctions within a when-button-pressed or post-change trigger, everything works fine.
    When I call the webutilfunctions within a when-new-item-instance-trigger i get an error message:
    oracle.forms.webutil.file.FileFunctions bean not found.
    CLIENT_TEXT_IO.fopen will not work
    What are the reasons for this behavior ? How can I solve the problem ?
    PLEASE HELP !!!!!!!!

    I think that this is well explained in the webutil documentation(pdf).
    You cannot use the functions in the initialisation phase of the form, including triggers like When-New-Form-Instance, When-New-Block-Instance,etc...
    The workaround is to use a timer to wait the necessary time for the beans to instantiate themselves.
    Francois

  • Null Pointer Exception While calling function

    Excuse my ignorance, as I just started programming in Java, but while trying to give control to a function other than main(), I get a null pointer exception. I don't think that I'm calling the function properly, because I feel that I may need to start a new thread, but I don't know how to go about it. Please help.
    Here's the code(not the whole thing, just the important part):
    public static void main(){
    //some stuff to run     
    mainplace();
    public static void mainplace(){
    //stuff is in here
    }

    firstly the first main . Is this a typo
    shouldn't it be
    public static void main(String [] args) {
      mainplace();
    I say this cuz when u complile a class and try running it the first thing that gets called is the main method  with String[]  as the arguments.
    public static void mainplace() {
    // some thing here
    }it would be better if u post the code cuz, frankly nothing can be understood from ur previous post.
    there could be many reasons for the NullPointerException.
    sien

  • Error while calling function module to start form

    Hello Experts .
    First i make my data selection. Then i will get the name of the generated function module. Then i call FP Job open. up to here all is ok. But when i call the generated function module. There comes the popup error message. The text on this popup is SAP <SystemID>:System message,   Workprocess restarts. Session deleted" (or similar, I only get the german text "PBI: SAP-Systemnachricht: Workprozess druchgestartet (Modus abgebrochen)).
    I dont know why.
    Can anybody help?
    Regards
    Chris

    -> Executing Test Report FP_TEST_00 works correct. i see a pdf.
    ->Excecuting Test Report FP_CHECK_DESTINATION_SERVICE works correct
    FP_JOB_CLOSE is not called in my report.
    -> Executing Testreport:FP_TEST_IA_01  I get the error message:'
    ADS: com.adobe.ProcessingException: Could not retrieve a password for credential: ReaderRights(200.101).'

Maybe you are looking for

  • WBS settle to AUC in error

    We have a WBS element that was set up incorrectly to settle to an AUC asset. As a result, there has already been settlement activity (CJ8G) in past, closed fiscal years. So now we have an AUC asset that should not exist. I have been reading other iss

  • PI 7.3 Dual Stack User-Defined Message Search

    Hi All, I have implemented an Integrated configuration scenario SOAP-> PI – ABAP Proxy the scenario is sync the. The scenario has no mapping so no operation mapping exist in the configuration scenario. I tried setting up UDMS on the java stack withou

  • App express passwords stopped working

    Are the passwords to log into application express different from those in the host database? If not, why can't I log into app express with sys and system passwords? I can't even log in with the HR demo passwords. I have a local 9i test database on wh

  • Help I can not import an m2v

    Good evening and good continuation of the festivities. It 'the first time I have, so far I never had any problem in importing the files demuxed from DVD with extension [b]. M2v [/ b] and then process the movie clip, I made a hundred similar procedure

  • Why can't I enter codes to sync?

    I have installed Firefox on my Android phone with no problem. When I go to sync with my mac, I get codes, just as shown in the walk-thru. On my phone I also have a code. On neither device can I type in a code, overwrite what is there, nor is there a