Oracle Function in JDBC Adapter

Dear All
Can we execute an oracle fucntion using receiver jdbc adapter? if yes then what should be the structure
I have gone through following links but the soluiotn is not clear
Using PI - Calling a Function in Oracle
Regards
Sourabh

I think two possible ways. You might want to write stored procedure and inside your stored procedure call oracle function.  The second option is as below. In access tag write your query with standard functions. placeholder is to pass values for the variable.
<StatementName>
<anyName action=u201D SQL_QUERYu201D | u201CSQL_DMLu201D>
<access>SQL-String with optional placeholder(s)</access>
<key>
  <placeholder1>value1</placeholder1>
  <placeholder2>value2<placeholder2>
</key>
</anyName > 
  </StatementName>
Ex:
SELECT '03.12.2004:10:34:24' "Now",
       TO_CHAR(hiredate,'DD.MM.YYYY:HH24:MI:SS') "Hiredate",
       TO_DATE('03.12.2004:10:34:24','DD.MM.YYYY:HH24:MI:SS')
       - hiredate "Hired since [Days]"
  FROM emp;
where to_char is the oracle function.

Similar Messages

  • Call Oracle Function via JDBC Adapter

    Hi to everybody,
    using JDBC connection with an Oracle DB, from XI I manage to send messages to execute SQL statements or Stored Procedures. Does anybody know if there is a way to call also an Oracle Function?
    Thanks a lot for any help...
    Ilaria

    Hi Illaria,
    I think i agree with Michal. The solution to your problem would be to go for a stored procedure. The link on SDN help only tells us that a stored procedure can be executed and does not discuss about oracle functions.
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    So, Stored Procedures, it has to be.
    Regards,
    Bhavesh

  • NCHAR issue with oracle database using JDBC adapter

    Hi,
    We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
    Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    Please find the system information below.
    Oracle version- 10.2.4
    XI version - 3.0/ service pack 19
    JDBC driver- oracle.jdbc.driver.OracleDriver
    Please suggest.
    Thanks,
    Venkata
    Edited by: Venkata Narayana  Eepuri on Oct 21, 2010 12:10 AM

    Dear Venkata Narayana,
    Concerning the error, kindly go through the following note :
    731 - Collective note: ORA-00904
    follow the recommendations mentioned in that and please check if that helps.
    Best Regards
    Nishwanth

  • Invoking oracle function thru JDBC Receiver.

    Hi Crew,
    I have a scenario in which JDBC receiver have to call a Oracle function. Can somebody help me deriving out JDBC sender Data type definition format?
    Thanks in Advance
    Karthik Kaveriselvan.

    Hi
    /people/siva.maranani/blog/2005/09/16/xi-how-to-on-jdbc-receiver-response
    /people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    Thanks

  • Access an Oracle DB using JDBC adapter

    Hi, I'm trying to make an simple test for checking if the connection between XI and Oracle DB is working fine and following the weblog nr. 2018 ( Save Time with generalized JDBC datatypes ) i've made my structures in order to achived that. I've declared the field action as SELECT than the table name ... and in the IB set the needed configurations. So when i exec my interface i've got the black/white flag bur if i look at the adapter engine i see that the JDBC adapter is achieved but i got 2 errors " <b>No 'action' attribute found in XML document('action' attribute missing or wrong XML structure)</b> and <b>Exception caught by adapter framework: error processing request in sax parser: No 'action' attribute found in XML document('action' attribute missing or wrong XML structure)</b>. Can anybody provide me some help ??? Thanks in advance.
    JMMatos

    Hi,
    This is how my DT looks like:
    Structure           Category      Type
    Data_JDBCReceiver   Complex Type
      Statement
        Table_name
          action        Attribute
          table
        access                        Data_FileSender
          cod
        key                           Data_FileSender
          cod
    This is my DT and in MM i fill field <b>action</b> with constant value(SELECT/INSERT), field <b>table</b> with the name of the corresponding DB table, fields <b>access/key</b> with constant value(empty). At this moment, I got the following error <b>Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'v01_sap_xi' (structure 'Statement'): java.sql.SQLException: FATAL ERROR: Column 'cod' does not exist in table 'v01_sap_xi'</b>; according with the people responsible for the DB this column named <b>cod</b> does really exist !! What can I do ?!?!? Some help will be ... Thanks !!!

  • Calling Oracle function in JDBC

    Hi,
    The function in Oracle is defined as
    FUNCTION SETUP RETURNS BOOLEAN
    Argument Name Type In/Out Default?
    PI_NE_ID NUMBER IN
    PI_PI_AID VARCHAR2 IN
    PI_ATTR_NAME_LIST_ID VARCHAR2 IN
    PI_NETYPE VARCHAR2 IN DEFAULT
    PI_CLLI VARCHAR2 IN DEFAULT
    DI_CATEGORY VARCHAR2 IN/OUT
    MSG VARCHAR2 IN/OUT
    My code in Java is
    CallableStatement stmt = con.prepareCall("{? = call ges.
    Setup(?,?,?,?,?,?,?)}");
    System.out.println( " formed call statement" );
    stmt.setInt( 1, 6);
    stmt.setString( 2, "COM-5004" );
    stmt.setString( 3, "TS35-COM" );
    stmt.setString( 4, "*" );
    stmt.setString( 5, "*" );
    stmt.setString( 6, "C" );
    stmt.setString( 7, msg );
    stmt.registerOutParameter( 8, Types.BIT );
    stmt.registerOutParameter( 6, Types.VARCHAR );
    stmt.registerOutParameter( 7, Types.VARCHAR );
    stmt.execute();
    I have tried commenting registerOutParameter for 6 and 7. But I get the error
    Connectingjava.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Can anybody please tell what is the problem.
    I am using JDK1.3.
    When I give Type.BOOLEAN instead of BIT I get compilation error.
    Thanks
    Smitha

    Hi Smintha,
    Oracle does not support the return of Boolean over JDBC. To work around this problem you have to write a wrapper function around your original function which returns then for example a number value that indicates true or false.
    I assume that the reason for not returning boolean values is that Oracle's boolean value is threefold it can either be true, false or null where null is neither success or failure but rather non-existing.
    Let me know if you need any further examples about this.
    Hope this helps,
    Kalle

  • Oracle CEP and JDBC Adapter

    I am using Oracle CEP 10g on WIndows.
    I wrote the following code on CEP:
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:scott/[email protected]:1521/orcl");
    Connection conn = ods.getConnection();
    // Check for the existence of a previous customerID
    String selectStmt     = "SELECT * from STEPS " +
         "WHERE (streamID='" +
         this.customerId +
         "') and (assetid='" +
         this.eventName +
    Statement stmt  = conn.createStatement();
    //System.out.println("-- calling SELECT");
    //System.out.println(selectStmt);
    ResultSet rs    = stmt.executeQuery(selectStmt);This works great, except it is exceedingling slow. I am sending about 20,000 messages to this code.
    I think the problem is that I open the connection everytime I perform a select (and later an insert statement).
    The server instance goes away after the message has been processed, and I can not save the connection.
    Would using an adapter in config.xml prevent this openig a new connection every time a message invokes this code ?
    If so, I have never done JDBC with an adapter and I dont understand how to use an adapter to use a WHERE clause to select on variables, since in the example I have seen so far, it places "SELECT 1 from DUAL" into the config.xml and does not explain how to get mix have the SELECT statement interact with code variables or better yet how to get your code to get a connection handle.
    Could someone please post an exaqmple of how to use an adapter with JDBC, and possibly how to get your code to access a connection handle from the config.xml ?
    Thanks

    Hi,
    From note : 831162,
    <i>Oracle JDBC Driver (classes12.zip / classes12.jar) Deadlocks
    Q: I have deployed the Oracle classes12.zip / classes12.jar JDBC driver as per the instructions in the XI Configuration Guide.
    Unfortunately, I frequently notice hanging database connections. A thread dump taken according to the instructions in note 710154 shows one or more blocking JDBC Sender/Reciver threads and optionally that the JVM has detected a deadlock.
    A: <b>The Oracle classes12.zip / classes12.jar driver is compatible with JDK 1.2 and 1.3 only, but not with JDK 1.4. Upgrade to a current version of the driver (ojdbc14.jar). For details, refer to note 941317.</b>
    Make sure that you remove classes12.zip / classes12.jar from aii_af_jmsproviderlib.sda prior to adding the new driver as per the instructions in the answer to question #1 above as you will get a class name collision otherwise (all JARs from aii_af_jmsproviderlib.sda are loaded into the same class loader and the driver class name of both driver versions is the same).
    Before deploying the updated driver, ensure that the new version is still compatible with your Oracle database server release. For details, refer to the release notes provided by Oracle.</i>
    Regards,
    Bhavesh

  • How to use todate function in JDBC adapter

    Hi All,
    How can we use the todate function to update a date field in Oracle database. I am getting a
    java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
    Exception, when I am mapping the date fields with  to_date('03/28/2009 18/43/19','MM/DD/YYYY HH24/MI/SS').
    Thanks,
    Yomesh

    The following is standard SAP document regarding this attribute, this attribute used to compose your SQL clause for string or non-string, for string, you need to put the "YES". in your case, you need to set set the value "NO"
    so create an attribute, pass a constant value "NO" to it, that is it.
    hasQuot= YES|NO During construction of the WHERE condition of the SQL statement, the table column type determines whether the default is to set the values in quotation marks (text column types) or not (numerical column types). In a few cases (for example, when using functions), it may be necessary to override this. This attribute enables you to do this. If YES, quotation marks are always set round the values for which this attribute is set in the SQL syntax. If NO, quotation marks are never set. Only use this attribute in individual cases.
    Regards.
    Liang

  • Duplicate data updating in Oracle DB by JDBC adapter

    Hi ,
    I am developed Idoc to JDBC senario. One sigments was coming N number of times. for example 30 time. In that 3 diffrent disribution channel data. but I want to send only 3 records for each distribution channel.
    I connected that segment to access in JDBC structure to repaet the data, because of this all 30 records are going. I want to avoid duplicate records. Please help how to do it?
    Thanks,
    Venkat

    Hi,
    You can control this in mapping.
    You can suppress the duplicate records in mapping.
    -Supriya.

  • Oracle Function call from JDBC Adapter

    Hi,
      Is it possible to call Custom Oracle Function from JDBC Adapter? 
    I know we can call stored procedure but I need to call Oracle function. Please explain how?
    Regards,
    Shweta.

    You'll need to provide a column alias for the function call:
    select func(val) as alias from dual

  • Special Characters for Receiver JDBC Adapter

    Hi,
    Our Scenario is Proxy -PI-JDBC (SQLServer ). We have special characters in the payload and we are abel to see the special characters in PI.According to JDBC Faq we used haquot attribute and concatenated with Prefix N'<Value>'. But still when the data is posted in the database we cannot see the special characters.
    Please let me know your inputs.
    Thanks,
    Sainath

    Reference following thread, add a attribute of "hasQuot", map constant "No" to it, to see solve your problem or not:
    Re: how to use todate function in JDBC adapter
    Regards.
    Liang

  • JDBC Adapter - Connectivity

    I connect to Oracle Database using JDBC Adapter and the adapter is configured to poll every 300 secs.
    The Oracle Database goes down over the week end for maintenance. By the time I come Monday morning the Adapters are down and I have to reactivate them from ID. I assumed that the Retry interval will take care of the issued.
    Is there any way to stop this from happening?
    Regards
    Michael

    Hi Michael,
    Like mentioned by Amol, <b>Disconnect from Database After Processing Each Message</b> will do the trick.
    Every time your JDBC adapter receives a message for processing , it will connect to the database the details  provided in the Adapter Configuration.
    Normally, if you do not select this option, your JDBC adapter will connect to the Database once when it is getting activated and will use the same connection for further processing. But, if the Database resets this connection , there is no way the JDBC adapter isaware of this, and the next time a message is processed by it, it will get disconnected.
    So, if this DB disconnection is going to happen frequently, you need to have the option Disconnect from Database After Processing Each Message selected.
    Regards,
    Bhavesh

  • JDBC ADAPTER SENDER ORACLE7.2.3

    HI ALL,
    We have to read data from an Oracle 7.2.3, but we are having problems In the inbound payload I can see that we have the data but is not building the xml properly, because the tags are empty. Someone haa experiencied this issue before?
    Many thanks in advance!
    Regards
    Noelia

    Hi Mario,
    the SQL is correct. I have checked it in Toad. I thinks this is something relative to the driver for oracle, because the jdbc adapter recover the data of the query but the info that I can see in the payload is the following:
    <ns:MT_XXXXXX xmlns:ns="http://XXXX.es/xi/XXX">
         <row>
              <b><></b>123<b></></b>
              <b><></b>PEPITO<b></></b>
              <b><></b>01/01/2006<b></></b>
         </row>
    </ns:MT_XXXXXX>
    And thats drive me to think that this is an issue with the driver, but Im not sure.
    Any idea?
    Many thanks
    Regards
    Noelia
    Message was edited by: Noelia Fernandez

  • Executing an Oracle Stored Procedure from Sender JDBC adapter

    I could really use some help from someone who had done this before. 
    I've read the help about using the JDBC sender adapter, but it's not helping enough.
    I found this line: "Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs."
    That's definately what we want to do, but we can't figure out the syntax.
    The procedure in oracle looks like this:
    CREATE OR REPLACE PROCEDURE test_ref_cursor
    ( cur_generic IN OUT result_sets.cur_generic)
    as
    BEGIN
    Open cur_generic for
    select
       proposal_number,
       to_char(sequence_number),
       column_name,
       column_value,
       update_timestamp,
       update_user
       from
       coeus.sap_test;
    END test_ref_cursor;
    And we have tried every kind of statement we can think of, but the file adapter always gives us an "invalid sql statement" error.
    Does anyone know what syntax we need to put in the "Query SQL Statement" in the JDBC sender adapter in order to call this procedure?  Or is there something wrong with the procedure that is causing the error?
    <i>I will absolutely return and give points, but PLEASE read my whole post before answering and do not just link me to or quote the help for configuring a sender JDBC adapter or blogs that are about the JDBC adapter in general but do not deal with the issues I am having. Thank you.</i>

    Hi Vanda,
    Unfortunately, the sender JDBC adapter does not support Oracle's store procedure/function.  Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset.  The sender JDBC adapter must send a resultset to XI.
    There are 2 possible ways you can accomplish this:
    1.  Use BPM and call the Oracle stored procedure using a receiver adapter via a asynch-synch bridge.
    2.  Develop a user-module for the adapter, which can be used with a sender adapter.
    Thanks
    Prasad

  • Need to connect to Oracle 11g using PI 7.1 JDBC adapter

    Hi All,
    I am trying to configure a JDBC adapter to connect Oracle 11g. For this I need to know the driver,jar and connection URL details.
    Can anyone please provide the above information?
    Please correct me if my details are wrong :
    JDBC Driver : oracle.jdbc.driver.OracleDriver
    JAR : ojdbc5.jar
    URL : jdbc:oracle:thin:@localhost:1521:ora11i
    Regards,
    Prakash.

    Yes i knew how to deploy the jars using SDA.
    I will try to deploy the above jar (ojdbc5.jar ) and try to connect to Oracle 11g with URL & Driver classname.
    If I face any problem then i will get  back to you.

Maybe you are looking for