CALLING a STORED SQL FUNCTION from  Java 1.1.8

I am trying to execute a stored function in JAVA 1.1.8, from an Oracle
8i Database. My stored function is simple, it converts an Input Number to an output TIME string. I am unsure how to code the call from Java. Are SQL STORED PROCEDURES treated the same as SQL STORED FUNCTIONS? Do you use the CallableProcdure class or something else?
Thanks for your input.

yep - same way. Except no return value.

Similar Messages

  • Calling a PL/SQL function from java

    I would like to call a pl/sql function from java. My pl/sql function is taking arrays of records as parameters. How do i proceed? Which specific oracle packages do I have to import?
    Please send an example.
    TIA,
    Darko Guberina

    Documentation here: http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref185
    says JPublisher can publish records too.
    But when I change the example given at http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref190 as following:
    PACKAGE "COMPANY" AS
    type emp_rec is record (empno number, ename varchar2(10));
    type emp_list is varray(5) of emp_rec;
    type factory is record (
    name varchar(10),
    emps emp_list
    function get_factory(p_name varchar) return factory;
    END;
    then I see <unknown type or type not found> at sql or java files generated. Any ideas?

  • Error PLS-00306 during calling PL/SQL function from Java

    Hi all,
    I am facing a problem during call of oracle PL/SQL function from java using CallableStatement.
    I receive following error message.
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    As per above error EXPORT_HIST_ALARMS_FUNC in oracle has this signature.
    CREATE OR REPLACE FUNCTION EXPORT_HIST_ALARMS_FUNC(startDateTime VARCHAR2, endDateTime VARCHAR2, meType VARCHAR2) RETURN VARCHAR2 IS
    END EXPORT_HIST_ALARMS_FUNC;
    Above function I have called following way in java.
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(2,startDateTime);
    cStatement.setString(3,endDateTime);
    cStatement.setString(4,meType);
    cStatement.execute();
    msg = cStatement.getString(1);
    Actually above function requires three input parameters and one return parameter.
    During execution of above java code it throws SQLException and shows PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC' error.
    I have run this function directly from oracle with three parameters and run successfully and finally it returns string.
    But I am unable to figure out why it doesn't run from above java code.
    Please help regarding this.
    Thanks.
    Regards,
    Shardul Banker

    Try this:
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(1,startDateTime);
    cStatement.setString(2,endDateTime);
    cStatement.setString(3,meType);
    cStatement.execute();
    msg = cStatement.getString(1);Regards,
    Martijn Teigeler
    Edited by: mTeigeler on Oct 13, 2007 10:22 AM

  • Calling a SP or Function from Java receiving a geometry(MDSYS.SDO_GEOMETRY)

    Hi there,
    What I want to do is: calling a stored procedure OR function from Java with a String-variable as input and receiving a geometry (SDO_GEOMETRY).
    I’m facing currently the problem of calling a stored function on oracle 11g from Java using JPA (EclipseLink), Spring 2.5.6 returning an MDSYS.SDO_GEOMETRY object.
    I’ve tried to call a stored procedure with MDSYS.SDO_GEOMETRY as an output parameter instead, but with no success.
    The function’s signature looks like this:
    CREATE or REPLACE
    FUNCTION GET_GEO_BRD_FUNCTION(p_geo_brd_id IN VARCHAR2) RETURN MDSYS.SDO_GEOMETRY AS
    sdo_geom    MDSYS.SDO_GEOMETRY := null;
    BEGIN
    /* do some fancy stuff on the database side */
      SELECT sp_geom
        INTO sdo_geom
        FROM geo_brd WHERE id = p_geo_brd_id;
      RETURN sdo_geom;
    END;
    The calling code looks like this:
    MyClass extends JpaDaoSupport{
       /** logger */
       protected static final ILogger LOG = LogFactory.getLogger(MyClass.class);
        * {@inheritDoc}
        * @see com.example.MyClass#calculateGeometry(java.lang.String)
       @Override
       public JGeometry calculateGeometry(final String id) {
           JGeometry geometry = null;
           final JpaCallback action = new JpaCallback() {
                @Override
                public Object doInJpa(final EntityManager em) throws PersistenceException {
                   final Session session = JpaHelper.getEntityManager(em).getActiveSession();
                   final StoredFunctionCall functionCall = new StoredFunctionCall();
                   functionCall.setProcedureName("GET_GEO_BRD_FUNCTION");
                   functionCall.addNamedArgument("p_geo_brd_id");
                   functionCall.setResult("sdo_geom", Oracle.sql.STRUCT.class);
                   final ValueReadQuery query = new ValueReadQuery();
                   query.setCall(functionCall);
                   query.addArgument("p_geo_brd_id");
                   final ArrayList args = new ArrayList();
                   args.add("2e531e62-2105-4522-978a-ab8baf19e273");// hardcoded for test
                   final Object result = session.executeQuery(query, args);
                   return result;
        final STRUCT result = (STRUCT) this.getJpaTemplate().execute(action);
        try {
           geometry = JGeometry.load(result);
        } catch (final SQLException e) {
           MyClass.LOG.error("Error loading JGeometry from STRUCT.", e);
           return null;
        return geometry;
    And when I execute the query I get the following error:
    Internal Exception: java.sql.SQLException: ORA-06550: Row 1, Column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: Row 1, Column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call: BEGIN ? := GET_GEO_BRD_FUNCTION(p_geo_brd_id=>?); END;
         bind => [=> sdo_geom, 2e531e62-2105-4522-978a-ab8baf19e273]
    Query: ValueReadQuery()
    So I thought may be let's try it with a stored procedure instead...
    The procedure looks like this:
    CREATE or REPLACE
    PROCEDURE GET_GEO_BRD_PROCEDURE(p_geo_brd_id IN VARCHAR2, sdo_geom OUT MDSYS.SDO_GEOMETRY) AS
    BEGIN
    /* do some fancy stuff on the database side */
      SELECT sp_geom
        INTO sdo_geom
        from geo_brd where id = p_geo_brd_id;
    END;
    The calling Java code in case of the stored procedure looks like this (only the content of the JPACallback has changed):
    @Override
    public Object doInJpa(final EntityManager em) throws PersistenceException {
        final Session session = JpaHelper.getEntityManager(em).getActiveSession();
        final StoredProcedureCall spCall = new StoredProcedureCall();
        spCall.setProcedureName("GET_GEO_BRD_PROCEDURE");
        spCall.addNamedArgument("p_geo_brd_id", "p_geo_brd_id", String.class);
        spCall.addNamedOutputArgument("sdo_geom", "sdo_geom", OracleTypes.STRUCT);
        final ValueReadQuery query = new ValueReadQuery();
        query.setCall(spCall);
        query.addArgument("p_geo_brd_id"); // input
        final List args = new ArrayList();
        args.add("2e531e62-2105-4522-978a-ab8baf19e273");// hardcoded for test
        final Object result = session.executeQuery(query, args);
        return result;
    And when I execute the query I get the following error:
    java.sql.SQLException: ORA-06550: Row 1, Column 13:
    PLS-00306: wrong number or types of arguments in call to 'GET_GEO_BRD_PROCEDURE'
    ORA-06550: Row 1, Column 7:
    PL/SQL: Statement ignored
    So both exceptions look quite similar.
    I guess in both cases the exception description leads to the assumption, that the wrong type for the return value / output parameter is used…
    So - how can a receive a MDSYS_SDO_GEOMETRY object from a stored procedure or stored function in Java ?
    What is wrong in the Java code?
    Thank you in advance for any suggestions!
    Yours,
    Chris
    Edited by: user3938161 on 20.12.2011 07:46
    Edited by: user3938161 on Dec 20, 2011 8:06 AM: added variable declaration of JGeometry geometry in source code

    Thanks, that did the trick! ;-)
    Here is now the code for stored procedure and function for anybody else encountering the same troubles... (be aware of the parameter order and/or naming!)
    Code for stored functions:
    final JpaCallback action = new JpaCallback() {
      @Override
      public Object doInJpa(final EntityManager em) throws PersistenceException {
         final Session session = JpaHelper.getEntityManager(em).getActiveSession();
           * Using CallableStatement for stored functions
          STRUCT st = null;
          CallableStatement cs = null;
          final DatabaseLogin login = session.getLogin();
          final Connection _conn = (Connection) login.connectToDatasource(session.getDatasourceLogin().buildAccessor(), session);
          try {
             try {
                cs = _conn.prepareCall("{? = call GET_GEO_BRD_FUNCTION(?)}");
                cs.registerOutParameter(1, OracleTypes.STRUCT, "MDSYS.SDO_GEOMETRY");
                cs.setString(2, "2e531e62-2105-4522-978a-ab8baf19e273");//TODO: hardcoded for test
                cs.execute();
             } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured calling the stored procedure", e);
             if (cs != null) {
                //reading geometry from the database
                try {
                   st = (STRUCT) cs.getObject(1);
                } catch (final SQLException e) {
                   MyClass.LOG.error("An exception occured converting the query result to oracle.sql.STRUCT", e);
          } finally {
             try {
                if (_conn != null && !_conn.isClosed()) {
                    _conn.close();
             } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured on closing the database connection.", e);
          return st;
    final STRUCT result = (STRUCT) this.getJpaTemplate().execute(action);
    The code for stored procedure solution:
    final JpaCallback action = new JpaCallback() {
      @Override
      public Object doInJpa(final EntityManager em) throws PersistenceException {
          final Session session = JpaHelper.getEntityManager(em).getActiveSession();
           * Using CallableStatement for stored procedure
          STRUCT st = null;
          CallableStatement cs = null;
          final DatabaseLogin login = session.getLogin();
          final Connection _conn = (Connection) login.connectToDatasource(session.getDatasourceLogin().buildAccessor(), session);
          try {
             try {
                cs = _conn.prepareCall("{call GET_GEO_BRD_PROCEDURE(?,?)}");
                cs.setString("p_geo_brd_id", "2e531e62-2105-4522-978a-ab8baf19e273");
                cs.registerOutParameter("sdo_geom", OracleTypes.STRUCT, "MDSYS.SDO_GEOMETRY");
                cs.execute();
              } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured calling the stored procedure", e);
              if (cs != null) {
                //reading geometry from the database
                try {
                   st = (STRUCT) cs.getObject("sdo_geom");
                } catch (final SQLException e) {
                   MyClass.LOG.error("An exception occured converting the query result to oracle.sql.STRUCT", e);
           } finally {
              try {
                if (_conn != null && !_conn.isClosed()) {
                   _conn.close();
              } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured on closing the database connection.", e);
            return st;
    final STRUCT result = (STRUCT) this.getJpaTemplate().execute(action);

  • Call a pl/sql function froma jsp

    I need to call an pl/sql function which basically returns true or false depending on the count. based on the return value I have to alert a message. how can i call the pl/sql fucntion in a jsp?
    thanks for ur help.

    You call the function the same way you would from anywhere, although i don't recommend you call database functions directly from a JSP page as it's bad form.

  • Calling Window's Dll Functions from Java

    Hello Audience,
    Is there a way to call Win32/64 based Dynamic-Link-Library functions from Java?
    Thanks,
    GenKabuki

    Yes.
    In general, if you are trying to call functions in an existing dll, you will have to write a "wrapper" dll that meets the java jni interface requires. There are tools around wich purport to generate these for you. Do a google serach; among other tools, you should turn up JACE.

  • Calling a pl/sql function from oracle forms

    I have written a pl/sql function in a package.
    package name- sup
    function name - func
    I have written a when-button-pressed trigger .from here I want to call this function.
    How can I do that?
    Please help..

    Thanks a lot..
    User may select 20-30 check boxes for respective name & id...then at the end , user will hit OK...from here when-button-click will call a procedure....that will update/insert/delete a table data.The procedure I have written is:-
    DECLARE
    N_CNT Number(1);
    D_SYSDATE Constant date :=sysdate;
    Begin
    select count(1)
    into N_CNT
    from dbtable L
    where L.land_id = :BLK1.LAND_ID and
    L.Operatoer_id = :BLK1.Operatoer_id and
    L.suppl_id = :BLK1.suppl_id and
    L.suppl_prof_id = :BLK1.suppl_prof_id;
    if ((N_CNT = 0) and (:LANDLISTE.state = 'A')) then
    insert into dbtable
    LAND_ID,
    STATE,
    suppl_prof_id,
    suppl_id,
    OPERATOER_ID,
    SIDST_OPD_DATO,
    SIDST_OPD_INIT
    values
    :BLK1.LAND_ID,
    'Y',
    :BLK1.suppl_prof_id,
    :BLK1.suppl_id,
    :BLK1.Operatoer_id,
    D_SYSDATE,
    :BLK1.SIDST_OPD_INIT
    elseif
    ((N_CNT>0 )and (:LANDLISTE.state = 'A')) then
    update dbtable L
    set L.SIDST_OPD_DATO = D_SYSDATE,
    L.SIDST_OPD_INIT = :BLK1.SIDST_OPD_INIT
    where L.land_id = :BLK1.LAND_ID and
    L.Operatoer_id = :BLK1.Operatoer_id and
    L.suppl_id = :BLK1.suppl_id and
    L.suppl_prof_id = :BLK1.suppl_prof_id;
    elseif ((N_CNT>0 ) and (:LANDLISTE.state = 'D')) then
    delete from dbtable L
    where L.land_id = :BLK1.LAND_ID and
    L.Operatoer_id = :BLK1.Operatoer_id and
    L.suppl_id = :BLK1.suppl_id and
    L.suppl_prof_id = :BLK1.suppl_prof_id;
    end if;
    end;
    Will it be able to load multiple data(20-30 at a time) to the table?
    Should I write anything to commit the data in the table?
    I am very new to oracle forms...please help..

  • Unable to call a pl/sql procedure from java

    Software : Oracle 9i & Red hat linux 9
    Code:
    import java.io.*;
    import java.sql.*;
    public class test
    public static void main(String args[])
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.221:1521:elearn","gowri","gowri");
    CallableStatement call=con.prepareCall("{call ins(?,?,?,?)}");
    call.setInt(1,5);
    call.setString(2,"hari");
    call.setString(3,"m");
    call.setString(4,"1976-12-26");
    if ( call.execute() )
    System.out.println("Success");
    else
    System.out.println("fails");
    call.close();
    con.close();
    catch(Exception ex)
    System.out.println("Error :"+ex);
    ~
    ~
    ~
    Stored Procedure:
    create or replace procedure ins(no in number,name in varchar,sex in varchar,dob in varchar)is
    con_day date;
    begin
    con_day=to_date(dob,'yyyy-mm-dd');
    insert into person values(no,name,sex,con_day);
    end;
    Run Time Error:
    Exception in thread "main" java.lang.IncompatibleClassChangeError: oracle.jdbc.driver.OraclePreparedStatement
    at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x4025bc8e: java.lang.Error.Error(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x4025d6b6: java.lang.LinkageError.LinkageError(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x4025c7aa: java.lang.IncompatibleClassChangeError.IncompatibleClassChangeError(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x40229eed: JvPrepareClass(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x40248028: java.lang.ClassLoader.linkClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x4025acb3: java.lang.ClassLoader.resolveClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x402299cb: JvPrepareClass(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x40248028: java.lang.ClassLoader.linkClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x4025acb3: java.lang.ClassLoader.resolveClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x4024646c: java.lang.Class.initializeClass() (/usr/lib/./libgcj.so.3)
    at 0x40230912: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x40230ff4: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x4022e504: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
    at 0x4038305c: ?? (??:0)
    at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
    at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
    at 0x402306e8: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x40230ff4: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x4022e58a: JvInterpMethod.run_synch_object(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
    at 0x4038305c: ?? (??:0)
    at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
    at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
    at 0x402306e8: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x40230ff4: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x4022e504: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
    at 0x4038305c: ?? (??:0)
    at 0x40242dd8: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/./libgcj.so.3)
    at 0x402ad02d: gnu.gcj.runtime.FirstThread.run() (/usr/lib/./libgcj.so.3)
    at 0x4024fc4c: JvThreadRun(java.lang.Thread) (/usr/lib/./libgcj.so.3)
    at 0x4021c8ac: JvRunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/./libgcj.so.3)
    at 0x08048910: ?? (??:0)
    at 0x42015574: __libc_start_main (/lib/tls/libc.so.6)
    at 0x080486c1: ?? (??:0)

    Hi Gowrishankar,
    This is just a suggestion (based on a guess). Try changing this line of your code:
    call.setInt(1,5);with this line:
    call.setBigDecimal(1,5);Good Luck,
    Avi.

  • Calling PL/SQL function from external Java class

    I was wondering if I was able to call a pl/sql function from an external java class? If so, would you be able to tell me briefly on how to go about it. I know I can call java methods that are internally stored in the db from pl/sql, but I was hoping I could call pl/sql from external java. Thanks,
    Kelly

    Ok, I made the changes, but I'm now getting the following error:
    Error code = 1403
    Error message = ORA-01403: no data found
    ORA-06512: at "IOBOARD.GETSTATUS", line 6
    ORA-06512: at line 1
    The ora-01403 I don't understand because there is data for the name Kelly.Brace.
    ora-06512 error: at string line string.
    Here's what the code looks like after I made the changes:
    String sql = "{?=call ioboard.GetStatus(?)}";
          // create a Statement object
          myStatement = myConnection.prepareCall( sql );
          myStatement.setString( 1, "Kelly.Brace" );
          myStatement.registerOutParameter(2, java.sql.Types.LONGVARCHAR );
          // create a ResultSet object, and populate it with the
          // result of a SELECT statement
          ResultSet myResultSet = myStatement.executeQuery();
          // retrieve the row from the ResultSet using the
          // next() method
          myResultSet.next();
          // retrieve the user from the row in the ResultSet using the
          // getString() method
          String status = myResultSet.getString(1);
          System.out.println("Hello Kelly, your status is: " + status);
          // close this ResultSet object using the close() method
          myResultSet.close();Here's what the function looks like:
    CREATE OR REPLACE FUNCTION GetStatus( user_name in varchar2)
    RETURN VARCHAR2
    is
    v_status varchar2(10);
    BEGIN
    select iob_location into v_status
    from ioboard.iob_user
    where iob_username = user_name;
      RETURN( v_status);
    END;This works perfectly in the SQL Window:
    select iob_location
    from ioboard.iob_user
    where iob_username = 'Kelly.Brace';

  • Calling OCI functions from Java

    Is it possible to call OCI's API functions from Java and create a Lightweight Session ?
    Please help me out.

    I too would like to know how this can be accomplished. I have
    seen several posts that claim it is possible with Oracle91.

  • The troubles with creating SQL function in Java

    Hi!
    I use Oracle 10g and connect to it from Java application. I need in creating SQL functions from Java code.
    In Java I have:
    Statement stm = null; try{     stm = dbConnection.createStatement();     stm.executeUpdate( query ); }catch(SQLException ex){     throw ex; }finally{     try{ stm.close(); }catch(Exception ex){ stm.close(); } }
    And I'm passing the next SQL function:
    create or replace function get_me return number is
    result number;
    begin
    select 5 into result from dual;
    return result;
    end;
    This code is run successful, but I can't call this funtion, because it has status Invalid
    I'm looked the next error: PLS-00103: Encountered the symbol "" when expecting one of the following: . @ % ; is authid as cluster order using external character deterministic parallel_enable pipelined aggregate
    But I don't understand, What the matter? From Oracle Enterprise Manager I can create this function without problems. So, I wrote the wong Java code. Also, I can't find my error :(
    May be, do u have the some ideas?
    Thank you very much!

    Post the whole pl/sql code please.
    To run PL/SQL from within java you'll need callablestatement.
    [here |http://www.idevelopment.info/data/Programming/java/jdbc/PLSQL_and_JDBC/CallPLSQLFunc.java] an example : http://www.idevelopment.info/data/Programming/java/jdbc/PLSQL_and_JDBC/CallPLSQLFunc.java

  • How to execute a procedure or function from Java Stored procedure

    Hi,
    I am new to Java Stored Procedures. I am working on Oracle 8i and JVM 1.3.1. I want to call a PL/SQL procedure from within Java. I have tried looking at severa; cources but they are quite high level for me. Can someone provide a simple example including the Source Code for .java file and also the calling function's code?
    Heres a sample of what I have been working on: I an including Java code, and Function code and how I call the function. Instead of doing "select sysdate from dual" I want to do like "create table temp1(var1 varchar2(10))" or similar... like "exec procname(var1)" etc.
    Thanks in advance.
    PS. The variable passed in function is just a dummy variable.
    -----Begin Java code-------
    import java.sql.SQLException;
    import java.sql.PreparedStatement;
    import java.sql.Statement;
    import java.sql.Connection;
    import java.sql.ResultSet;
    //Oracle Extensions to JDBC
    import oracle.jdbc.driver.OracleDriver;
    public class Test2{
    public static String Testing(String d) {
    Connection connection = null; // Database connection object
    try {
    // Get a Default Database Connection using Server Side JDBC Driver.
    // Note : This class will be loaded on the Database Server and hence use a
    // Se[i]Long postings are being truncated to ~1 kB at this time.

    what your after is
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:oci:@<hoststring>", "scott", "tiger");
    CallableStatement cs = conn.prepareCall ("begin ? := foo(?); end;");
    cs.registerOutParameter(1,Types.CHAR);
    cs.setString(2, "aa");
    cs.executeUpdate();
    String result = cs.getString(1);
    a more complete description can be found in the documentation at
    http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/basic.htm#1001934
    Dom

  • ORA-00911: invalid character - Calling a function from Java..

    Hi to all.. I have an issue when calling an oracle function from Java..
    This is my Java code:
    final StringBuffer strSql = new StringBuffer();
    strSql.append("SELECT GET_TBL('II_2_1_6_5') AS TABLA FROM DUAL;");
    st = conexion.createStatement();
    rs = st.executeQuery(strSql.toString());
    and in the executeQuery a SQLException is throwed:
    java.sql.SQLException: ORA-00911: invalid character
    I paste the query in TOAD and it works.. :S
    anybody knows how can I solve this?

    Remove the Semicolon after Dual.
    strSql.append("SELECT GET_TBL('II_2_1_6_5') AS TABLA FROM DUAL");
    Sushant

  • How to call a PL/SQL procedure from a Java class?

    Hi,
    I am new to the E-BusinessSuite and I want to develop a Portal with Java Portlets which display and write data from some E-Business databases (e.g. Customer Relationship Management or Human Resource). These data have been defined in the TCA (Trading Community Architecture) data model. I can access this data with PL/SQL API's. The next problem is how to get the data in the Java class. So, how do you call a PL/SQL procedure from a Java program?
    Can anyone let me know how to solve that problem?
    Thanks in advance,
    Chang Si Chou

    Have a look at this example:
    final ApplicationModule am = panelBinding.getApplicationModule();
    try
         final CallableStatement stmt = ((DBTransaction)am.getTransaction()).
                                                                                         createCallableStatement("{? = call some_pck.some_function(?, ?)}", 10);
         stmt.registerOutParameter(1, OracleTypes.VARCHAR);
         stmt.setInt(2, ((oracle.jbo.domain.Number)key.getAttribute(0)).intValue());
         stmt.setString(3, "Test");
         stmt.execute();
         stmt.close();
         return stmt.getString(1);
    catch (Exception ex)
         panelBinding.reportException(ex);
         return null;
    }Hope This Helps

  • How to call a SQL function from an XSL expression

    Hi
    In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
    The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
    The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
    1) How to call a SQL function from an XSL expression that is allowed in BI template.
    If anyone ahs faced similar requirements please share your approach.
    Thanks
    Srimathi

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

Maybe you are looking for

  • JSP page not rendering correctly for remote system

    I have a jsp page that has an HtmlGraphicImage component that gets set by a method in a java bean using image2.setUrl( imageFilename ); When I run the application on my local system (my development system running Studio Creator) the page comes up on

  • GPU renderMode

    Running an Air 3 mobile app in gpu renderMode is horrible. A List component with a couple custom ItemRenderers breaks when scrolling up and down. The StyleableTextField components would be misaligned, the backgrounds would not draw correctly, images

  • Dynamic calculation in Queries

    I have a typical requirement. There is 1 column in my query that needs user input(discount rate). Whatever the user inputs, that number(discount rate) and age of the employee needs to be checked or looked up in another cube which stores the discount

  • Just installed Bonjour no printers show up

    I just installed the bonjour app and no printers show up and there is no place to add printers. What do I need to do to add the printrers. I have an airport extreme network with printers connected via usb or attached directly to the network. There ar

  • Firefox 4.0 beta 8 doesn't show tab label in IBM Lotus Domino Web Access while earlier version of FF and other IE do.

    Firefox 4.0 beta 8 doesn't show tab label in IBM Lotus Domino Web Access while earlier version of FF and other IE do.