View Poll Results: Java ORacle Store Procedure

Voters
0. You may not vote on this poll
  • HTML

    0 0%
  • JAVA

    0 0%
  • Smillies

    0 0%
  • IMG

    0 0%
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    5

    Unhappy Unanswered: Java Oracle Store Procedur In parameter

    Hy, does somebody know how to pass a in parameter of type record in oracle to store procedure from java

    this is the type in the oracle db

    type RPrueba is record (
    p1 varchar(2)
    , p2 varchar(2)
    );

    and this is the store procedure in oracle

    procedure pruebaRecord( rec IN RPrueba);
    thnk you very much

  2. #2
    Join Date
    Sep 2002
    Location
    Austria
    Posts
    37

    Re: Java Oracle Store Procedur In parameter

    hi, am not absolutely sure what you do want to achieve, in particular since you posted your question under "JAVA procedure", but the types are pl/sql.

    have a look at the working example.

    you have to define TYPES inside a package and then make fully qualified references to these types.

    (in my example pkg_test.PRueba ...)

    create or replace package pkg_test is

    type RPrueba is record (
    p1 varchar(2),
    p2 varchar(2)
    );

    procedure pruebaRecord( rec IN pkg_test.RPrueba);

    end pkg_test;
    /
    show errors;



    create or replace package body pkg_test is

    procedure pruebaRecord( rec IN pkg_test.RPrueba) is
    begin
    dbms_output.put_line('First Value in record = ' || rec.p1);
    dbms_output.put_line('second Value in record = ' || rec.p2);
    end pruebaRecord;

    end pkg_test;
    /
    show errors;



    create or replace procedure mytest is
    vr pkg_test.RPrueba;
    begin
    vr.p1 := 'R';
    vr.p2 := 'P';
    pkg_test.pruebaRecord (vr); -- invoke procedure in PACKAGE now
    end mytest;
    /
    show errors;

    set serveroutput on size 10000
    execute mytest;


    SQL> execute mytest;
    First Value in record = R
    second Value in record = P

  3. #3
    Join Date
    Aug 2003
    Posts
    5

    Re: Java Oracle Store Procedur In parameter

    hi, thank you for your answer, wath i want to do is, to pas a record to an store procedure from JAVA like this


    String pn= "{call pk_test.pruebaProcedure(? )}";

    OracleCallableStatement ocs = (OracleCallableStatement)conn.prepareCall(pn);

    ocs.setXXX(1, aRecord)

    this is an examples, but in realy thre is a lot of params of a procedure in my job, so i want to pass all in an structure like a record of Oracale, but i cant find the way to represent this in java

    I hop to by more clear this time, and sorry about my inglish
    Thank you very mutch


    Originally posted by pre4711
    hi, am not absolutely sure what you do want to achieve, in particular since you posted your question under "JAVA procedure", but the types are pl/sql.

    have a look at the working example.

    you have to define TYPES inside a package and then make fully qualified references to these types.

    (in my example pkg_test.PRueba ...)

    create or replace package pkg_test is

    type RPrueba is record (
    p1 varchar(2),
    p2 varchar(2)
    );

    procedure pruebaRecord( rec IN pkg_test.RPrueba);

    end pkg_test;
    /
    show errors;



    create or replace package body pkg_test is

    procedure pruebaRecord( rec IN pkg_test.RPrueba) is
    begin
    dbms_output.put_line('First Value in record = ' || rec.p1);
    dbms_output.put_line('second Value in record = ' || rec.p2);
    end pruebaRecord;

    end pkg_test;
    /
    show errors;



    create or replace procedure mytest is
    vr pkg_test.RPrueba;
    begin
    vr.p1 := 'R';
    vr.p2 := 'P';
    pkg_test.pruebaRecord (vr); -- invoke procedure in PACKAGE now
    end mytest;
    /
    show errors;

    set serveroutput on size 10000
    execute mytest;


    SQL> execute mytest;
    First Value in record = R
    second Value in record = P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •