Calling Stored Function

Hi all,
Trying to call a stored function from vfp5 using odbc, not ado. I'm having issues with the correct syntax of the statement. Can I not use the standard vfp sqlexec() command? ( i.e. sqlexec( connhandle, "{call package.function()}, "returncursor" ) Any help would be great since my customer has no clue on this, and frankly, neither do I.

This is supported in the next code drop of the XSQL Servlet. Due out on OTN in the next couple of weeks.

Similar Messages

  • How to call stored function in my jsp

    how to call stored function in my jsp?
    please give me a example.

    Hi,
    think we need mor einformation, like JDeveloper release and the how you do access the database (JDBC, BC4J, EJB,ADF...)
    Frank

  • Calling Stored Function from Excel

    Folks,
    Can someone help me with an Excel Macro that will call an Oracle stored function taking in parameter from one of the Excel Cell and return the value from the function into a different cell in the spreadsheet?
    Thanks

    This is not the right Forum for this query still here is something for you to start with
    The oracle function to add 1 to the input parameter
    create or replace function AddOne(ID Number) return number is
    Numout Number:=0;
    begin
    numout:=id+1;
    return numout;
    end;
    The Macro in Excel file to run the above function(Please add necessary references for ado connectivity)
    Option Explicit
    Dim Objconn As ADODB.Connection
    Sub Macro1()
    Dim StrSql As String
    Dim ObjRs As New ADODB.Recordset
    Dim I As Long
    StrSql = "Provider=OraOLEDB.Oracle.1;Password=swallocation;Persist Security Info=True;User ID=swallocation;Data Source=dumpdb"
    Set Objconn = New ADODB.Connection
    Objconn.Open StrSql
    For I = 2 To Sheet1.Rows.Count
    If Not CStr(Sheet1.Cells(I, 1)) = "" Then
    ObjRs.Open "select AddOne(" + CStr(Sheet1.Cells(I, 1)) + ") from dual", Objconn
    If Not ObjRs.EOF And Not ObjRs.BOF Then
    ObjRs.MoveFirst
    Sheet1.Cells(I, 2) = ObjRs(0).Value
    End If
    ObjRs.Close
    Else
    Exit For
    End If
    Next
    Set ObjRs = Nothing
    Objconn.Close
    Set Objconn = Nothing
    End Sub
    Hope you get something to start with
    Prakash...

  • Calling Stored Function from DOT NET

    Hi,
    I am trying to call a stored function "PKG_MIS_USER_MASTER.ADD_USER(userid varchar2, password varchar2) return NUMBER" from my DOT NET application.
    Everything works fine within TOAD. Can anyone please help me in writing the C# code for calling a stored function along with its return value.
    Thanks in Advance.

    You can (as of 15-JUL-2005) get chapter 5 and chapter 7 of my book from the ODP.NET homepage, which is located here:
    http://www.oracle.com/technology/tech/windows/odpnet/index.html
    The link is at the bottom of the page.
    The direct link is:
    http://www.oracle.com/technology/books/pdfs/dotnet_ch5_7.pdf
    Chapter 5 covers using PL/SQL from .NET.
    - Mark

  • Calling Stored Function from TopLink

    I have a simple Stored Function that I'm trying to call using TopLink API:
    TopLink Version: 10.1.3.3.
    Oracle JDBC Driver: ojdbc5.jar (Oracle JDBC Driver version - "11.1.0.6.0-Production+")
    Stored Procedure:
    Function Get_Email_Address_Id(P_EMAIL_ADDRESS IN varchar2) return number;
    TopLink Code:
    public String executeStoredFunction() {
    TopLinkTemplate tlTemplate = getTopLinkTemplate();
    StoredFunctionCall call = new StoredFunctionCall();
    call.setProcedureName("EMAIL_ADDRESS_PKG.Get_Email_Address_Id");
    call.setResult("FUNCTION_RESULT", String.class);
    call.addNamedArgument("P_EMAIL_ADDRESS");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("P_EMAIL_ADDRESS");
    Vector parameters = new Vector();
    parameters.addElement("1009");
    String result = (String)tlTemplate.executeQuery(query, parameters.toArray());
    return result;
    Error I'm getting:
    Exception [TOPLINK-7121] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070428)): oracle.toplink.exceptions.ValidationException
    Exception Description: DatabasePlatform does not support stored functions
         at oracle.toplink.exceptions.ValidationException.platformDoesNotSupportStoredFunctions(ValidationException.java:1299)
         at oracle.toplink.queryframework.StoredFunctionCall.prepareInternal(StoredFunctionCall.java:52)
         at oracle.toplink.internal.databaseaccess.DatabaseCall.prepare(DatabaseCall.java:494)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.prepareCall(CallQueryMechanism.java:102)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.prepareExecuteSelect(CallQueryMechanism.java:203)
         at oracle.toplink.queryframework.DataReadQuery.prepare(DataReadQuery.java:150)
         at oracle.toplink.queryframework.DatabaseQuery.checkPrepare(DatabaseQuery.java:405)
         at oracle.toplink.queryframework.DatabaseQuery.checkPrepare(DatabaseQuery.java:375)
         at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:598)
         at oracle.toplink.queryframework.DataReadQuery.execute(DataReadQuery.java:96)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:2089)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:993)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:965)
    Observations:
    Why is TopLink complaining about DatabasePlatform?
    I'm using Oracle 10g as my database platform. Did anyone encounter this problem?
    I have tried various combinations but it always have same complaint.
    Thanks in advance for help.

    Hello,
    It is complaining because the DatabasePlatform being used doesn't support functions. So the problem is that it is using the DatabasePlatform instead of the Oracle10Platform that you are expecting. How have you defined it? Could you have multiple sessions.xml files, and the one that is being picked not define the Oracle10Platform? Or could you be overriding the login somehow (prelogin event etc) and setting it to use the default DatabasePlatform by accident?
    Best Regards,
    Chris

  • Calling stored function that contains commit from .JCX

    I would like to call a stored function (Oracle) that contains a commit, from
    a WebLogic database control (.JCX). The suggested way to call a stored
    function is to do something like:
    * @jc:sql statement::
    * SELECT MY_FUNCTION({projectID}, {staffID}) FROM DUAL
    int callMyFunction(int projectID, int staffID) throws SQLException;
    This doesn't work if the function contains a commit - I get: ORA-14552:
    cannot perform a DDL, commit or rollback inside a query or DML. I don't
    want to just get my own connection to the db in my code and call it directly
    because then I won't be using the connection pool provided by WebLogic. Is
    there a recommended way to do this? So far, the database control has taken
    care of getting connections from the pool. Can I get a connection from the
    pool explicitely and use it? How do I "return" it to the pool?
    Thanks.
    Steve

    Steve Kincer wrote:
    Thanks for the response.
    So far, I've only used the database control, so I haven't been doing any
    transaction management (rollbacks/commits) myself - I've just called methods
    in my database control and not worried it. Come to think of it, all my
    other calls are just SELECTs, so it hasn't been an issue, but I've assumed
    WebLogic or the connection pool would take care of transaction management
    for me if I coded an UPDATE function in the database control.
    What do you mean by "find and use the control API provided for
    defining/demarking
    transactions" ... what control?
    I've seen stuff in the help file about transaction management, so I can
    research that, but where do I get the connection to use for this? I'm
    thinking I should get it from the pool (rather than create my own
    connection). I saw a generated method in my database control called
    getConnection, but when I tried using it with a CallableStatement I got
    error:
    "The transaction is no longer active - status: 'Committed'. No further JDBC
    access is allowed within this transaction."This means that you are automatically being taken care of transactionally,
    and don't need to do any commit() calls.
    Joe
    >
    I guess it's pretty obvious that I'm pretty new to WebLogic.
    Thanks for your help.
    Steve
    "Joe Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    Steve Kincer wrote:
    I would like to call a stored function (Oracle) that contains a commit,
    from a WebLogic database control (.JCX). The suggested way to call a
    stored function is to do something like:
    * @jc:sql statement::
    * SELECT MY_FUNCTION({projectID}, {staffID}) FROM DUAL
    int callMyFunction(int projectID, int staffID) throws SQLException;
    This doesn't work if the function contains a commit - I get: ORA-14552:
    cannot perform a DDL, commit or rollback inside a query or DML.Right. It is bad style to hide a commit in a procedure. The begin-tx
    and commit should be at the same level, above any specific SQL for the
    tx. How did you start a transaction? Are you sure you have an ongoing
    transaction?
    I don't
    want to just get my own connection to the db in my code and call it
    directly because then I won't be using the connection pool provided by
    WebLogic. Is there a recommended way to do this? So far, the database
    control has taken care of getting connections from the pool. Can I get a
    connection from the pool explicitely and use it? How do I "return" it to
    the pool?You should find and use the control API provided for defining/demarking
    transactions.
    Joe
    Thanks.
    Steve

  • Calling Stored function and showing returned value on the UI screen

    I am calling a stored function by using the following steps mentioned as per the below link. The stored function returns a single scalar value
    http://download.oracle.com/docs/cd/E1790401/web.1111/b31974/bcadvgen.htm#sm0297_
    Please verify if I am putting the code in the classes as required by the ADF framework.
    * 1) In class CustomApplicationModuleImpl extends ApplicationModuleImpl*
    // Some constants
    public static int NUMBER = Types.NUMERIC;
    public static int DATE = Types.DATE;
    public static int VARCHAR2 = Types.VARCHAR;
    protected Object callStoredFunction(int sqlReturnType, String stmt,
    Object[] bindVars) {
    CallableStatement st = null;
    try {
    // 1. Create a JDBC CallabledStatement
    st = getDBTransaction().createCallableStatement(
    "begin ? := "+stmt+";end;",0);
    // 2. Register the first bind variable for the return value
    st.registerOutParameter(1, sqlReturnType);
    if (bindVars != null) {
    // 3. Loop over values for the bind variables passed in, if any
    for (int z = 0; z < bindVars.length; z++) {
    // 4. Set the value of user-supplied bind vars in the stmt
    st.setObject(z + 2, bindVars[z]);
    // 5. Set the value of user-supplied bind vars in the stmt
    st.executeUpdate();
    // 6. Return the value of the first bind variable
    return st.getObject(1);
    catch (SQLException e) {
    throw new JboException(e);
    finally {
    if (st != null) {
    try {
    // 7. Close the statement
    st.close();
    catch (SQLException e) {}
    With a helper method like this in place, calling the func_with_no_args procedure shown in Example 37-7 would look like this:
    *2) In class CustomServiceImpl extends CustomApplicationModuleImpl*
    public String callEnvironmentName(){
    return (String) callStoredFunction(VARCHAR2, "CAR_UTIL_PK.get_environment_name()", new Object[] {});
    3) If I have the first two steps correct, I was to display the value returned by method callEnvironmentName() with scalar values like (Development, Production etc) at the footer of each JSFX page. What is the flow I should follow, should I call callEnvironmentName() from some managed bean? Also I want to store it once on first call to some application variable and use that to populate the JSFX pages. Is there a working example. What is the best practice?
    Thanks
    Edited by: user5108636 on Apr 5, 2011 11:58 PM

    Hi John,
    Duplicate alerts are coming for BP_Confirmed as well as one custom event. Earlier I thought there is some issue with my custom event, but when it came for BP_Confirmed also, then i have a doubt something is wrong with the application.
    I have also checked that BP_Confirmed is being raised only once inside the method-BP_CONFIRM of class-cl_crmcmp_b_cucobupa_impl.
    raise event BPConfirmed
      CLASS cl_crm_ic_services DEFINITION LOAD.
      CREATE OBJECT event.
      event->set_name( if_crm_ic_events_con=>gc_bpconfirmed ).
      event_srv = cl_crm_ic_services=>get_event_srv_instance( ).
      event_srv->raise( event ).
    Are you aware of any other place from where this event is getting triggered?
    Thanks for your help!
    Regards,
    Rohit

  • Calling stored function within select

    Hi,
    I am working with ODP.NET and Oracle 8.1.7 for two years now and I solved a lot of problems. But now I am really in trouble:
    I need to call a stored function (that is within a package) from a select statement:
    Here is a very simple test case (the real select is much more complicated)
    select PFM.P_COSTING.CALC ( 0 ) from dual;
    this works fine in TOAD, but When I try to do the same from C#/ODP.NET, I always get the following error:
    ORA-00904: Invalid column name
    Can anybody help?
    Here my package (scheme is “PFM”):
    CREATE OR REPLACE PACKAGE BODY P_Costing AS
    FUNCTION Calc ( x number)
    return number IS
    BEGIN
    RETURN 1;
    END Calc;
    END P_Costing;
    thanks in advance
    markus

    It works fine for me, but you might not want to use "PFM.P_COSTING.CALC ( 0 )" as a column name.
    Try aliasing the expression
    select PFM.P_COSTING.CALC ( 0 ) result from dual;
    David

  • Call stored function return array

    Hi all,
    I have a function as follow:
    create or replace TYPE string_table IS TABLE OF VARCHAR2(2000);
    create or replace TYPE ARRAYTYPE is VARRAY(20) OF VARCHAR2(30);
    create or replace FUNCTION getEmpArray(s varchar2, t varchar2, st string_table) RETURN ARRAYTYPE AS
    l_data ARRAYTYPE := ARRAYTYPE();
    BEGIN
    l_data.extend; l_data(l_data.count) := s; l_data.extend; l_data(l_data.count) := t; l_data.extend; l_data(l_data.count) := st(1); RETURN l_data;
    END;
    I want to call this function by StoredFunctionCall
    code:
    StoredFunctionCall fun = new StoredFunctionCall();
    fun.setProcedureName("getEmpArray".toUpperCase());
    Object[] arr = new Object[]{"aa", "fgfg", "bbb"};
    ArrayDescriptor arrDescriptor =
    ArrayDescriptor.createDescriptor("string_table".toUpperCase(),
    connection);
    ARRAY arrayToPass = new ARRAY(arrDescriptor, connection, arr);
    fun.addUnamedArgumentValue("a");
    fun.addUnamedArgumentValue("b");
    fun.addUnamedArgumentValue(arrayToPass);
    fun.setResult("FUNCTION_RESULT"); // for get result by this name
    Vector<DatabaseRecord> list = session.executeSelectingCall(fun);
    But Exception
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call: BEGIN ? := GETEMPARRAY(?, ?, ?); END;
         bind => [=> FUNCTION_RESULT, a, b, oracle.sql.ARRAY@21fbc01]
    Please help me
    Edited by: fbg on 21:52 26-04-2010

    A few issues,
    1 - JDBC does not support the PLSQL TABLE type, you must use a VARRAY type, or wrap the TABLE function call in a function that takes a VARRAY.
    TopLink also has support for PLSQL types in its PLSQLStoredProcedureCall class, but no support is currently offered for StoredFunctions.
    You can't pass the VARRAY type for the TABLE argument.
    2 - Your function returns a VARRAY, so you need to define this type in the StoredFunctionCall result.
    We don't currently expose the API to set a Array type for the result, so you would need to access the call's first parameter directly, or use a StoredProcedureCall (and convert your function to a procedure).
    You may also wish to investigate returning a cursor from a stored procedure instead of the varray.
    You could also access the JDBC connection directly and perform the call using JDBC code.
    Feel free to log these issues in EclipseLink.
    James : www.eclipselink.org

  • Oracle 8..How to call stored Procedure to call stored Function

    Student here. Using Oracle 8, without Procedure Builder. Only have SQLPlus environment. Three simple code blocks follow:
    block One Creates a Function
    block Two Creates a Procedure
    ...However, I do not know how to Start, Run, Get..@ <or whatever command at SQL> prompt, to run the Procedure to call the Function.
    block Three is a script that calls the function, but I wish to call the stored procedure (from block Two above). My user manual PL/SQL Intro does not address.
    Please provide simple SQL Plus steps, command, path whatever.
    Very grateful to any or all who assist
    Wayne
    [email protected]
    -- CODE BLOCK #1 ----------------------------
    SQL>CREATE OR REPLACE FUNCTION COST_INCREASE_F (V_INCOMINGSAL NUMBER)
    2 RETURN EMP.SAL%TYPE
    3 IS
    4 V_NEWSAL EMP.SAL%TYPE;
    5 F_CONSTANT CONSTANT NUMBER :=1.05;
    6
    7 BEGIN
    8 V_NEWSAL := V_INCOMINGSAL * F_CONSTANT;
    9 RETURN V_NEWSAL;
    10
    11 END;
    12 /
    Function created.
    -- CODE BLOCK # 2----------------------------
    SQL>CREATE OR REPLACE PROCEDURE NEW_SALARY2
    2 IS
    3 V_SALFROMDBASE NUMBER;
    4 V_NEWVALFROMFUNC NUMBER;
    5
    6 BEGIN
    7 SELECT SAL
    8 INTO V_SALFROMDBASE
    9 FROM EMP
    10 WHERE EMPNO = 7839;
    11
    12 V_NEWVALFROMFUNC := COST_INCREASE_F(V_SALFROMDBASE);
    13
    14 DBMS_OUTPUT.PUT_LINE(V_SALFROMDBASE| |' '| |V_NEWVALFROMFUNC);
    15 END;
    16 /
    Procedure created.
    CODE BLOCK # 3---------------------------
    SQL>DECLARE
    2 V_SALFROMDBASE NUMBER;
    3 V_NEWVALFROMFUNC NUMBER;
    4
    5 BEGIN
    6 SELECT SAL
    7 INTO V_SALFROMDBASE
    8 FROM EMP
    9 WHERE EMPNO = 7839;
    10
    11 V_NEWVALFROMFUNC := COST_INCREASE_F(V_SALFROMDBASE);
    12
    13 DBMS_OUTPUT.PUT_LINE(V_SALFROMDBASE| |' '| |V_NEWVALFROMFUNC);
    14 END;
    15 /
    5000 5250
    PL/SQL procedure successfully completed.
    null

    Follow this steps to run the procedure.
    1. save the procedure in a folder in your hard disk as NEW_SALARY2.SQL.
    2. go to SQL*PLUS and then goto FILE->OPEN
    3. Then goto your folder where you have saved your procedure and then click once(only once) on the procedure name and then click cancel.
    4. Then type SQL>@NEW_SALARY2.SQL;
    it will execute your procedure.
    important: if you don't want to do that then
    type:
    SQL>exec c:\myfolder\NEW_SALARY2.sql
    it will execute your procedure.
    The same applies for your script.
    I hope this will help. If u still need help
    email me at [email protected]
    null

  • Call stored function / stored procedure from JAVA/JPA and pass array

    I fail calling a plsql function from java with jpa - it works perfect without the array but its not working with the array:
    PLSQL Function:
    function getHtml(pWhere VARCHAR2 DEFAULT NULL,
    pColSort HTP.STRINGARRAY) return clob is
    begin
    errorhndl.Log(pMessage => 'called');
    htp.prn('das ist der test
    for i in 1 .. pColSort.count loop
    htp.p('
    pColSort['||i||']: '||pColSort(i));
    end loop;
    htp.prn('
    <table> <tr> <td> max1.0 </td> <td> max2.0 </td> </tr>');
    htp.prn('<tr> <td> max1.1 </td> <td> max2.1 </td> </tr> </table>');
    htp.prn('test ende');
    return htp.gHtpPClob;
    exception
    when others then
    null;
    end getHtml;
    PLSQL TYPE: (in HTP package - self created - but could be anywhere else too)
    type STRINGARRAY is table of varchar2(256) index by binary_integer;
    JAVA DOA:
    public class ShowReportDOAImpl implements ShowReportDOA {
    private JdbcTemplate jdbcTemplate;
    private SimpleJdbcCall procShowReport;
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
    this.jdbcTemplate = jdbcTemplate;
    procShowReport = new SimpleJdbcCall(this.jdbcTemplate)
    .withCatalogName("Show_Report")
    .withFunctionName("getHtml")
    .withoutProcedureColumnMetaDataAccess()
    .declareParameters(
    new SqlParameter("pWhere", Types.VARCHAR),
    new SqlParameter("pColSort", Types.ARRAY, "HTP.STRINGARRAY"),
    new SqlOutParameter("RETURN", Types.CLOB)
    public String readReport(Long id, ParameterHelper ph) {
    String[] sortCol = {"max", "michi", "stefan"};
    String pWhere = "fritz";
    MapSqlParameterSource parms = new MapSqlParameterSource();
    parms.addValue("pWhere", pWhere);
    parms.addValue("pColSort", sortCol, Types.ARRAY, "HTP.STRINGARRAY");
    parms.addValue("pColSort", Arrays.asList(sortCol), Types.ARRAY, "HTP.STRINGARRAY");
    Clob clob = procShowReport.executeFunction(Clob.class, parms);
    String clobString = "";
    try {
    System.out.println("length: "+new Long(clob.length()).intValue());
    clobString = clob.getSubString(1, new Long(clob.length()).intValue());
    } catch (SQLException e) {
    e.printStackTrace();
    return clobString;
    EXCEPTION IS:
    org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{? = call SHOW_REPORT.GETHTML(?, ?)}]; SQL state [null]; error code [17059]; Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]; nested exception is java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
    org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:969)
    org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
    org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
    org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
    org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
    at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
    at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    root cause
    java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
    oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:860)
    oracle.sql.ARRAY.toARRAY(ARRAY.java:209)
    oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7767)
    oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7448)
    oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7836)
    oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4586)
    org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
    org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
    org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:356)
    org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
    org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:127)
    org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:212)
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:947)
    org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
    org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
    org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
    org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
    at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
    at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    Please help!!
    Please help!!

    user8374822 wrote:
    PLSQL Function:
    function getHtml(pWhere VARCHAR2 DEFAULT NULL,
    pColSort HTP.STRINGARRAY) return clob is
    begin
    end getHtml;
    PLSQL TYPE: (in HTP package - self created - but could be anywhere else too)
    type STRINGARRAY is table of varchar2(256) index by binary_integer;
    JAVA DOA:
    new SqlParameter("pColSort", Types.ARRAY, "HTP.STRINGARRAY"),I don't know much (??) java and can't understand your error messages as they are not in english.
    But I have a feeling that the error is because either
    a) "Types.ARRAY" in Java world probably does not map to an index-by table in oracle or
    b) the array must be created as a SQL TYPE and not as a package variable or
    c) both of the above
    You may want to try following approaches
    1) Change the array type declaration to nested table i.e. use "type STRINGARRAY is table of varchar2(256)"
    2) If the above does not work, then create a sql type (using CREATE TYPE statement) to create STRINGARRAY as a SQL type of varchar2(256)
    Hope this helps.

  • How to call stored function in php

    hi
    i'm new in php
    how to to call a stored funtion in php without using the select query and
    i want to display the return value in php page...
    tx for advance...
    venkat

    Hi there,
    Could you clarify your question more clearly?
    I can't really get what you mean.
    You still need to write SQL even though you use PEAR DB library.
    Have a look at the DB package in
    http://pear.php.net
    Guess it would help
    Dn.
    Message was edited by:
    Dn.

  • Cannot call ANY stored functions from my Java program

    My problem is that I cannot call ANY stored procedure from my Java
    program. Here is the code for one of my stored procedures which runs
    very well in PL/SQL:
    PL/SQL code:
    CREATE OR REPLACE PACKAGE types AS
    TYPE cursorType IS REF CURSOR;
    END;
    CREATE OR REPLACE FUNCTION list_recs (id IN NUMBER)
    RETURN types.cursorType IS tracks_cursor types.cursorType;
    BEGIN
    OPEN tracks_cursor FOR
    SELECT * FROM accounts1
    WHERE id = row_number;
    RETURN tracks_cursor;
    END;
    variable c refcursor
    exec :c := list_recs(11)
    SQL> print c
    COLUMN1 A1 ROW_NUMBER
    rec_11 jacob 11
    rec_12 jacob 11
    rec_13 jacob 11
    rec_14 jacob 11
    rec_15 jacob 11
    Here is my Java code:
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    class list_recs
    public static void main(String args[]) throws SQLException,
    IOException
    String query;
    CallableStatement cstmt = null;
    ResultSet cursor;
    // input parameters for the stored function
    String user_name = "jacob";
    // user name and password
    String user = "jnikom";
    String pass = "jnikom";
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    try { Class.forName ("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException e)
    { System.out.println("Could not load driver"); }
    Connection conn =
    DriverManager.getConnection (
    "jdbc:oracle:thin:@10.52.0.25:1521:bosdev",user,pass);
    try
    String sql = "{ ? = call list_recs(?) }";
    cstmt = conn.prepareCall(sql);
    // Use OracleTypes.CURSOR as the OUT parameter type
    cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    String id = "11";
    cstmt.setInt(2, Integer.parseInt(id));
    // Execute the function and get the return object from the call
    cstmt.executeQuery();
    ResultSet rset = (ResultSet) cstmt.getObject(1);
    while (rset.next())
    System.out.print(rset.getString(1) + " ");
    System.out.print(rset.getString(2) + " ");
    System.out.println(rset.getString(3) + " ");
    catch (SQLException e)
    System.out.println("Could not call stored function");
    e.printStackTrace();
    return;
    finally
    cstmt.close();
    conn.close();
    System.out.println("Stored function was called");
    Here is how I run it, using Win2K and Oracle9 on Solaris:
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>java
    list_recs
    Could not call stored function
    java.sql.SQLException: ORA-00600: internal error code, arguments:
    [ttcgcshnd-1], [0], [], [], [], [], [], []
    at
    oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:889)
    at
    oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:490)
    at
    oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:2661)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4189)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4123)
    at
    oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:541)
    at list_recs.main(list_recs.java:42)
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>
    Any help is greatly appreciated,
    Jacob Nikom

    Thank you for your suggestion.
    I tried it, but got the same result. I think the difference in the syntax is due to the Oracle versus SQL92 standard
    conformance. Your statament is the Oracle version and mine is the SQL92. I think both statements are acceptable
    by the Oracle.
    Regards,
    Jacob Nikom

  • How to call a function name stored in a a variable

    I am trying to call a function in a stored procedure based on the contents of a variable returned from a select statement. I have tried using:
    funcCall := 'SELECT ' || BRName || ' INTO bOut FROM DUAL';
    EXECUTE immediate funcCall;
    where BRName is the name of the function in the package I want to call and bOut is the boolean reutn from the function. Am I way off base in doing this like this?
    I am getting an invalid identifier error. Any help would be appreciated.

      1  declare
      2  sql_string varchar2(2000);
      3  begin
      4  sql_string := 'select ' || func_name || ' into a from dual ';
      5  execute immediate sql_string;
      6* end;
    SQL> /
    sql_string := 'select ' || func_name || ' into a from dual ';
    ERROR at line 4:
    ORA-06550: line 4, column 28:
    PLS-00201: identifier 'FUNC_NAME' must be declared
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
      1  declare
      2  sql_string varchar2(2000);
      3  func_name varchar2(30);
      4  begin
      5  func_name := 'some_func';
      6  sql_string := 'select ' || func_name || ' into a from dual ';
      7  execute immediate sql_string;
      8* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00904: "SOME_FUNC": invalid identifier
    ORA-06512: at line 7
    SQL> desc some_func;
    ERROR:
    ORA-04043: object some_func does not exist
      1  create or replace function test_func
      2       return number
      3       is
      4       begin
      5          return 0;
      6*      end;
    SQL> /
    Function created.
      1  declare
      2  sql_string varchar2(2000);
      3  func_name varchar2(30);
      4  begin
      5  func_name := 'test_func';
      6  sql_string := 'select ' || func_name || ' into a from dual ';
      7  execute immediate sql_string;
      8* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00905: missing keyword
    ORA-06512: at line 7
    SQL> Set serveroutput on
      1   declare
      2   sql_string varchar2(2000);
      3   func_name varchar2(30);
      4   return_value number;
      5   begin
      6   func_name := 'test_func';
      7   sql_string := 'select ' || func_name || ' from dual ';
      8   execute immediate sql_string into return_value;
      9   dbms_output.put_line(return_value);
    10* end;
    SQL> /
    0
    PL/SQL procedure successfully completed.Hope that helps.
    Regards
    Raj

  • Without calling stored procedure or functions from database

    Hi,
    I am using Jdeveloper 11.1.1.5.0.
    =>How to do PL/SQL procedures and functions in ADF without calling stored procedure or function from DB?

    S, PL/SQL procedures and functions are done in Application Module class or in managed bean..By calling the stored procedures or functions from DB.
    But I am asking how to do if DB doesn't have any procedures,triggers and functions.

Maybe you are looking for

  • What is Part Number

    Hi All, What is Part number. When I print GR/GI slip, its appearing. From where systems picking this Part number. Regards, Sureshbabu G.

  • Finding used space in Oracle Cache

    Is there any way to find the size of the buffer cache used to perform a particular query. I want it in exact bytes/blocks. I doesnot mean the maximum buffer cache, but the used buffer cache?

  • Process chain activation :  0 c hains were selected

    Hi all I have scheduled process chains in production. Because one of the metachain is showing error while loading infopackage,in the production I have created a new infopackage and added it to the chian.Then activated the metachain. But when i was tr

  • *H*E*L*P* - I am UNABLE to change my Import settings on my iPod shuffle....

    Can anyone on the planet Help me with my problem?! My Import Settings state: On CD Insert-"Show CD" Import Using-"MP3 Encoder" Setting-"High Quality, 160 kbps". I would like to change these settings. Although, everytime I enter the Preferences foler

  • Word with Friends

    I loved this game so much that I paid the $.99 for the app and now I cannot get it to load to my IPad or IPhone,  It keeps tell me that it is loading and then just boots me out and flips back to the main screen.  Sometimes it tells me that the game s