How to return cursor from procedure to jdbc

plz help me through example of code as wl as procedure where.... return cursor from procedure to jdbc

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE procedure anil3 @count INT OUT,@opcode INT OUT,@total_tiff INT OUT
as
declare @query2 varchar(300),@tiff_count int,@query1 varchar(300)
set @query1='declare move_cursor   cursor forward_only static for
select count(opcode),opcode from TABLE1 group by opcode
open move_cursor'
exec(@query1)
fetch next  from move_cursor into @count,@opcode
set @opcode="'"+@opcode+"'"
set @total_tiff=0
while (@@fetch_status=0)
begin
     set @query2='declare move_cursor2  cursor static for '+
     ' select count(tiff) from TABLE2  where opcode='+@opcode+
       ' open move_cursor2 '
     exec(@query2)
     fetch next  from move_cursor2 into @tiff_count
     while (@@fetch_status=0)
     begin
          set @total_tiff=@total_tiff+@tiff_count
          fetch next  from move_cursor2 into @tiff_count
     end
     close move_cursor2
     deallocate move_cursor2
print  @total_tiff
print @count
print @opcode
fetch next  from move_cursor into @count,@opcode
end
close move_cursor
deallocate move_cursor
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO******************************************************************************
above this is sql server 2000 PL/SQL and i hv to get the value
print @total_tiff
print @count
print @opcode
through JDBC
plz help me out how to return Cursor to JDBC and HOW toPRINT THESE THREE VALUE @total_tiff, @count, @opcode through JDBC
get this values through JDBC

