Error mapping function in external procedure call

I'm trying to create an external procedure in PL/SQL8.1 to run an operating system command from within a PL/SQL block.
The C function couldn't be simpler:
extern void host_command(char *command)
(void)system(command);
It's even ignoring the return value of SYSTEM!
I've generated what I THINK is a shared object file and copied it to $ORACLE_HOME/lib/host_command.so
I've then done CREATE LIBRARY HOST_COMMAND_LIB as '...'
Then I created a PL/SQL procedure:
CREATE PROCEDURE SHELL(IP_COMMAND IN VARCHAR2)
AS
LANGUAGE C
NAME "host_command"
LIBRARY HOST_COMMAND_LIB
PARAMETERS (IP_COMMAND);
And then EXEC SHELL ('touch /tmp/fred')
That's when ORA-6521 is raised.
I am running Oracle8.1.7.4.0 on AIX 4.3
Am I missing something?
Any suggestions will be thankfully received.
Andrew Hunter

Thanks.
In fact, using the supplied makefile in $ORACLE_HOME/plsql/demo and MAKING SURE THAT THE .SO IS EXECUTABLE(!) works.

Similar Messages

  • 'Error mapping function' with external procedures

    I'm trying to create an external procedure in PL/SQL8.1 to run an operating system command from within a PL/SQL block.
    The C function couldn't be simpler:
    extern void host_command(char *command)
    (void)system(command);
    It's even ignoring the return value of SYSTEM!
    I've generated what I THINK is a shared object file and copied it to $ORACLE_HOME/lib/host_command.so
    I've then done CREATE LIBRARY HOST_COMMAND_LIB as '...'
    Then I created a PL/SQL procedure:
    CREATE PROCEDURE SHELL(IP_COMMAND IN VARCHAR2)
    AS
    LANGUAGE C
    NAME "host_command"
    LIBRARY HOST_COMMAND_LIB
    PARAMETERS (IP_COMMAND);
    And then EXEC SHELL ('touch /tmp/fred')
    That's when ORA-6521 is raised.
    I am running Oracle8.1.7.4.0 on AIX 4.3
    Am I missing something?
    Any suggestions will be thankfully received.
    Andrew Hunter

    Thanks.
    In fact, using the supplied makefile in $ORACLE_HOME/plsql/demo and MAKING SURE THAT THE .SO IS EXECUTABLE(!) works.

  • ORA-06521: PL/SQL: Error mapping function with 10.1.0 external procedure

    We have an external procedure running fine on 8.1.7 on VMS. After compiling and linking succesfully under 10.1.0, I get ORA-06521 PL/SQL: Error mapping function and ORA-06522: ERROR - vms_dlsym for file x, where x in the filename of the linked executable. Another external procedure that does not connect to the 10.1.0 database runs fine. What could be causing this error in Server 10.1.0 on VMS?
    Thanks,
    Dave

    Here is the code to create the function:
    CREATE OR REPLACE FUNCTION f1
    (h_file_name IN VARCHAR2)
    RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY l1
    NAME "f1"
    LANGUAGE C
    WITH CONTEXT
    PARAMETERS
    (CONTEST,
    h_file_name string);
    Here is the beginning of the Pro*C:
    int f1(epctx, h_file_name)
    OCIExtProcContext *epctx;
    char h_file_name[70];
    char h_line_txt [251];
    int lineno;
    FILE *fptr;
    /* register the connection context ... */
    EXEC SQL REGISTER CONNECT USING :epctx;
    The function loads a flat file into the database. It is probably not related but are unable to SQLPLUS/ or SQLLDR/ into the database from an OS autheniticated account (get ORA-12547: TNS:lost contact.) Thanks for taking the time to look at this. There aren't many people trying this on VMS, I'd bet.

  • Call to ldap server fails ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s)
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
    ORA-06512: at "SYS.DBMS_LDAP", line 1338
    ORA-06512: at "SYS.DBMS_LDAP", line 1273
    ORA-06512: at "SYS.DBMS_LDAP", line 529
    ORA-06512: at line 127
    after binding and searching an ldap directory.
    Line 127 is:
    my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
    Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
    I am following the example at:
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
    In fact any of the functions used in the 'while loop' in the above example give a similar error.
    Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
    I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
    Any suggestions gratefully received.
    Cheers
    KIM

    Fixed by running the catldap.sql script (ORACLE_HOME/rdbms/admin/catldap.sql) as SYS user and recreated the dbms_ldap packages. I am not sure why some of the functions worked OK and others did not.
    KIM

  • DBMS_LDAP call fails with ORA-06512 Error Mapping function

    Hi,
    I am facing a problem with workflow integration with LDAP.
    I receive
    ORA-6512 Error Mapping Function on one particular line within the WF_LDAP.get_cfg_val procedure.
    WHILE my_entry IS NOT NULL
    LOOP
    my_vals := DBMS_LDAP.get_values (p_session,
    my_entry,
    p_name);
    The documentation says:
    ORA-06521 PL/SQL: Error mapping function
    Cause: An error was detected by PL/SQL trying to map the mentioned
    function dynamically.
    Action: Check the stacked error (if any) for more details.
    This is the trace of the error:
    ORA-06521 PL/SQL Error mapping Function
    ORA-06512 at SYS.DBMS_LDAP_API_FFI line 0
    ORA-06512 at SYS.DBMS_LDAP line 1332
    ORA-06512 at SYS.DBMS_LDAP line 1302
    ORA-06512 at SYS.DBMS_LDAP line 582
    This is the header of the catldap.sql file
    Rem
    Rem $Header: catldap.sql 07-jan-2000.19:15:20 akolli Exp $
    Rem
    Rem catldap.sql
    Rem
    Rem $Header: dbmsldap.sql 14-dec-2001.23:25:22 rbollu Exp $
    Rem
    Rem dbmsldap.sql
    Rem
    This is the output while running it (No errors):
    Library created.
    Package created.
    Package created.
    Package created.
    Package body created.
    Package body created.
    Package body created.
    Synonym created.
    Grant succeeded.
    Synonym created.
    Grant succeeded.
    Database is :
    compatible 9.2.0.0.0
    Am I missing something?
    I have searched all the forums and although there are many references to "Error Mapping Function", noone has reported it in the context of WF - LDAP Integration. So I am not sure how to proceed.
    Please help.
    thanks in advance,
    Libin

    Hi Libin,
    Can you please explain to me the parameters that you put in the Global Preferences, the LDAP_port,LDAP_user,and the others, because I don�t know where I need to search in the server this parameters and I don�t understand su much of OID.
    if you can give to me and little description of that parameters,this would thank for much.
    anticipated thanks
    Arlet

  • ERROR MAPPING FUNCTION

    Hi All,
    I've created a library and mapped it to the operating system directory(UNIX/AIX), and created a procedure that calls my C program through pl/sql, but I keep getting error
    message (06521)Error mapping function. I have void datatype return values from my C program no calling parameters and it does return data when executed by itself. I've tested the directory path that I defined in my create library statement and, I believe It's reaching the C program in the said directory, but I recieve no data through the pl/sql program. TM states, as of oracle8 we can access external C,pascal,etc.. files.I'm assuming that this access can be achieved programmatically.
    Am I overlooking something?
    Thank you very much for your help!!

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Pankaj Choudhery ([email protected]):
    parameters are not the same in pl/sql & C function<HR></BLOCKQUOTE>
    Thanks for your reply Panka,
    I think you're right there on the problem.
    I too believe that the problem lies between the conversion of the datasources between the two languages.
    I'm using oracle8's default external procedure datatype,to bridge the gap between the pl/sql code and the C parameters. By the Book its -- Varchar2(plsql) = STRING(external type) = C program(*char)...etc. There seems to be more to it than the book is explaining would you perhaps know of any other documentation sources?
    Thanks again...

  • Ldap problem, ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s)
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
    ORA-06512: at "SYS.DBMS_LDAP", line 1338
    ORA-06512: at "SYS.DBMS_LDAP", line 1273
    ORA-06512: at "SYS.DBMS_LDAP", line 529
    ORA-06512: at line 127
    after binding and searching an ldap directory.
    Line 127 is:
    my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
    Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
    I am following the example at:
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
    In fact any of the functions used in the 'while loop' in the above example give a similar error.
    Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
    I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
    Any suggestions gratefully received.
    Cheers
    KIM

    Scott,
    Thanks for your concern. I should have explained. I am working in HTMLdb, successfully using ldap to authenticate, but now need to get the logged-in user's name and other details. All my attemps to use the wwv_flow_ldap functions have failed, and I am no resorting to DBMS_LDAP to get what I want. I am hoping thatsome helpful person can shed some light on this problem
    Cheers
    KIM

  • ORA-06521: PL/SQL: Error mapping function :ORA-06522:undefined :ODCIAggre

    Hi,
    I am getting the following error :
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
    Below are list of files in my : $ORACLE_HOME/lib :
    custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
    custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
    facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
    hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
    hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
    lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
    libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
    libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
    Please reply to my queries.
    Please let me know if you want to have a look at the symbols of my object file
    Thanks & Regards,
    -NN

    Your issue may relate to XE and it may relate to OCI but it does not relate to SQL and PL/SQL. Consider posting your question in a forum where it will be on topic.
    When you do include full version information (3 decimal places) and the code that is generating the exception.

  • ORA-06521:PL/SQL:Error mapping function :ORA-06522:undefined :ODCIAggregate

    Hi,
    I am getting the following error :
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
    Below are list of files in my : $ORACLE_HOME/lib :
    custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
    custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
    facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
    hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
    hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
    lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
    libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
    libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
    Please reply to my queries.
    Please let me know if you want to have a look at the symbols of my object file
    Thanks & Regards,
    -NN

    It's only a quick guess but have you checked your tnsnames.ora file to ensure you've opened the environment to find the libraries? If you set the EXTPROC_DLLS=ANY, you open the database to security issues but it should tell you if this cause because you can't access the library that contains the symbol.
    SID_LIST_CALLOUT_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = <oracle_home_directory>)
    (PROGRAM = extproc)
    (ENV = "EXTPROC_DLLS=ONLY:
    <oracle_home_directory>/customlib/writestr1.so
    ,LD_LIBRARY_PATH=<oracle_home_directory>/lib")
    )

  • Cannot get external procedural call in Oracle RAC Environment

    Cannot get external procedure call to work in our test RAC env.
    We are able to get it to work in our DEV env which is a single instance
    LISTENER.ORA:
    NODE1:
    # listener.ora Network Configuration File: /opt/oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    LISTENER_SBLBGT01 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = sblbgt01-vip1)(PORT = 1521)(IP = FIRST))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.41.1.21)(PORT = 1521)(IP = FIRST))
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /opt/oracle/app/oracle/product/10.2.0/db_1)
    (PROGRAM = extproc)
    (ENVS="EXTPROC_DLLS=ANY")
    NODE2:
    # listener.ora.sblbgt02 Network Configuration File: /opt/oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora.sblbgt02
    # Generated by Oracle configuration tools.
    LISTENER_SBLBGT02 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = sblbgt02-vip2)(PORT = 1521)(IP = FIRST))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.41.1.22)(PORT = 1521)(IP = FIRST))
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /opt/oracle/app/oracle/product/10.2.0/db_1)
    (PROGRAM = extproc)
    (ENVS="EXTPROC_DLLS=ANY")
    2) ### If you are receiving errors, please list exact error messages and text: ###
    (cont 1.)
    tnsnames.ora (on both nodes):
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))
    (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO)))
    [opt/oracle/app/oracle/product/10.2.0/db_1/network/admin]> tnsping EXTPROC_CONNECTION_DATA
    TNS Ping Utility for Solaris: Version 10.2.0.3.0 - Production on 11-APR-2011 10:52:49
    Copyright (c) 1997, 2006, Oracle. All rights reserved.
    Used parameter files:
    /opt/oracle/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = extproc)) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO)))
    OK (0 msec)
    Calling External Procedure:
    SQL> execute ttran.shell('ls');
    BEGIN ttran.shell('ls'); END;
    ERROR at line 1:
    ORA-28575: unable to open RPC connection to external procedure agent
    ORA-06512: at "TTRAN.SHELL", line 1
    ORA-06512: at line 1

    Any Reply Please...
    would appreciate your help...

  • External Procedure Call: Temporary Blob Array out.

    Hello,
    I am having difficulty getting out an array of blob from the external procedure call interface. I am trying to create an array of blob initialized with temporary blobs. I was successfully able to create single blob parameter out but no success with the array type.
    I am including the code for PLSQL wrapper, test code, and the main C code.
    I appreciate your help.
    The error message of the test run:
    0
    10
    DECLARE
    ERROR at line 1:
    ORA-22275: invalid LOB locator specified
    ORA-06512: at "SYS.DBMS_LOB", line 554
    ORA-06512: at line 7
    CREATE OR REPLACE PROCEDURE blob_coll (
    cintarray IN OUT VDC_BLOB_ARRAY ) IS
    LANGUAGE C
    NAME "blob_coll"
    LIBRARY sjc_lib WITH CONTEXT
    PARAMETERS (
    context,
    cintarray OCIColl);
    DECLARE
    BLOBARRAY VDC_BLOB_ARRAY:= VDC_BLOB_ARRAY();
    BEGIN
    dbms_output.put_line( BLOBARRAY.count);
    SCOTT.BLOB_COLL ( BLOBARRAY );
    dbms_output.put_line( BLOBARRAY.count);
    dbms_output.put_line( dbms_lob.getlength( BLOBARRAY(1)));
    END;
    void blob_coll( OCIExtProcContext *ctx,
    OCIColl **cintarray )
    sword status;
    int i;
    OCILobLocator *lobp[10];
    status = OCIExtProcGetEnv( (OCIExtProcContext *)ctx, (OCIEnv **)&envhp,
    (OCISvcCtx **)&svchp, (OCIError **)&errhp );
    for (i=0; i < 10; i++)
    status=OCIDescriptorAlloc( (dvoid *)envhp, (dvoid **) &lobp,
    (ub4)OCI_DTYPE_LOB, (size_t)0, (dvoid**)0);
    status=OCILobCreateTemporary((dvoid *)svchp,
    (dvoid *)envhp,
    lobp[i], (ub2)0, SQLCS_IMPLICIT,
    OCI_TEMP_BLOB, OCI_ATTR_CACHE,
    OCI_DURATION_SESSION);
    status = OCICollAppend( (OCIEnv *)envhp,(OCIError *)errhp,
    (CONST dvoid*) lobp[i],
    (CONST dvoid*)0,
    (OCIColl *)*cintarray);

    The "X" in the second registerOutParameter is the type name which
    you have created in oracle DB.
    eg. if you have created a nested table
    create Type integer_table is table of number(10);
    then "X" = "INTEGER_TABLE" and it has to be in caps
    and other thing to keep in mind is that it only works with nested
    table or varray and not with pl/sql table.
    Al Pivonka (guest) wrote:
    : How can I pass pl/sql record in and out
    : and pl/sql tables in out thru a pl/sql procedure using jdbc
    with
    : the zip file of 816classes12.zip...
    : I have tried everything I know...
    : I know the procedure is working, others are using it with in
    : Oracle...
    : I need to use the information it generates.
    : here is what I have so far...
    : try
    : Class.forName ("oracle.jdbc.driver.OracleDriver");
    : DriverManager.registerDriver (new
    : oracle.jdbc.driver.OracleDriver());
    : oracle.jdbc.driver.OracleConnection conn =
    : (oracle.jdbc.driver.OracleConnection
    : DriverManager.getConnection
    ("jdbc:oracle:thin:@--","NA","NA");
    : // SQL92 SyntaxCallableStatement
    : oracle.jdbc.driver.OracleCallableStatement cstmt =
    : (oracle.jdbc.driver.OracleCallableStatement)conn.prepareCall
    : ("{call cbmd_proposal_PKG.DefaultTerms (?,?,?,?)}" ) ;
    : cstmt.setString(1,"5118");
    : cstmt.setString(2,"3");
    : cstmt.registerOutParameter
    : (2,oracle.jdbc.driver.OracleTypes.NUMBER);
    : cstmt.registerOutParameter
    (1,oracle.jdbc.driver.OracleTypes.ARRAY,"X");
    : cstmt.execute();
    : catch(Exception e)
    : System.err.println(e.toString());
    : e.printStackTrace();
    : The "X" in the second registerOutParameter is still unknown to
    : me.
    : The JavaDoc for the
    OracleCallableStatement.registerOutParameter
    : is not clear.
    : Can any One help simplify this...
    : Thanks
    null

  • External procedure calls supported?

    Are external procedure calls supported? Should be, right?
    I didn't find anything in the documentation and the directory $ORACLE_HOME/rdbms/extproc doesn't exist either.
    But the binary $ORACLE_HOME/bin/extproc is there.
    Thanks,
    ~Dietmar.

    Hi Sven,
    you have beaten me again ;). I'm too slow.
    "Any errors that occur during the execution of the
    job will be returned as errors to the RUN_JOB
    procedure."True, when the job cannot be executed, a plsql exception is raised.
    I just don't get the exit code back. If something goes wrong inside the executable, I want to be able to detect that. Usually the called script sets an exit code for that purpose.
    >>How do I get a handle on the LOG_ID?
    Are they any public variable in dbms_scheduler. e.q.
    LastLogID ;-) ?No, I 've checked the package. But the exit code doesn't seem to be logged either. error# in USER_SCHEDULER_JOB_RUN_DETAILS is 0, even when the exit code is set to non-zero.
    See the following sample:
    File: error_throw.cmd
    exit /b 1I have checked that the exit code handling works using this script:
    @echo off
    call error_throw.cmd
    IF ERRORLEVEL 3 GOTO errhandler
    IF ERRORLEVEL 2 goto errhandler
    IF ERRORLEVEL 1 goto errhandler
    echo "successful run"
    goto end
    :ERRHANDLER
    echo errorlevel
    :ENDand I called it using:
    begin
      DBMS_SCHEDULER.create_job (
        job_name        => 'GO_SYNC',
        job_type        => 'EXECUTABLE',
        job_action      => 'C:\temp\dosBatch\error_throw.cmd',
        enabled         => FALSE,
        comments        => 'Synchronously run command.');
    end;
    BEGIN
      -- Run job synchronously.
      DBMS_SCHEDULER.run_job (job_name            => 'GO_SYNC',
                              use_current_session => TRUE);
      -- Remove job after run
      DBMS_SCHEDULER.DROP_JOB('GO_SYNC');
    END;
    /~Dietmar.
    daust: wrong command file called: error_throw.cmd instead of error_handle.cmd

  • External Procedure call - wait event - no response

    Executing SQL that use external library - I dont get any response
    I see wait event as 'External Procedure call' and no response, no errors are thrown.
    Am I missing something or how do I troubleshoot further...
    Your help very much appreciated.
    Please note I have no entry in TNSNAMES.ORA or LISTENER.ORA file for extproc connections.
    Oracle DB - Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    Listener - TNSLSNR for Linux: Version 11.2.0.3.0
    OS - Red Hat Enterprise Linux Server release 6.5
    DLL entry done ONLY in "/apps/oracle/product/11.2.0/dbhome_1/hs/admin/extproc.ora"
    SET EXTPROC_DLLS=ANY
    OS Environment LD_LIBRARY_PATH=
    LD_LIBRARY_PATH=/apps/oracle/product/11.2.0/dbhome_1/lib
    DLL File permission
    -rwxrwxr-x  1 oracle oinstall   8022832 Mar  6 12:55 libst_shapelib.so
    OS EXTPROC process is running
    oracle   17489     1  0 09:08 ?        00:00:00 extprocGISDEV (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))
    Library Path set at schema level as below
    select * from dba_libraries where library_name = 'ST_SHAPELIB';
    OWNER                          LIBRARY_NAME                   FILE_SPEC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DYNAMIC STATUS
    SDE                            ST_SHAPELIB                    /apps/oracle/product/11.2.0/dbhome_1/lib/libst_shapelib.so                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Y       VALID  

    Hello,
    This is posted in the incorrect community.  I think you need to be in SQL and PL/SQL
    Regards,
    Matt

  • ORA-06521: PL/SQL: Error mapping function

    Hi folks,
    I am trying to run gather_table_stats for a particular table but am getting the below error. Any ideas?
    SQL> execute DBMS_STATS.gather_table_stats( ownname=>'DBO',tabname=>'CD_JOURNAL_CHANGE_REG',method_opt=>'FOR ALL INDEXED COLUMNS',cascade=>TRUE);
    BEGIN DBMS_STATS.gather_table_stats( ownname=>'DBO',tabname=>'CD_JOURNAL_CHANGE_REG',method_opt=>'FOR ALL INDEXED COLUMNS',cascade=>TRUE); END;
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_STATS", line 10301
    ORA-06512: at "SYS.DBMS_STATS", line 10315
    ORA-06512: at line 1
    I have runt utlrp.sql as sys but with no avail.
    Kindest Regards,
    Will

    You did not mention if the applicable table contains an ADT columns, nested tables and so on.
    You can also do a basic test to determine if the problem is potentially with the table, or with dbms_stats itself. Create a plain table, e.g.
    create table foo( id number, foo_char varchar2(100), constraint pk_foo primary key( id ) using index );
    Using the exact same dbms_stats parameters, do this table. If it works, it points to a potential problem with the other table - some data structure/data type issue maybe. If it does not, then you have a problem with dbms_stats itself.
    You can also drop the indexes on the DBO table and try dbms_stats with different parameters. I.e. change the conditions to see if the error still occur in order to isolate the problem.
    You also could log an iTar/SR for this with Oracle Support.

  • ORA-06521: PL/SQL: Error mapping function while writting into a text file

    Hi,
    I'm getting an errror ORA-06521: PL/SQL: Error mapping function while trying to write data into a text file.
    I'm using the following code:
    --To create a new directory
    create or replace directory temp as 'C:/temp';
    declare
                    l_str varchar2(1000);
                    output_file utl_file.file_type;
                    cursor test_write_cur is
                         select EMPNO,ENAME,JOB,SAL,HIREDATE
                           from EMP
                         where DEPTNO=30;
    begin
               output_file := utl_file.fopen('TEMP','TESTFILE.txt','w');
               for test_write_rec IN test_write_cur
               loop          
                l_str :=     test_write_rec.EMPNO||'^'||test_write_rec.ENAME||'^'||test_write_rec.JOB||'^'||
                         test_write_rec.HIREDATE||'^'||test_write_rec.SAL||chr(10);
                utl_file.put_line(output_file,l_str);
                     end loop;                                                                           
               utl_file.fclose(output_file);
    end;Please suggest me if i'm wrong.
    Thanks & Regards,
    Sanket Mishra

    Dear Sanket,
    I think you are need use TO_CHAR() function
      to_char(test_write_rec.EMPNO) ,
      to_char(test_write_rec.HIREDATE,'DD.MM.YYYY')
      to_char(test_write_rec.SAL)

Maybe you are looking for

  • New hard drive for mac, how do i move all the old over?

    My partitioned HD on my mac now has too small a partition for the OS 10.3 to run stably. As I believe it is impossible to enlarge the partition OS runs on without erasing the whole HD first I want to put a larger HD into the mac. How can I move every

  • Remove additional email preview tool

    New mail messages show up on the right side of the screen.  I find these annoying.  How can I remove this email feature?

  • Grants across table spaces

    I'm trying to write a report that selects data from two schemas in two different HTMLDB tablespaces (or workspaces). How do I gain access from one workspace to the other? I've tried dblink and grants, but I'm unable to see users from one workspace to

  • Hyperion Services

    Hi Team, Can you please help me how can we automate the Process of Effectively Monitoring Essbase Services. I mean if services went down can we get notification that Services went down.Is there any tool anythin which we can help this. Thanks, Naresh

  • Flash Plugin - Firefox - WebCam

    I have successfully installed the Flash plugin for Firefox. When I see a cam feed, I do get the 'Settings' popup. When I chose the Cam tab I do see the select drop down to choose a camera. However.... The current chosen option is my Hauppauge TV app.