Calling Hana Store Procedure thorugh Eclipse link

Hi,
Anybody having idea of calling HANA store procedure through Eclipse Link JPA.
Procedure has Scalar IN Parameter and Table Type as OUT Param:
CREATE PROCEDURE tree_view (IN  topicid BIGINT,OUT qtree tt_tree)
    LANGUAGE SQLSCRIPT
    READS SQL DATA AS  
BEGIN
/// SQL Statements
END;
Currently i an calling the procedure as
entiyManager.getTransaction().begin();
            java.sql.Connection connection = entiyManager.unwrap(java.sql.Connection.class);
            connection.setAutoCommit(false);
            CallableStatement cst = connection.prepareCall("call _SYS_BIC.\"workspace.procedures/tree_view\"(?,?)");
            cst.setLong(1, identifier);
            cst.execute();
            ResultSet rs =  cst.getResultSet();
     entiyManager.getTransaction().commit();
But need more cleaned way like using StoreProcedureQuery or PLSQLStoredProcedureCall.

Slightly missed the point.
The question was about providing an INPUT variable.
An in fact it is not possible to call a procedure with an table type input variable from the SQL console.
You have to build a wrapper to call such a procedure:
create type myusers as table (user_name nvarchar(60));
create procedure count_users (IN user_tab myusers, OUT user_count bigint )
language sqlscript
as
begin
    select count(*) into user_count from :user_tab;
end;
call count_users (? , ?)
Could not execute 'call count_users (? , ?)' .
SAP DBTech JDBC: [7]: feature not supported:
Parameterized input table parameter is not allowed: line 1 col 19 (at pos 18)
A wrapper for this could look like this:
create procedure call_cu (out user_count bigint)
language sqlscript
as
begin
    v_users = select user_name from users;
    call count_users (:v_users, :user_count);
end;
call call_cu (?)
--> 28
Unlike SQL*Plus for PL/SQL, the SQL console of SAP HANA is not a SQL Script runtime shell.
- Lars