Similar Messages

  • How to get return type as Table of Index by BINAR from Procedure using JDBC

    Hi,
    We have stored procedure which takes Varchar as input and rerurn muiltiple recored of type Table of index by BINARY
    We created the procedure with in a package, its header part like below:
    CREATE OR REPLACE PACKAGE emp_pkid_pkg
    AS
    TYPE r_emp IS RECORD ( employe_profile_id NUMBER
    , client_profile_id VARCHAR2(240)
    , email VARCHAR2(240)
    , terms_acp VARCHAR2(1)
    TYPE tp_emp_profile IS TABLE OF r_emp INDEX BY BINARY_INTEGER;
    PROCEDURE er_employe_prov_profile ( e_inxid employe_provision_instance.inxid%TYPE
    , e_emp_recs OUT tp_emp_profile
    END emp_pkid_pkg;
    This procedure has body part, wich has origial business logic like below.
    CREATE OR REPLACE PACKAGE BODY emp_pkid_pkg
    AS
    PROCEDURE pr_customer_prov_profile ( e_inxid employe_provision_instance.inxid%TYPE
    , e_emp_recs OUT tp_customer_provision_profile
    IS
    CURSOR c_emp_prov_instance ( c_guid employe_provision_instance.guid%TYPE )
    etc ...
    END emp_pkid_pkg;
    We could execute the below script from oracle client tool and get the response.
    DECLARE
    e_cust emp_pkid_pkg.tp_emp_profile;
    BEGIN
    emp_pkid_pkg.er_employe_prov_profile ( 'ef45t6543y98'
    , e_cust
    FOR i in e_cust.FIRST..e_cust.LAST LOOP
    DBMS_OUTPUT.PUT_LINE ( e_cust(i).employe_profile_id
    ||'#'|| e_cust(i).client_customer_id
    ||'#'|| e_cust(i).email
    ||'#'|| e_cust(i).term_acp);
    END LOOP;
    END;
    We have requirement to get the results from procedure usind JDBC callable statement call.
    We have tried to call the procedure via JDBC callable statement but it didn't work.
    We have constructed it like the following. It was throwing error "java.sql.SQLException: invalid column type: emp_pkid_pkg.tp_emp_profile
    CallableStatement cs2 = con.prepareCall("{call emp_pkid_pkg.er_employe_prov_profile(?,?)}");
    cs2.registerOutParameter(2, OracleTypes.CURSOR, emp_pkid_pkg.tp_emp_profile);
    cs2.setString(1,empId);
    Not sure whether I am doing the logic correctly. But i tryed with diff type. Still am getting same error like above.
    Please point me to the correct approach.
    Thanks
    Edited by: 921689 on 18-Mar-2012 17:20

    >
    We have requirement to get the results from procedure usind JDBC callable statement call.
    >
    Can't be done - the reason has nothing to do with JDBC so you are in the wrong forum.
    Repost in the PL/SQL forum and I can give you an example of what you have to do
    PL/SQL
    First the TYPEs you defined are PL/SQL types so can't be referenced outside PL/SQL; you need to define SQL types.
    Second you will need to use a procedure that returns a REF CURSOR or is a PIPELINED procedure. Since your procedure doesn't fall into either category you can't use it with JDBC to do what you want.
    If your query was a PIPELINED function then you could simply query it like it was a table. I have a PIPELINED function name 'get_emp' so this works.
    select * from table(get_emp(30));Post in the PL/SQL forum and I can give you the code for the procedure. I'm not going to clutter up this forum with inappropriate material.

  • How return parameter ref Cursor from procedure using dynamic SQL?

    I sorry, but i very need help.
    I using Oracle 8.0.6
    I need to return parameter of type ref Cursor from procedure.
    create or replace package PlanExp is
    type cursortype is ref cursor;
    procedure ShowPlan (cursorparam out
    cursortype.............);
    end PlanExp;
    create or replace package body PlanExp is
    procedure ShowPlan (cursorparam out cursortype,
    .............) Is
    sql_str varchar2(1000);
    sql_str_select varchar2(100);
    sql_str_from varchar2(100);
    sql_str_where varchar2(500);
    Return_Code integer;
    Num_Rows integer;
    cur_id_sel integer;
    tSum_Plan DBMS_SQL.NUMBER_TABLE;
    tSum_Plan_Ch DBMS_SQL.NUMBER_TABLE;
    tSum_Plan_Day DBMS_SQL.NUMBER_TABLE;
    begin
    /* calculating string variables ........... /*
    sql_str := 'select ' || sql_str_select ||
    'from ' || sql_str_from ||
    'where ' || sql_str_where ||
    'group by ' || sql_str_select;
    cur_id_sel := dbms_sql.open_cursor;
    dbms_sql.parse(cur_id_sel, sql_str, dbms_sql.native);
    dbms_sql.define_array(cur_id_sel, 1, tSum_Plan, 20, 1);
    dbms_sql.define_array(cur_id_sel, 2, tSum_Plan_Ch, 20, 1);
    dbms_sql.define_array(cur_id_sel, 3, tSum_Plan_Day, 20, 1);
    Return_Code := dbms_sql.execute(cur_id_sel);
    delete from TEMP_SHOWPLAN;
    Loop
    Num_Rows := dbms_sql.Fetch_Rows(cur_id_sel);
    dbms_sql.column_value(cur_id_sel, 1, tSum_Plan);
    dbms_sql.column_value(cur_id_sel, 2, tSum_Plan_Ch);
    dbms_sql.column_value(cur_id_sel, 3, tSum_Plan_Day);
    if Num_Rows = 0 then
    exit;
    end if;
    Exit When Num_Rows < 20;
    End Loop;
    dbms_sql.close_cursor(cur_id_sel);
    end;
    end PlanExp;
    How return cursor (cursorparam) from 3 dbms_sql.column_value-s ?

    I am using Oracle 8.1.7, so I don't know if this will work in
    8.0.6 or not:
    SQL> CREATE TABLE test
      2    (col1                    NUMBER,
      3     col2                    NUMBER,
      4     col3                    NUMBER)
      5  /
    Table created.
    SQL> INSERT INTO test
      2  VALUES (1,1,1)
      3  /
    1 row created.
    SQL> INSERT INTO test
      2  VALUES (2,2,2)
      3  /
    1 row created.
    SQL> INSERT INTO test
      2  VALUES (3,3,3)
      3  /
    1 row created.
    SQL> CREATE TABLE temp_showplan
      2    (tSum_Plan               NUMBER,
      3     tSum_Plan_Ch            NUMBER,
      4     tSum_Plan_Day           NUMBER)
      5  /
    Table created.
    SQL> EDIT planexp
    CREATE OR REPLACE PACKAGE PlanExp
    IS
      TYPE CursorType IS REF CURSOR;
      PROCEDURE ShowPlan
        (cursorparam    IN OUT CursorType,
         sql_str_select IN     VARCHAR2,
         sql_str_from   IN     VARCHAR2,
         sql_str_where  IN     VARCHAR2);
    END PlanExp;
    CREATE OR REPLACE PACKAGE BODY PlanExp
    IS
      PROCEDURE ShowPlan
        (cursorparam    IN OUT CursorType,
         sql_str_select IN     VARCHAR2,
         sql_str_from   IN     VARCHAR2,
         sql_str_where  IN     VARCHAR2)
      IS
        sql_str                VARCHAR2 (1000);
        cur_id_sel             INTEGER;
        return_code            INTEGER;
      BEGIN
        DELETE FROM temp_showplan;
        sql_str := 'INSERT INTO   temp_showplan '
               || ' SELECT '   || sql_str_select
               || ' FROM '     || sql_str_from
               || ' WHERE '    || sql_str_where;
        cur_id_sel := DBMS_SQL.OPEN_CURSOR;
        DBMS_SQL.PARSE (cur_id_sel, sql_str, DBMS_SQL.NATIVE);
        return_code := DBMS_SQL.EXECUTE (cur_id_sel);
        DBMS_SQL.CLOSE_CURSOR (cur_id_sel);
        OPEN cursorparam FOR SELECT * FROM temp_showplan;
      END ShowPlan;
    END PlanExp;
    SQL> START planexp
    Package created.
    Package body created.
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC PlanExp.ShowPlan (:g_ref, 'col1, col2,
    col3', 'test', ' 1 = 1 ')
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    TSUM_PLAN TSUM_PLAN_CH TSUM_PLAN_DAY
             1            1             1
             2            2             2
             3            3             3

  • How to out Dynamic ref cursor from Procedure to Forms

    Hi
    I am trying to out Dynamic ref cursor from Procedure to Forms, But I am unable to do so. however cursor return the value within procedure but I am failed to capture the same in Forms
    Pl advice suggestion if any, Here I am attaching full procedure for reference
    CREATE PACKAGE winepkg
    IS
    TYPE wine IS RECORD ( mynumber number);
    /* Define the REF CURSOR type. */
    TYPE wine_type IS REF CURSOR RETURN wine;
    END winepkg;
    CREATE procedure find_wine
    (col1_in in number,
    c1 out winepkg.wine_type) as
    vsql varchar2(1000);
    cur sys_refcursor;
    x number;
    BEGIN
    vsql:='select bo_id from bo_details where bo_details.bo_id = '||col1_in ;
    open cur for vsql;
    c1:=cur;
    --fetch c1 into x;
    --dbms_output.put_line(x);
    END find_wine;
    In front end forms
    Declare
    TYPE F is REF CURSOR;
    CUR_F F;
    rec number;
    Begin
    break;
    find_wine( 1601480000011078,cur_f ) ;
    Loop
    fetch cur_f into rec ;
    Message(rec ) ;pause;
    exit when cur_f%notfound ;
    End loop ;
    exception
    when others then
    Message(sqlerrm) ;pause;
    End ;

    yo can use
    declare
    c_cursor EXEC_SQL.CursType;
    v_stmt varchar2(2000) = 'select a, b, c from mytab where cond1'; -- you can create this value dynamically
    begin
    c_cursor := Exec_SQL.Open_cursor;
    EXEC_SQL.PARSE(c_articulos, v_stmt);
    EXEC_SQL.DEFINE_COLUMN(c_articulos,1, v_colchar1, 30);
    EXEC_SQL.DEFINE_COLUMN(c_articulos,2, v_colchar2, 15);
    EXEC_SQL.DEFINE_COLUMN(c_articulos,3, v_colchar3, 30);
    v_exec := EXEC_SQL.EXECUTE(c_cursor);
    WHILE EXEC_SQL.FETCH_ROWS(c_cursor) > 0 LOOP
    EXEC_SQL.COLUMN_VALUE(c_cursor,1,v_colchar1);
    EXEC_SQL.COLUMN_VALUE(c_c_cursor,2,v_colchar2);
    EXEC_SQL.COLUMN_VALUE(c_c_cursor,3,v_colchar3);
    assign_values_to_block;
    END LOOP;
    EXEC_SQL.CLOSE_CURSOR(c_cursor);
    end;
    and WORKS IN FORMS 6

  • How to create data_block from procedure ?

    hi all
    can anyone to help me :
    how to create data_block from procedure ?
    i want to join 2 or 3 table and use order by
    then show some field in my form
    i can not use view because order by can not use in view
    please send sample code for this procedure
    thanks.

    1) >i can not use view because order by can not use in view
    SQL>create or replace view V_test as
      2  select * from (
      3  select 1 id from dual union
      4  select 2 id from dual union
      5  select 3 id from dual union
      6  select 4 id from dual union
      7  select 5 id from dual union
      8  select 6 id from dual ) t
      9  order by t.id
    10  /
    View created.
    SQL>select * from v_test;
            ID
             1
             2
             3
             4
             5
             6
    6 rows selected.2). >how to create data_block from procedure?
    You must create procedure and use ref cursor.

  • OCI8: returning cursors from stored procedures

    The short version of my question is:
    In OCI8, how do open a cursor from the database stored procedure, return it to my C++ program and fetch from it, given that in OCI8 cursors and cursor functions are becoming obsoleted?
    The long version of the same question is:
    I am converting my C++ code from the Oracle 7.3 OCI driver to the Oracle8 OCI driver. One thing I did very frequently in Oracle 7.3 OCI code is open a multi-row select cursor within a stored procedure and return that cursor to my program. In the program, I would then do the fetching with the returned cursor. This was very useful, as it allows me to change the queries in the stored procedure (for example, to append information to certain columns or make some data in all uppercase) without recompiling the application due to a changed SQL string.
    My 7.3 psuedocode is as follows:
    stored procedure def:
    TYPE refCurTyp IS REF CURSOR;
    FUNCTION LoadEmployeeData RETURN refCurTyp;
    stored procedure body:
    FUNCTION LoadEmployeeData RETURN refCurTyp IS
    aCur refCurTyp;
    BEGIN
    OPEN aCur FOR
    SELECT emp_id, emp_name
    FROM employee_table
    ORDER BY emp_name;
    return aCur;
    END;
    OCI code: // all functions are simplified, not actual parameter listing
    // declare main cursor variable #1 and return cursor variable #2
    Cda_Def m_CDAstmt, m_CDAfunction;
    // open both cursors
    oopen(m_CDAstmt, ...);
    oopen(m_CDAfunction, ...);
    // bind cursor variable to cursor #2
    oparse(&m_CDAstmt, "BEGIN :CUR := MYPACKAGE.LoadEmployeeData; END;");
    obindps(&m_CDAstmt, SQLT_CUR, ":CUR", &m_CDAfunction);
    // run cursor #1
    oexn(&m_CDAstmt);
    // bind variables from cursor #2, and fetch
    odefineps(&m_CDAfunction, 1, SQLT_INT, &m_iEmpId);
    odefineps(&m_CDAfunction, 2, SQLT_CHAR, &m_pEmpName);
    while (!ofen(&m_CDAfunction))
    // loop: do something with fetch
    // values placed in m_iEmpID and m_pEmpName
    This works perfectly, and has really helped to make my code more maintainable. Problem is, in Oracle 8 OCI both cursors and the cursor functions (such as oopen()) are becoming obsoleted. Now it uses statement and environment handles. I know I can still use Cda_Def and cursors--for a while--within OCI8, but I need to know the official up-to-date method of returning a cursor from the database and fetching within my C++ code. Any code fragment, or explanation of what I need to do in OCI8 would be appreciated (perhaps I need to bind to a statement handle instead? But the stored procedure still returns a cursor.)
    The Oracle8 OCI has a new SQLT_ type, SQLT_RSET, which the header file defines as "result set type". Unfortunately, it's almost completely undocumented in the official documentation. Am I supposed to use this instead of the obsolete SQLT_CUR?
    Thanks,
    Glen Mazza

    Email me diorectly and I will get you some code that might help. I fail to see the relevance of posting this type of information in the JDeveloper forum.

  • How get a cursor from a store procedure

    i have a package with a procedure like this
    PACKAGE PKG_TEST IS
    TYPE data_cursor IS REF CURSOR;
    PROCEDURE PRC_GET_DATA( VAR_ONE IN VARCHAR2, IO_CURSOR OUT data_cursor ) ;
    END ;
    PACKAGE BODY PKG_TEST IS
    PROCEDURE PRC_GET_DATA( VAR_ONE IN VARCHAR2, IO_CURSOR     OUT data_cursor ) IS
    MENSAJE VARCHAR2(1000);
    CURSOR_AUX DATA_CURSOR;
    ERR_NUM NUMBER;
    ERR_MSG VARCHAR2(100);
    BEGIN
         OPEN CURSOR_AUX FOR
         SELECT ATTRIB1, ATRIB2 FROM TABLE WHERE (CODITION);
    IO_CURSOR := CURSOR_AUX;
    END PRC_GET_DATA;
    END;
    and, i have some troubles to call from JSP page...
    the java Source is
    Connection conn = source.getConnection();
    Statment stmt = conn.createStatment();
    CallableStatment cs = conn.prepareCall( {CALL PKG_TEST.PRC_GET_DATA( '%') } );
    ResultSet rset = cs.executeQuery();
    Some can help me?....

    I would not know about JAVA call Syntax to Oracle procedure in the code you are showing, Also it is not
    the right place for that question. How ever, I can see that your PL/SQL code needs some fixing
    before it can compile and run, hence some simple demonstrationSQL> create or replace package test_pkg as
      2  TYPE data_cursor IS REF CURSOR;
      3  PROCEDURE PRC_GET_DATA( VAR_ONE IN VARCHAR2, IO_CURSOR OUT data_cursor);
      4  END;
      5  /
    Package created.
    -- Please note that you need to put your SQL for ref cursors in single quotes
    -- Also look at the passing the WHERE condition to the SQL
    SQL> create or replace package body test_pkg as
      2  PROCEDURE PRC_GET_DATA(VAR_ONE IN VARCHAR2, IO_CURSOR OUT data_cursor) IS
      3    l_cursor data_cursor;
      4  BEGIN
      5    OPEN l_cursor for ('SELECT empno, ename from my_emp WHERE '|| VAR_ONE);
      6    IO_CURSOR := l_cursor;
      7  END;
      8  END;
      9  /
    Package body created.
    -- Then simply use the returned REF CURSOR in any program, I am showing PL/SQL program here
    SQL> Declare
      2     myCur test_pkg.data_cursor;
      3     vEmpNum Number;
      4     vEname  Varchar2(20);
      5  Begin
      6     test_pkg.PRC_GET_DATA('Sal > 1000', myCur);
      7     Loop
      8       Fetch myCur into vEmpNum, vEname;
      9       Exit When myCur%NOTFOUND;
    10       dbms_output.put_line(vEmpNum || '  ' || vEname);
    11     End Loop;
    12     Close myCur;
    13  End;
    14  /
    7369  SMITH
    7499  ALLEN
    7521  WARD
    7566  JONES
    7654  MARTIN
    PL/SQL procedure successfully completed.Might not be exactly what you are looking for, but from Oracle Forum, this is what is relevant.
    Good luck,
    Sri

  • How to modify oracle stored procedure for JDBC Receiver Adapter?

    Hi all.
    This is Urgent.
    Scenario is
      SELECT a TABLE with procedure and update column with it,
      then send data to SAP System with RFC Adapter.
    When I executed a sync bpm, scenario was finished internal error.
    Pls, let me know how to correct procedure using JDBC Receiver Adapter?
    Regrds all.
    Procedure Code -
    SET SERVEROUTPUT ON
    CREATE OR REPLACE PROCEDURE zwtn2
    IS
       v_seller_company      wtnivhd.seller_company%TYPE;
       v_invoice_no      wtnivhd.invoice_no%TYPE;
       v_report_date     wtnivhd.report_date%TYPE;
       v_customs_date     wtnivhd.customs_date%TYPE;
       v_ap_post_date     wtnivhd.ap_post_date%TYPE;
       v_gr_date          wtnivhd.gr_date%TYPE;
    CURSOR l_cursor IS
       SELECT seller_company,
              invoice_no,
              report_date,
              customs_date,
              ap_post_date,
              gr_date
         FROM wtnivhd
        WHERE wtn_send_flag = 'N'
          AND rownum < 31
    FOR UPDATE;
    BEGIN
       OPEN l_cursor;
       LOOP
         FETCH l_cursor
          INTO v_seller_company,
               v_invoice_no,
               v_report_date,
               v_customs_date,
               v_ap_post_date,
               v_gr_date;
         EXIT WHEN l_cursor%NOTFOUND;
         UPDATE wtnivhd
            SET wtn_send_flag = 'Y' 
           WHERE CURRENT OF l_cursor;
       END LOOP;
    CLOSE l_cursor;
    END zwtn2;

    Hi Alex,
    plz have a look to Runtime Workbench / Adapter Monitoring to find an error message.
    Regards,
    Udo

  • Return Resultset from Procedure

    Hi --
    This may seem like a very elementary question, but can anyone tell me how to return a resultset from a function or procedure?
    Thanks,
    Christine

    if i understand your question correctly. a function return value is mandatory. while procedure is optional you had to use the out at the parameters. examples:
    CREATE OR REPLACE FUNCTION get_age (pBday Date) RETURN number IS
      vAge          Number := 0;
    BEGIN
      vAge := (Months_Between(sysdate,pBday) / 12);
      Return (vAge);
    END;
    CREATE OR REPLACE PROCEDURE get_age_procedure (pBday In Date, pAge Out Number) IS
    BEGIN
      pAge := (Months_Between(sysdate,pBday) / 12);
    END;
    /you need to create a reference cursor type object to achieve a result sets.
    CREATE OR REPLACE package TYPES AS
        TYPE cursorType IS REF CURSOR;
    END;

  • Returning resultset from procedure...or pkg

    I am a newbie to Oracle but am steeped in MSSQL. I am accustomed to using a procedure to execute and produce a result set as its output from various input parameters thus keeping query complexity and details as a part of the database tier.
    Is there a best practice in Oracle that provides this capability? Is the 'ref cursor' the correct container to hold the recordset data (usually combined from various base tables...counts and sums for reports etc) and how should it be returned to a calling application (web page) to be iterated through? Perhaps as an output parameter?
    Thank you for helping with such a basic problem.

    Yes you would use a ref cursor, though it does not hold the results anywhere, they are fetched as needed, which is why it scales well.
    Re: OPEN cursor for large query
    Re: cursor ,inner join
    You can return a ref cursor from a function or procedure, it would be no different in a package.
    SQL> create or replace function f (p_deptno in number)
      2  return sys_refcursor as
      3    c sys_refcursor;
      4  begin
      5    open c for
      6      select empno, ename, job, sal from emp
      7        where deptno = p_deptno;
      8    return c;
      9  end;
    10  /
    Function created.
    SQL> var c refcursor
    SQL> exec :c := f(10)
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          SAL
      7782 CLARK      MANAGER     2450
      7839 KING       PRESIDENT   5000
      7934 MILLER     CLERK       1300
    SQL> create or replace procedure p
      2    (p_deptno in number, p_c out sys_refcursor)
      3  as
      4  begin
      5    open p_c for
      6      select empno, ename, job, sal from emp
      7        where deptno = p_deptno;
      8  end;
      9  /
    Procedure created.
    SQL> exec p(30, :c)
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          SAL
      7499 ALLEN      SALESMAN    1600
      7521 WARD       SALESMAN    1250
      7654 MARTIN     SALESMAN    1250
      7698 BLAKE      MANAGER     2850
      7844 TURNER     SALESMAN    1500
      7900 JAMES      CLERK        950
    6 rows selected.
    SQL>There are examples how to reference them in other languages here, note this was pre-9i when the built in sys_refcursor type was provided.
    http://asktom.oracle.com/tkyte/ResultSets/index.html

  • How to return Values from Oracle Object Type to Java Class Object

    Hello,
    i have created an Oracle Object Types in the Database. Then i created Java classes with "jpub" of these types. Here is an example of the type.
    CREATE OR REPLACE TYPE person_type AS OBJECT
    ID NUMBER,
    vorname VARCHAR2(30),
    nachname VARCHAR2(30),
    geburtstag DATE,
    CONSTRUCTOR FUNCTION person_type RETURN SELF AS RESULT,
    CONSTRUCTOR FUNCTION person_type(p_id NUMBER) RETURN SELF AS RESULT,
    CONSTRUCTOR FUNCTION person_type(p_vorname VARCHAR2,
    p_nachname VARCHAR2,
    p_geburtstag DATE) RETURN SELF AS RESULT,
    MEMBER FUNCTION object_exists(p_id NUMBER) RETURN BOOLEAN,
    MEMBER PROCEDURE load_object(p_id NUMBER),
    MEMBER PROCEDURE save_object,
    MEMBER PROCEDURE insert_object,
    MEMBER PROCEDURE update_object,
    MEMBER PROCEDURE delete_object
    MEMBER PROCEDURE load_object(p_id NUMBER) IS
    BEGIN
    SELECT p.id, p.vorname, p.nachname, p.geburtstag
    INTO SELF.ID, SELF.vorname, self.nachname, SELF.geburtstag
    FROM person p
    WHERE p.id = p_id;
    END;
    My problem is, that if i use the member function "load_object" from my java app it doesnt return the selected values to the java class and i dont know why. I use the java class like this:
    PersonObjectType p = new PersonObjectType();
    p.load_object(4);
    There is a reocrd in the database with id = 4 and the function will execute successful. But if i try to use "p.getVorname()" i always get "NULL". Can someone tell me how to do that?
    Thanks a lot.
    Edited by: NTbc on 13.07.2010 15:36
    Edited by: NTbc on 13.07.2010 15:36

    CallableStatement =
    "DECLARE
    a person_type;
    BEGIN
    a.load_object(4);
    ? := a;
    END;"
    And register as an out parameter.
    Edited by: michael76 on 14.07.2010 05:01

  • How to move cursor from one textfield to another textfield byusing enterkey

    hii all,
    I have a problem in java script.
    To move cursor from one textbox to another text box ,I have take the length of the textboxes of the first column.I used onkeyDown event .
    in the function ,firest i checked the condition like
    for(i=0;i<form1.box.length;i++) //box is the name of the textboxes
    if(event.keyCode==13)
    form1.box[i+1].focus();
    return false;
    by using this the cursor is moving from first text box to secon textbox and stops.
    if i use event.returnValue=false; instead of return false ,then the cursor automatically going to the laxt textbox of the column.
    my problem is how i can focus the cursor from one textbox to another textbox one after the other till the end.
    if any one has solution please help me.
    also if we can do in another way also,please help me.
    thanx.>

    try the following code :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <SCRIPT language="Javascript">
    function fnTest(str)     {     
              if(event.keyCode==13)          {
                   if(str == 4)     {
                        formHeader.box[0].focus();
                   else     {
                        formHeader.box[parseInt(str)+1].focus();
                   return false;
    </SCRIPT>
    <BODY>
    <FORM name="formHeader">
    <CENTER>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('0');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('1');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('2');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('3');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('4');">
    </CENTER>
    </FORM>
    </BODY>
    </HTML>
    ----------------------------------------------

  • How to return rows from tmp table created inside function??

    Hi,
    I'm trying to return rows from a cursor or table (created within
    the function). How do I specify the return type?

    Hi,
    Here is the code that examples to create a function that can
    return data from table.This is achieved using REFCURSOR concept.
    Hope this helps you.I'm giving all stuff in single PL/SQL
    block.You can break it and create a package and declare
    refcursor type and function in that as well.
    DECLARE
    -- Declare generic cursor type
    TYPE gencur_type IS REF CURSOR ;
    -- Declare generic cursor varaible
    gencur gencur_type;
    -- Declare record type
    TYPE rec_type IS RECORD(descr emp.ename%type) ;
    -- Declare record type variable
    rec rec_type;
    --This how you declare a local function that returns gencrtype
    data set
    --This function is called in main block
    FUNCTION call_refcur return gencur_type
    AS
              rr gencur_type;
    BEGIN
         OPEN rr FOR SELECT descr FROM emp;
         RETURN rr;
    END;-- end of local function
    -- Main block begins here
    BEGIN
    -- Call the local function so that gencur will have
    -- the data set returned by select statement
    gencur:= call_refcur;
    -- Open a loop to test the stuff
    LOOP
         FETCH gencur INTO rec;
         EXIT WHEN gencur%NOTFOUND;
         null;
         dbms_output.put_line(rec.ename);
    END LOOP;
    END;
    Regards,
    Sridhar

  • Oracle forms 9i - How to return back from a block?

    Some one please help me
    In a trigger, I have a code says go_block. How to return from the block and back to the trigger to continue executing the codes below the go_block statement? Please see example below, I want to come back from block CHECK_STUFF and continue execute the statements
    :Name.option := '1';
    if :name.option = '1' then
    Example:
    Block: Name
    Item: yes_no - Key-next-item trigger
    declare
    begin
    go_block('check_stuff');
    go_item('answer');
    :Name.option := '1';
    if :name.option = '1' then
    Thanks - Patty

    The code behind the GO_BLOCK is executed immediately after the GO_BLOCK, it doesn't stop at that point. So you have to split your code, like
    declare
    begin
    go_block('check_stuff');Then, create a procedure like
    PROCEDURE PR_RETURN_FROM_BLOCK IS
    BEGIN
    go_item('answer');
    :Name.option := '1';
    if :name.option = '1' then
    END;Then, when returning from the block (in whatever trigger you use), just call that procedure.

  • How to return fault from Async BPEL

    Hi,
    I have ESB that has input,output and fault, This ESB calls Async BPEL that takes only input. Now i want to return fault from BPEL to ESB. How do i do it?
    Please help.

    Hi,
    My use case is i am implementing AIA. So my enterprise layer is ESB and my ABCS provider is BPEL. As provider takes lot of time to complete the instance, to avoid timeout issue i just created Async BPEL with two ports one for input another for fault. I am able to send back my fault back to this call back port. But how i can receive the fault to the same ESB which called the BPEL?
    I am not able to implement it. I can not go for any workaround like creating one more BPEL and then make it as sync, put pick activity and receive the fault then send back to ESB.
    Thats the reason i am very specific. If you find some solution please let me know.

Maybe you are looking for