Can Stored procedure with IN and OUT Paramter can be used in JDBC LOOKUP?

can Stored procedure with IN and OUT Paramter can be used in JDBC LOOKUP?

Checking online help, I do not see any possibility.
"Queries a data base by the given SQL statement."
http://help.sap.com/javadocs/pi/pi711sp03/com/sap/aii/mapping/lookup/DataBaseAccessor.html
-> execute

Similar Messages

  • Stored procedure with IN and OUT parameter

    HI all,
    here is code example
    declare
             in_dt date  := '1-feb-2010' ;
    col1 ...;
    col2 ...;
    col3 ...;       
    begin
      select e.*
      into col1,
            col2,
            col3
      from table_xyz e
      where e.start_dt  = in_dt;
    end;
    How do i convert the above code into stored procedure by accepting "in_dt" as IN parameter and getting the result set displayed (output) through OUT parameter say "cur_out" (OUT paramter)
    Thank you so much !!! I really appriciate it !!

    i ran my procedure which is very similar syndra posted
    create or replace procedure foo(p_dt in date, cv out sys_refcursor) as
    begin
    open cv for
    select e.*
    from table_xyz e
    where start_dt = p_dt;
    end;
    /Here is how is executed
    DECLARE
      P_DT DATE;
      CV SYS_REFCURSOR;
    BEGIN
      P_DT := '10-oct-2005';
      -- CV := NULL;  Modify the code to initialize this parameter
      scott.foo ( P_DT, CV );
      COMMIT;
    END;           
    -- i get PL/SQL procedure successfully complted , But i dont see the result set Or output
    - How do i see the output when i m using refcursor ?? i tried using print , but nothing didnt work
    - Any idea ??
    Thank you!!
    Edited by: user642297 on Jun 24, 2010 1:35 PM

  • Please help - Can not use stored procedure with CTE and temp table in OLEDB source

    Hi,
       I am going to create a simple package. It has OLEDB source , a Derived transformation and a OLEDB Target database.
    Now, for the OLEDB Source, I have a stored procedure with CTE and there are many temp tables inside it. When I give like EXEC <Procedure name> then I am getting the error like ''The metadata  could not be determined because statement with CTE.......uses
    temp table. 
    Please help me how to resolve this ?

    you write to the temp tables that get created at the time the procedure runs I guess
    Instead do it a staged approach, run Execute SQL to populate them, then pull the data using the source.
    You must set retainsameconnection to TRUE to be able to use the temp tables
    Arthur My Blog

  • Calling a stored procedure with RAW and SYS_REFCURSOR

    How do you call a stored procedure with the following input and output parameters?
    create or replace PROCEDURE test
    v_col1 IN NUMBER DEFAULT NULL ,
    v_col2 IN VARCHAR2 DEFAULT NULL ,
    v_col3 IN RAW DEFAULT NULL ,
    v_vol4 IN DATE DEFAULT NULL,
    cv_1 IN OUT SYS_REFCURSOR
    OPEN cv_1 FOR
    SELECT
    lv_tmp1 aaaa ,
    lv_tmp2 bbbb,
    lv_tmp3 cccc
    FROM DUAL ;
    END;
    Edited by: 925963 on Apr 6, 2012 10:50 AM

    Did you try just declaring the vars?
    untested
    declare
      myCur SYS_REFCURSOR;
      myRaw RAW(4);
      BEGIN
        test (0, 0, myRaw, sysdate, myCur);
      END;

  • Stored procedure with cursor as out parameter

    Can any one help me by showing how to write a procedure with cursor as out parameter and caputuring it in java using jdbc.
    Thanks in advance,
    shravan bharadwaj

    I know that in the SQLJ distribution (which is also downloadable) there is an example in the demo directory called RefCursDemo that shows the SQL code and how to call it - albeit from SQLJ and not JDBC. There may also be a demo in the JDBC distribution, though I am not sure about that.

  • With JDBC, calling a stored procedure with ARRAY as out parameter

    Hi,
    I want to use the data type ARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    The problem it's i use a 8.1.7 client to acces with oci to a 7.1.3 Database.
    With this configuration I can get back a Cursor but not an Array.
    Does it's possible ?
    Thanks for your help !
    Michakl

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Calling stored procedure with struct and boolean parameter

    Hi all,
    I am trying to write an EJB method using eclipselink that has to call a stored procedure which has the following parameters:
    - an object type (in/out)
    - a date (in)
    - another date (in)
    - a boolean (optional, in)
    - a number (out)
    - a string (out)
    When using StoredProcedureCall, I succeed in passing the dates and the object type (as a STRUCT) into the procedure and read out the output variables. I can also do this using NamedStoredProcedureCall and only map the number and string in a result class. Drawbacks of NamedStoredProcedureCall:
    - I cannot map the object type that comes back out (working example, anyone?)
    - I cannot specify the boolean input variable
    The problem is when I want to specify the boolean. In StoredProcedureCall, this is not possible since this only accepts native JDBC parameters. So I tried our PLSQLStoredProcedureCall.
    Here, I can specify all in/out parameters except the object type! No matter what I try, I seem to end up with ORA-3115 - unsupported network datatype or representation. Does anyone have a working example on how to use this?
    Regards,
    Jeroen van Veldhuizen
    REDORA B.V.

    The problem is not that I want to pass in a boolean. When I try to use PLSQLStoredProcedure, I do not succeed in passing in/out an object type (or STRUCT). It looks like the code has been made to access PLSQL record and table types by wrapping them in an object type, but it seems not to be possible to to use an object type directly.
    To start with: when you create a STRUCT parameter, the generated sql code is this:
    DECLARE
      l_param_in STRUCT := :1;and since struct is not a datatype, this fails.
    Jeroen

  • How to use Stored Procedures with SQLServer2005 and WAS 6.x

    Hi All
    I've got a problem, during the call to a StoredProcedure in SQLServer i've get the next message:
        Exception : com.microsoft.sqlserver.jdbc.SQLServerException: Fetch size cannot be negative
    The stored procedure is working correctly if I run my process out of WAS 6.x but if I get a connection from the pool the process don't work.
    Help please, thanks.

    Your procedure has a single OUT parameter ... and yet it appears you are trying to stuff something into it ... that is never going to work. Additionally everything else about your stored procedure would have gotten you a FAIL grade were you been in my beginning PL/SQL class.
    The syntax, a cursor loop, is obsolete and has been for more than 10 years.
    The formatting and use of case makes even the few lines written hard to read.
    And either no commit ever takes place or you are trying to do incremental commits in origseq: Both of which are bad practice.
    This code should use BULK COLLECT to collect all relevant records into an array and then pass the array to origseq ... no loops ... and end with a commit.
    Demo here: http://www.morganslibrary.org/reference/array_processing.html

  • Calling a stored procedure with VARRAY as out parameter using JDBC

    Hi,
    I want to use the data type VARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    I'm using Oracle 8.1.5 for Windows NT.
    Please help me.
    Thanks
    Sumanta
    null

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Calling a Stored Procedure with a IN OUT VAR

    Hi
    I'm trying to call an oracle stored procedure and get a return code if it completely ran successfully. This is my first time doing this and would really appreciate some
    PROCEDURE P_NP_OVERDUE_COMPLETED
    (P_YEAR_NO IN NUMBER, P_WEEK_NO IN NUMBER,
    P_RETURN_CODE IN OUT VARCHAR2)
    I get the following error: One or more errors occurred during processing of command.
    Dim OleDBCon As New OleDbConnection
    Dim conStr As String = "Provider=MSDAORA;Data...................."
    OleDBCon.ConnectionString = conStr
    Dim OleDBCMD = New OleDbCommand _
    ("{call p_np_overdue_completed(?,?,{VARCHAR2(255), P_RETURN_CODE})}", OleDBCon)
    OleDBCMD.CommandType = CommandType.Text
    OleDBCMD.Parameters.Add("P_YEAR_NO", OleDbType.Numeric).Value = year
    OleDBCMD.Parameters.Add("P_WEEK_NO", OleDbType.Numeric).Value = i
    Dim myadapter As New OleDbDataAdapter(OleDBCMD)
    OleDBCon.Open()
    myadapter.Fill(ds)

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Create procedure with IN and  OUT, what is IN+OUT?

    Hi.
    from docs:
    IN
    Specify IN to indicate that you must supply a value for the argument when calling the procedure.
    OUT
    Specify OUT to indicate that the procedure passes a value for this argument back to its calling environment after execution.
    IN OUT
    Specify IN OUT to indicate that you must supply a value for the argument when calling the procedure and that the procedure passes a value back to its calling environment after execution.
    As I understand like in oop IN - passing parameter by value, out-by reference. But IN OUT? d:/

    Gets passed in with one value, comes out with another.
    create or replace procedure calcarea (x in out number)
    as
    begin
    x:=x*x;
    end;
    create or replace procedure output (oneside in number)
    as
    myinput number;
    area number;
    begin
    myinput := oneside;
    calcarea(myinput);
    dbms_output.put_line('The area in sq units is '||myinput);
    end;
    set serveroutput on
    exec output(5);Note how the area is passed out via the same parameter.

  • Procedure with IN and OUT date parameters

    Hello Guys,
    could you please tell me where i am doing wrong, i want to get or return the date from the below procedure. It is throwing below error when i try to execute it, appreciate your help.
    Execute Statement:
    exec get_nxt_trd_dt('09/03/2010')
    Error Message:
    PLS-00306: wrong number or types of arguments in call to 'GET_NXT_TRD_DT'
    Procedure Body:
    CREATE OR REPLACE PROCEDURE GET_NXT_TRD_DT
    (INPUT_DT IN DATE,OUTPUT_DT OUT DATE) IS
    BEGIN
    SELECT MIN(DATES) INTO OUTPUT_DT FROM (SELECT DISTINCT DATES FROM (
    SELECT * FROM
    SELECT TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'yyyymmdd'),'Y')+ROWNUM -1 DATES FROM
    SELECT 1
    FROM Dual
    GROUP BY CUBE (2, 2, 2, 2, 2, 2, 2, 2, 2)
    WHERE ROWNUM <= ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y'),24) - TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y')
    WHERE TO_CHAR( DATES, 'DY') NOT IN ('SAT','SUN')
    MINUS
    SELECT DISTINCT HOLIDAY_DATE FROM HOLIDAY )
    WHERE DATES BETWEEN TO_DATE('08/01/2010','MM/DD/YYYY') AND TO_DATE('09/30/2010','MM/DD/YYYY')
    WHERE DATES > TO_DATE(INPUT_DT,'MM/DD/YYYY');
    END;

    That worked thank you. Could you please help on the below, how to execute the same plsql block defined as function?? Thank you.
    Execute stmts used:
    (1)
    DECLARE
    DT DATE;
    BEGIN
    GET_NXT_TRD_DT(TO_DATE('09/03/2010','MM/DD/YYYY'),DT);
    END;
    Error Message: PLS-00221: 'GET_NXT_TRD_DT' is not a procedure or is undefined
    (2)
    DECLARE
    BEGIN
    GET_NXT_TRD_DT(TO_DATE('09/03/2010','MM/DD/YYYY'));
    END;
    Error Message: PLS-00306: wrong number or types of arguments in call to 'GET_NXT_TRD_DT'
    Function Body:
    CREATE OR REPLACE FUNCTION GET_NXT_TRD_DT
    (INPUT_DT IN DATE,OUTPUT_DT OUT DATE) RETURN DATE IS
    BEGIN
    SELECT MIN(DATES) INTO OUTPUT_DT FROM (SELECT DISTINCT DATES FROM (
    SELECT * FROM
    SELECT TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'yyyymmdd'),'Y')+ROWNUM -1 DATES FROM
    SELECT 1
    FROM Dual
    GROUP BY CUBE (2, 2, 2, 2, 2, 2, 2, 2, 2)
    WHERE ROWNUM <= ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y'),24) - TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y')
    WHERE TO_CHAR( DATES, 'DY') NOT IN ('SAT','SUN')
    MINUS
    SELECT DISTINCT HOLIDAY_DATE FROM HOLIDAY )
    WHERE DATES BETWEEN TO_DATE('08/01/2010','MM/DD/YYYY') AND TO_DATE('09/30/2010','MM/DD/YYYY')
    WHERE DATES > INPUT_DT;
    RETURN(OUTPUT_DT);
    END;
    /

  • Executing a Procedure with IN and OUT parameters

    How do I call/execute the following procedure? When I call as Courses(StartDate,EndDate,nCount,State,LastUpdate);
    I get an error:
    Error(92,45): PLS-00363: expression 'nCount' cannot be used as an assignment target
    Error(92,55): PLS-00363: expression 'State' cannot be used as an assignment target
    PROCEDURE  Courses
       StartDate       IN             VARCHAR2
    ,  EndDate        IN             VARCHAR2
    ,  nCount           IN OUT   VARCHAR2
    ,  State               IN OUT   CHAR
    ,  LastUpdate   IN             DATE

    set serverout on
    declare
       l_StartDate    VARCHAR2(100) := '20130101';  -- why are you using varchar? use a date! you WILL regret using a string eventually
       l_EndDate      VARCHAR2(100) := '20140101';
       l_Count        VARCHAR2(100);   -- string, again? why? isn't a count a number?
       l_State        VARCHAR2(100);
       l_LastUpdate   DATE     :=  sysdate;
    begin
       Courses ( l_StartDate, l_EndDate, l_Count, l_State, l_LastUPdate );
       dbms_output.put_line ( 'Count: ' || l_Count );
       dbms_output.put_line ( 'State: ' || l_State );
    end;

  • Call stored procedure(with parameters) via odbc

    In my application I like to use the below statement to call a stored procedure with parameter and return a result set.
    {CALL PP.getPerson('daniel')}
    but this will just return errors to my application.
    If I change the statement to:
    {CALL PP.getPerson(?')}
    and bind a parameter and its value, it will work.
    My question is, is it possible to call a stored procedure via ODBC without binding parameters in application? I mean, what will be my SQL equivalent if I don't want to do parameter binding in my application?
    Thanks in advance. I appreciate any help :-)

    hi 
    Please see the e.g bellow
    create proc proc_test(@SchoolNumber int,@SchoolName
    varchar(100),@StudentNumber int, @StudnentName
    varchar(100)output ,
    @StudentAddress varchar(100) output,
    @Studentbirthdate datetime output,
    @StudentPhoneNumber varchar(100) output,
    @GuardianName varchar(100) output)
    as
    begin
    select @StudnentName varchar=StudnentName ,
    @StudentAddress =StudentAddress,
    @Studentbirthdate =Studentbirthdate ,
    @StudentPhoneNumber =StudentPhoneNumber,
    @GuardianName =GuardianName
    from table where schoolno=@SchoolNumber
    and SchoolName=@SchoolName
    and StudentNumber=@StudentNumber
    return
    end
    http://technet.microsoft.com/en-us/library/ms187004(v=sql.105).aspx
    http://www.lynda.com/SQL-Server-tutorials/Using-input-output-parameters/104964/113058-4.html
    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

  • Call stored procedure with OUT parameter

    Hello,
    I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
    The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
    Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
    Has someone been able to call a stored procedure with an OUT parameter?
    Regards,
    Nico

    Object is Foundation, Execute Script
    This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.*;
    PreparedStatement stmt = null;
    Connection conn = null;
    ResultSet rs = null;
    try {
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
    conn = ds.getConnection();
    stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
    stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
    rs = stmt.executeQuery();
    rs.next();
    patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
    } finally {
    try {
    rs.close();
    } catch (Exception rse) {}
    try {
    stmt.close();
    } catch (Exception sse) {}
    try {
    conn.close();
    } catch (Exception cse) {}

Maybe you are looking for

  • E.mail aliasses don't work...

    I'm having a problem with my e.mail accounts / alliases (not with my default main account, but with the extra ones I've created) I know the address is active; I can for example send myself an e.mail TO this address. I just can't send FROM, as I am al

  • JNI UnsatisfiedLinkError in Weblogic 5.1.0 SP 8

    I am running Weblogic 5.1.0 with service pack 8 on solaris. We are using a web application called ecare. Servlets are under:myserver/ecare/web-inf/classes/servletsThe JavaBean that uses JNI to connect to the C code is under:myserver/ecare/web-inf/cla

  • Wireless Home 3.0 no longer works on my ipad & iph...

    BT Infinity has been pretty much flawless since I got it about a year ago. However suddenly over the last 2 days, my wireless devices are no longer loading pages/video consistently. (Ipad & Iphone) I've run speedtest & it seems that sometimes the pin

  • Why my openscript program runs in disorder?

    Recently I encoutered such errors several times. My masterdrive script call 001a script first, and then the 002a script. But when I playback, I find out that it shows 001a is running in the masterdrive's tree view, but in fact the executed scripts ar

  • I am trying to update Itunes - message is " Invalid signature - download removed'  any ideas

    I am trying to update Itunes - message received is " Invalid signature - download  removed"  Wassup doc ???