Similar Messages

  • Oracle JBDC error while calling the store procedure

    HI All,
    I am get one strange error while calling a store procedure which has two parameter in and out.
    I am pass the correct XML file which reaches the RDB and then PI receives a exception error message saying:
    oracle.rdb.jdbc.common.RdbException: Closed Resultset
    where as no error log is availble in RBD for the same.
    Can anybody tell me what can be the cause of the error.
    Let me know if you requires more information on this.
    -adi

    Hi Kiran,
    Thanks..
    But I am not able to understand you. I am calling a store procedure not a table. and we not doing anything in the store procedure except return one constant value in Out parameter.
    -Adi

  • How to call a Store Procedure with IN PARAMETER

    Hi, im new using Oracle 10G with Oracle SQL Developer, my cuestion is how to call a Store Procedure with IN PARAMETER, I tried the following without results
    SELECT * FROM procedure_name(parameter);
    PROCEDURE procedure_name(parameter);
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);
    Please help me....

    Hi,
    As Beijing said,
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);work for me.
    So does
    BEGIN
        procedure_name(parameter);
    END;Can you be more specific about what you're doing? That is, are you testing it in SQL Developer? Where are you entering the commands? Where are you looking for output? Do you get error messages? Does anything else (like "SELECT SYSDATE FROM dual;") work?

  • Calling Oracle store procedure from Crystal 11 command

    I need to call Oracle store procedure from Crystal Command. The Store proc has ref cursor. Is it possible. Can you post few examples?
    Also, is it possible to have multiple sql statements in a Crystal Command, when working with Oracle 10g?
    It is working for SQL server.

    Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly.

  • Calling ORACLE Store Procedure with parameters in user define function

    Hi everybody,
    We have a scenario connecting Oracle DB thru JDBC adapter.
    We have to call store procedure with input parameter and output parameter to retrieve data from DB. The implementation was made using JDBC adapter by building the correct XML message with EXECUTE action, and it works fine.
    Now we need to use DB lookup within mapping. I wrote users define function with SELECT statement (using the JDBC adapter) and it works fine but I need to call store procedure in ORACLE instead of SELECT statement.
    I found lot of examples concerning DB lookup but none of them explained how to write UDF calling store procedure in ORACLE with input and output parameters.
    I am looking for an example.
    Thanks in advance,
    Gigi

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • About call the store procedure using VB with ODBC

    I want to ask how can I use the vb with ODBC call the oracle's store procedure ? I try to pass the parameter from vb and return 1 result, it is ok, but when I try to pass 1 parameter with return mutiple result (put it in recordset), the error message occured(Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available, No work was done) why ?? I can success whit using OLE DB, but why not in ODBC ?? does anybody can help me ?? Thanks a lot.

    oh, really ? it is not use ODBC to connecto to oracle ?
    Here is my program code:
    STORE PROCEDURE:
    PROCEDURE getInforcePolicy(PClient_ID IN VARCHAR2, PPolicy_No IN VARCHAR2, BasicCur OUT oraoledb.m_refcur, RiderCur OUT oraoledb.m_refcur)
    IS
    BEGIN
    OPEN BasicCur FOR SELECT * FROM
    inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No = 1;
    OPEN RiderCur FOR SELECT * FROM
    inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No <> 1;
    END getInforcePolicy;
    PACKAGE oraoledb AS
    TYPE m_refcur IS REF CURSOR;
    END oraoledb;
    Program:
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim rs2 As New ADODB.Recordset
    Dim cmd As New ADODB.Command
    Dim paramclient As New ADODB.Parameter
    Dim parampolicy As New ADODB.Parameter
    Dim I As Integer
    cn.Open "ridev", "abc","abc"
    cmd.ActiveConnection = cn
    Set paramclient = cmd.CreateParameter("PClient", adVarChar, adParamInput, 10)
    Set parampolicy = cmd.CreateParameter("PPolicy", adVarChar, adParamInput, 10)
    paramclient.Value = "0000023011"
    parampolicy.Value = "HK0010021U"
    cmd.Parameters.Append paramclient
    cmd.Parameters.Append parampolicy
    cmd.CommandText = "{call getInforcePolicy}"
    Set rs = cmd.Execute
    Do While Not rs.EOF
    Loop
    Set rs2 = rs.NextRecordset
    Do While Not rs2.EOF
    loop
    Where the RIDEV is a datasource that created from Data Source in Control Panel using the driver call "Microsoft ODBC for ORACLE"

  • How to call a store procedure

    Hi there,
    I'm very new to this jdeveloper for bpel and I would like to know how do you call a stored procedure with parameters.
    I've been using dbadapters to insert and update database with a transform function but I don't know if you need to do transformation do a stored procedure.

    Hi,
    have you read:
    http://download-east.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/adptr_db.htm#CHDFBBCD

  • Remote call to a procedure over DB Link - Datatype mismatch

    Hi All,
    I've a procedure taking an array as input parameter. I invoked this procedure from other DB using a DB link but got DATATYPE mismatch error. I've given same name to the array type in both the DBs and used the same UID.
    Please help me out.
    Regards,
    MK
    CREATE OR REPLACE TYPE type_market_places IS table OF VARCHAR2 (100);
    CREATE OR REPLACE PROCEDURE racsf_populate_site (p_in_mrktplaces type_market_places)
    IS
       --lv_sql   VARCHAR2 (32000);
    BEGIN
    END;
    ------Invoking the procedure from the other DB using DB link
    DECLARE
      P_IN_MRKTPLACES type_market_places;
    BEGIN
      select col1 bulk collect into P_IN_MRKTPLACES;
      RACSF_POPULATE_SITE@DB_link ( P_IN_MRKTPLACES );
      COMMIT;
    END;

    You call DATA TYPE from DB_link datatype
    try this, please
    DECLARE
      P_IN_MRKTPLACES type_market_places@DB_link;
    BEGIN
      select col1 bulk collect into P_IN_MRKTPLACES;
      RACSF_POPULATE_SITE@DB_link ( P_IN_MRKTPLACES );
      COMMIT;
    END;

  • How to call HANA SQLScript procedures

    Hello,
        I am currently learning SAP HANA. I have a problem creating my own procedure. I want to create a procedure that generates a unique random string, but until there, I started with something simple (and stupid). I have a database called ETD. Here is my code:
    CREATE PROCEDURE GEN_STRING(IN INVAL VARCHAR(30), OUT RETURNVAL VARCHAR(32))
    LANGUAGE SQLSCRIPT
       AS
       INVAL VARCHAR(30);
    BEGIN
    RETURNVAL := INVAL + 'aa';
    END;
    This procedure just takes a parameter and appends 'aa' to it. But when I call the procedure in SQLConsole:
    CALL "ETD"."GEN_STRING"(INVAL => 'HAHAHA',RETURNVAL => ? );
    The returned value is '?'. NormallyI know from the OpenSAP course that for the output parameters, we have to put '?'. What am I doing wrong? Thank you in advance,
    Andrei
    Message was edited by: Tom Flanagan

    Hello Andrei,
    Using "+" is not going to concatenate the strings in HANA, you have to use the "CONCAT" function.
    Regards,
    Krishna

  • Calling a remote procedure with db link - SQL Plus hangs

    I am trying to call a procedure from a remote database with a db link, within a local procedure. The purpose of the calling the procedure is to get the server time from that database. When I try to compile this procedure on the local database SQL Plus hangs without giving any error message, I have to close SQL Plus. Below are my two procedures:
    Local procedure:
    CREATE OR REPLACE PROCEDURE get_server_time(p_remotetime IN OUT VARCHAR2)
    IS
    /*Grabs the system time from remote database .
    l_remotetime varchar2(16) ;
    BEGIN
    get_remote_time(l_remotetime);
    p_remotetime := l_remotetime;
    END ;
    Remote procedure:
    CREATE OR REPLACE PROCEDURE get_remote_time(p_remotetime in out VARCHAR2)
    IS
    /* Grabs the system time from remote database and returns it to the
    calling proc.
    l_remotetime varchar2(16) ;
    BEGIN
    SELECT to_char(sysdate,'YYYYMMDDHH24MISS')
    INTO l_remotetime
    FROM dual ;
    p_remotetime := l_remotetime ;
    END ;
    I personaly do not see anything unusall with the two procedures, but cant figure out what is making SQL*Plus hang.
    Any help would be much appreciated.
    Thanks In Advance

    Hello
    Are you able to run the procedure connected to the livetolocal database directly? It looks as if you either have a missing table or the permisions for the user associated with the database link are not sufficient.
    As for calling the procedure, it would probably be more managable if you created a public synonym for it to hide the actual location. That way if you want to change the name of the DB link, or where it points to, no-one has to change their code, you just have to change the synonym.
    HTH
    David

  • Date Format Question - calling a store procedure from java side

    What is the best approach to handle a DATE as an IN parameter to a procedure?
    1) emp table has a column called hire_date and its data type is DATE;
    2) the procedure tried to retrieve all employees hired on a specific date, so there will be an IN parameter called p_hire_date, what data type should it use? Something like p_hire_date          IN     emp.HIRE_Date%TYPE? <== is this correct?
    3) so inside the procedure body, when retrieving the record,
    SELECT first_name, last_name
    FROM EMP
    Where hire_date = p_hire_date <==is this correct? or when do I use to_date()?
    4) On the Java side, when calling this procedure, what data type should the hire_date use?
    Thanks,
    new2Oracle

    new2Oracle wrote:
    it seems our java team passed the hire_date as a string, so in this case, i should make the following change
    1) p_hire_date IN varchar2
    2) in the SELECT statement, it will be like
    select fname, lname
    from emp
    where hire_date = to_date(p_hire_date, 'MM/DD/YYYY') <== the hire date is stored in the table as 1/1/2005
    Would the change above work?
    Thanks,Yes it would , but:
    if it was 01/03 is this jan 3rd, or mar 1st
    Bets way is to pass in to parameters
    p_hire_date=>1/1/2005
    p_date_format=>'mm/dd/yyyy';
    then your code can say in initialisation section
    v_hire_date varchar2(30)  := to_date(p_hire-date,p_date_format);and no more conversions in your code.
    select fname, lname
    from emp
    where hire_date = v_hire_date;Much clearer this way, I think.

  • How to call Java Store Procedure?

    Hi Everybody,
    I had created a java class call FileReader and inside tht class it has two method
    fileCount and fileName. fileCount is to locate the specified directory and count number of file and directory are in that directory and return back to the pl/sql and fileName is to return the filename for a specified directory. I also created a Oracle Package to call this call and the code for the java class and package listed below.
    CREATE OR REPLACE PACKAGE "CIS2"."PK_FILE_READER" AS
    FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER;
    FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2;
    END PK_FILE_READER;
    CREATE OR REPLACE PACKAGE BODY "CIS2"."PK_FILE_READER" AS
    FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER
    AS LANGUAGE JAVA NAME 'FileReader.fileCount(java.lang.String) return int';
    FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2
    AS LANGUAGE JAVA NAME 'FileReader.fileName(java.lang.String, int) return java.lang.String';
    END PK_FILE_READER;
    Class : FileReader
    import java.io.*;
    public class FileReader
    public static int fileCount(String dir)
    int recount;
    File path = new File(dir);
    File[] FileList = path.listFiles();
    recount = FileList.length;
    return recount;
    } // end method fileCount
    public static String fileName(String dir, int pos)
    String filename;
    File path = new File(dir);
    File[] FileList = path.listFiles();
    filename = FileList[pos].getAbsolutePath();
    return filename;
    } // end method fileName
    } // end of class FileReader
    The package created successful and the Java complite okey
    The only problem is when I try to use the loadjava it give me the oracle error ora-29545
    badly formed class
    I am not sure what is the problem? Did I create the java problem for FileReader is incorrect? or I don't know how to use the loadjava function.
    I did check the user_object and I did see there is a object name for FileReader but is invalid.
    Can anyone could tell me what is the problem and how to fix it??
    Thanks you so much

    The good news is, there's nothing wrong with your code:
    SQL> SET  serveroutput ON SIZE 1000000
    SQL> SET  lines 1000
    SQL> SET  pages 100
    SQL>
    SQL> exec dbms_java.set_output(2000)
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    SQL> CREATE AND COMPILE JAVA SOURCE NAMED "FileReader" AS
      2  import java.io.*;
      3 
      4  public class FileReader
      5  {
      6  public static int fileCount(String dir)
      7  {
      8  int recount;
      9 
    10  File path = new File(dir);
    11  File[] FileList = path.listFiles();
    12 
    13  recount = FileList.length;
    14 
    15  return recount;
    16  } // end method fileCount
    17 
    18  public static String fileName(String dir, int pos)
    19  {
    20  String filename;
    21 
    22  File path = new File(dir);
    23  File[] FileList = path.listFiles();
    24 
    25  filename = FileList[pos].getAbsolutePath();
    26 
    27  return filename;
    28  } // end method fileName
    29 
    30  } // end of class FileReader
    31  ;
    32  /
    Java created.
    SQL> SELECT owner, object_type, status, dbms_java.longname(object_name) class, created, last_ddl_tim
    e
      2  FROM   all_objects
      3  WHERE  substr(object_type,1,4)='JAVA'
      4  AND    dbms_java.longname(object_name) LIKE '%FileReaderp%'
      5  /
    no rows selected
    SQL> SELECT owner, object_type, status, dbms_java.longname(object_name) class, created, last_ddl_tim
    e
      2  FROM   all_objects
      3  WHERE  substr(object_type,1,4)='JAVA'
      4  AND    dbms_java.longname(object_name) = '%FileReader%'
      5  /
    OWNER                         OBJECT_TYPE        STATUS
    CLASS
    CREATED   LAST_DDL_
    APC                            JAVA CLASS         VALID
    FileReader
    28-FEB-06 28-FEB-06
    APC                            JAVA SOURCE        VALID
    FileReader
    28-FEB-06 28-FEB-06
    8 rows selected.
    SQL> CREATE OR REPLACE PACKAGE  "PK_FILE_READER" AS
      2 
      3  FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER;
      4 
      5  FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2;
      6 
      7  END PK_FILE_READER;
      8  /
    Package created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE BODY "PK_FILE_READER"  AS
      2 
      3  FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER
      4  AS LANGUAGE JAVA NAME 'FileReader.fileCount(java.lang.String) return int';
      5 
      6  FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2
      7  AS LANGUAGE JAVA NAME 'FileReader.fileName(java.lang.String, int) return java.lang.String';
      8 
      9  END PK_FILE_READER;
    10  /
    Package body created.
    SQL>
    SQL> var n number
    SQL> exec :n := PK_FILE_READER.F_GET_FILE_COUNT('C:\temp')
    PL/SQL procedure successfully completed.
    SQL> print n
             N
           295
    SQL> So this is obviously a configuration issue.
    Cheers, APC

  • How to call Java Store Procedure Part III

    Hi APC
    Everything is working now but when I exce this line
    exec :n := PK_FILE_READER.F_GET_FILE_COUNT('C:\')
    It did give me a number of file count but the problem was the C:\ dir is from
    the server side not from the local PC C Drive.
    My question is there a way you can point to your local drive? or your network drive? to get the file count
    thanks
    david

    You would either need to have some component that runs on the client machine (i.e. an application you deploy on the client either directly or through something like an ActiveX control/ Java applet on a web site) or your client file system would have to be mounted and accessible to the server at the file system level.
    In other words, not easily.
    Justin

  • Store procedure call to fetch data in JDBC sender adapter

    Hi guys,
    I have to fetch data from a Oracle server through JDBC adpater.
    the partner has in place some store procedure that have to be used with this purpose.
    But al the time I try to call a store procedure I got error that variables are not binded.
    I fill up the query sql statement field with following text
    call <store procedure name> (v1 OUT VARCHAR2, v2 in varchar2)
    Does anyone know the syntax to access such store procedure within jdbc adapter?
    As far as I know the jdbc call the store procedure with Callable statement but the paremeters need to be linked to datatype,but here I do not see such possibility.

    HI
    A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database data dictionary.
    Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures and all applications call the procedures only.
    Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the CALL statement
    Stored procedures can return result sets, i.e. the results of a SELECT statement. Such result sets can be processed using cursors by other stored procedures by associating a result set locator, or by applications. Stored procedures may also contain declared variables for processing data and cursors that allow it to loop through multiple rows in a table. The standard Structured Query Language provides IF, WHILE, LOOP, REPEAT, CASE statements, and more. Stored procedures can receive variables, return results or modify variables and return them, depending on how and where the variable is declared.
    http://help.sap.com/saphelp_nw04/helpdata/en/1d/756b3c0d592c7fe10000000a11405a/content.htm
    One of the usage is to prevent the query to directly write to the database
    http://en.wikipedia.org/wiki/Stored_procedure
    Check these:
    http://help.sap.com/saphelp_nw04s/helpdata/en/b0/676b3c255b1475e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/frameset.htm
    Integration with Databases made easy – Part 1.
    JDBC Stored Procedures
    http://help.sap.com/saphelp_nw04/helpdata/en/45/023c41325fa831e10000000a1550b0/frameset.htm
    Calling stored procs in MaxDb using SAP Xi
    cheers

  • Call MS SqlServer store procedure

    Hi all,
    Is there a way to call SqlServer store procedure in BC4J?
    I looked at other questions/answers from this forum but they all related to Oracle. My store procedures were built from multi-tables.
    thanks in advance

    I'm not very familiar with SQL*Server, but if you can do it from a JDBC PreparedStatement or CallableStatement, you can do it from within BC4J for sure.

Maybe you are looking for

  • Creative Cloud stopped working...on Windows 8

    Creative Cloud has stopped working on my Windows 8 laptop. As of last week the CC app was working perfectly. Yesterday I opened the app and nothing appeared in the apps area. All I get is a CC app window and the options under the dropdown menu at the

  • How do I upgrade to In Design CC?

    I have gone to several web siyes and don't find a way to download InDesign CC.Can anyone help?

  • Background

    what is the detailed step-to-step procedure for back ground job scheduling in abap.can any body post the detailed procedure.

  • Oracle 9.2.0.1.0 AIX(5.3)

    Hi, I want to download oracle base patch 9.2.0.1.0 for AIX (5.3) Please provide me link to download Regards

  • ICE Differential package upload - object deletion

    I am having an issue with uploading a differential package into another KM repository. As I understand, a differential package will download the data necessary for an incremental update, i.e. any renamed, new or deleted objects will be updated in the