Problem with OUT parameter

Hi,
I have a stored procedure which has an OUT param which returns the following user defined
type.
--Create a type
CREATE OR REPLACE TYPE USER_TYPE
AS object
     CODE VARCHAR2(2),
     NAME VARCHAR2(5),
DEFINE CLOB
Iam calling the stored proc in java and i used the
pstmt = con.prepareCall("{ call USER_TYPE_PKG.CHECKTYPE(name=>?,type=>?)}");
pstmt.setString(1,userId);
pstmt.registerOutParameter(2,Types.*STRUCT*); ---> What type should i use here. Iam getting error for this.
and also how do i get the values of CODE,NAME and DEFINE inside the type in java.
Thanks.

If you are using TopLink, you can map the Struct to a Java class using an ObjectRelationalDataTypeDescriptor. Then you can use a StoredProcedureCall obejct to pass the Java object to/from the database and TopLink will handle the JDBC and Struct conversion for you.
For direct JDBC, when you register a Struct OUT paramater you must pass the Types.Struct as well as the OBJECT TYPE name.
pstmt.registerOutParameter(2,Types.STRUCT, "USER_TYPE");
James : http://www.eclipselink.org

Similar Messages

  • Execute procedure with out parameter in sql*plus

    HI All,
    I am executing an stored proc with OUT parameter from sql*plus.
    Getting this error message:
    SQL> execute sp1_cr_ln_num('01',0,3);
    BEGIN sp1_cr_ln_num('01',0,3); END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to
    'sp1_cr_ln_num'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Whereas it works fine using Toad. 4th parameter is for output.
    Thanks.

    then you can see the value either using print :var or execute dbms_output.put_line(:var)

  • HT5137 I made a purchase with my debit card on The Simpson Tapped out game, And now my game won't open. It just kicks me out every time I click on it. How do I fix this problem with out deleting my app?

    I made a purchase with my debit card on The Simpson Tapped out game, And now my game won't open. It just kicks me out every time I click on it. How do I fix this problem with out deleting my app?

    Personally, I would never use a debit card online, for security reasons.  If your card gets hacked its your money that is stolen.  At least with a credit card it is the card providers money that is stolen.
    Anyway,  I would delete the app and re-install.  If you paid for the app in the first place you will be able to re-install free of charge.  Also, the app should allow the in-app purchase to happen again as it should recognise that you have already purchased it previously.
    Finally, it might be that the 3G doesnt have as much ram as more recent models of iphone and you may have applications running in the background that are preventing the app to function with the in-app purchase unless you shut down any apps eating all you memory that are running in the background.  Shut-down these apps (and the simpson tap out app) by exiting to your home screen and double-tapping the home button to show what apps are running in the background.  press and hold any of the open apps until it starts shaking.  close all the apps down.  exit then re-launch the app.
    good luck.

  • Procedure with out parameter in if-then-else condition

    Hi,
    I want to fetch the out parameter of a procedure inside another procedure that has if-then-else condition.
    <<Proc1_start>>
    if ..
    then <<proc2_>> --- with out parameter
    end if;
    <<proc1_end>>
    How to do this...
    Thanks.

    Ummm, the same way you would do it anywhere else?
    Declare variable in proc1 to hold the output of proc2 and then call proc2.
    John

  • How to write a shell script to execute a procedure with out parameter

    Hi,
    How to write a shell script to execute a procedure with out parameter.
    here is my procedure
    PROCEDURE sample(invar1 VARCHAR2,
    invar2 VARCHAR2,
    invar3 VARCHAR2,
    invar4 VARCHAR2,
    ecode out number);
    Any example really helpfull
    Thanks in advance

    Or if we're passing values in, maybe something like:
    Test procedure:
    CREATE OR REPLACE PROCEDURE p (myin IN VARCHAR2, myout OUT VARCHAR2)
    AS
    BEGIN
        myout :=
            CASE myin
                WHEN 'A' THEN 'APPLE'
                WHEN 'B' THEN 'BANANA'
                ELSE 'STARFRUIT'
            END;
    END;Shell script:
    #!/bin/bash
    my_shell_variable=$1
    unset ORACLE_PATH
    sqlplus -s un/pw@db <<-EOF
    set feedback off pause off
    set pagesize 0
    set autoprint off
    VAR out varchar2(30)
    VAR myin varchar2(30)
    exec :myin := '${my_shell_variable}'
    BEGIN
      p(:myin, :out);
    END;
    print out
    exit
    EOFTest:
    /Users/williamr: xx A
    APPLE
    /Users/williamr: xx B
    BANANA
    /Users/williamr: xx
    STARFRUITObviously in a real script you would not hardcode the password or let it show in a "ps" listing.
    Message was edited by:
    William Robertson

  • Problem with out going mail. I can send from my iPad but not my MacBook Air yet settings are the same.

    Problem with out going mail. I can send from my iPad but not my MacBook Air, yet settings are the same. Can anyone advise?

    Hi sointoit,
    If you are having issues sending mail from your MacBook Air, you may find the following article helpful:
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/kb/TS3276
    Cheers,
    - Brenden

  • Error while calling a stored procedure with OUT parameter.

    Hi,
    I am trying to call a Stored Procedure(SP) with an OUT parameter(Ref Cursor) from a third party tool. It is called using OLE-DB Data provider. In one database the procedure works fine but when I change the database the procedure call is giving following error.
    Distribution Object:     COM Error. COM Source: OraOLEDB. COM Error message: IDispatch error #3092. COM Description: ORA-06550: line 1, column 7:
         PLS-00306: wrong number or types of arguments in call to 'TEST1'
         ORA-06550: line 1, column 7:
         PL/SQL: Statement ignored.
    I am not able to find as to why is this happening. Please let me know any clues /help to solve this problem.
    Thanks in advance.

    If you're using Oracle Provider for OLE DB (OraOLEDB) to execute this stored procedure, you need to set PLSQLRSet attribute. This attribute can be set in registry, connection string, or command object. Please refer to User Documentation for more information.

  • Execute immediate for stored procedure with out parameter

    Hi,
    I have problem with dynamically executing the statement hope anyone can help me.
    I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
    I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
    Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
    Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
    TABLE1_
    PROCESS_ID     PROC_NAME
    1      proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
    2     proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
    TABLE2_
    PROCESS_ID     PROC_PARMS
    1     100, 'test', :return
    2     200, :return1, :return2
    Thank You

    826957 wrote:
    Hi,
    I have problem with dynamically executing the statement hope anyone can help me.
    I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
    I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
    Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
    Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
    TABLE1_
    PROCESS_ID     PROC_NAME
    1      proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
    2     proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
    TABLE2_
    PROCESS_ID     PROC_PARMS
    1     100, 'test', :return
    2     200, :return1, :return2
    Thank YouSounds like an appalling design and a nightmare waiting to happen.
    Why not have your Java just call the correct procedures directly?
    Such design smells badly of an entity attribute value modelling style of coding. Notoriously slow, notoriously buggy, notoriously hard to maintain, notoriously hard to read. It really shouldn't be done like that.

  • Problem with GET PARAMETER in "O4K_LICENSE" Transaction

    Hi folks,
    I am facing a problem with the usage of "GET PARAMETER ID" in the transaction O4K_LICENSE (IS-oil).
    I have written a BDC which feeds in the License Type, External License type and a few other Mandatory fields to the Transaction, and on saving the transaction, SAP generates an "Internal License Number". This field has a Parameter ID "OIH", and I am using the command
    GET PARAMETER ID 'OIH' FIELD lw_licin.
    For the first pass of the loop, there is a value coming into lw_licin, but in the later loops this Value is not refreshing and the value which is coming into lw_licin is not changing. But the Database table OIHL is getting updated with the correct Internal License number values.
    So, my question is, is there anyway by which i can refresh the SAP Global Memory after every loop pass?
    Or, is there any way out to get the new generated values into lw_licin ?
    Thanks in advance,
    Vijay.

    Hi
    If you clear the parameter, you should transfer a blank value to it:
    DATA: NO_VALUE.
    SET PARAMETER ID <ID> FIELD NO_VALUE.
    Now the problem is this statament should be into loop and i think the transaction only does the GET PARAMETER.
    If transaction doesn't do the SET PARAMETER yuo can do anything.
    In your standard program there should be something like:
    LOOP...
    IF SY-TABIX > 1.
      SET PARAMETER ID <ID> FIELD NO_VALUE.
    ENDIF.
    ENDLOOP.
    but I think it's very hard there is a piece of code like that, and you can do nothing, because you can only set the parameter before calling the transaction (in bdc mode) and after calling the transaction but not while the transaction is working.
    You should change the standard program to do this.
    Max
    Message was edited by: max bianchi

  • About JDBC CALL STORE PROCEDURE with out parameter is greater than 4000

    Hi Guys,
    I have a problem call store procedure with a large string.
    as i know varchar2 can contain 32767 characters in pl/sql .
    But when i used varchar2 as a out parameter in a store procedure, if the out parameter is greater than 4000 characters , it always give me error message as 'the buffer is too small'.
    why it happened?
    I read some article that says i need configure a property in data-source.xml , and jdbc 10g driver already solved this problem, but i used jdev 10.1.3.2 ,the driver should be fine.
    How can i solve this problem?
    Thanks in advance,
    AppCat

    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) {}

  • Trouble with OUT parameter when creating a PL/SQL process on a HTML page

    I would like to call a stored procedure when creating process on a HTML page.
    I do know how to call the proc with the IN parameters,
    its the OUT parameter that I am having a problem with.
    ..basically getting "wrong number of arguments"
    ..the procedure parameters
    DELETECONFIG(p_configname IN,
    p_configtype IN,
    p_successmsg OUT)
    I have two items on the page for the
    configtype and configname..so my call when creating the process looks like this
    DELETECONFIG(P_CONFIGNAME => :CONFIGNAME_LIST,
    P_CONFIGTYPE => :CONFIGTYPE_LIST,
    not sure how to handle p_successmsg..
    thank you.

    thank you.
    This worked for me, where :P122_XDISPLAY is a display only text area withou a label.
    BEGIN
    DELETECONFIG(:P122_XCONFIGUSERID,
    :P122_XCONFIG_TYPE,
    :P122_XCONFIG_NAME,
    :P122_XDISPLAY);
    END;

  • Proble with out parameter

    Dear all i am facing a Problem in oracle 10 g while calling a procedure. this procedure has one 'IN' and three 'Out' parameter( one out parameter is refcursor)
    this procedure run successfully and has no complier error. but does not return any value
    but if i remove one out parameter ie (total two with one ref cursor )it works perfectly and returns value )
    so please any one can tell me is there any limit of using out parameter with ref cursor as out parameter

    Dear arun here is the code
    PROCEDURE Sp_Report_Manager(MODULEID IN VARCHAR,
    FROM_DATE IN DATE,
    TO_DATE IN DATE,
    P_ERROROCCURRED OUT NUMBER,
    COLUMN_NAMES OUT VARCHAR,
    REC_DEALDATA OUT Globrefcursor.gref)
    IS
    LV_SQL VARCHAR2(4000);
    LV_GRID_SQL VARCHAR2(4000);
    BEGIN
    p_debug('a','1');
    P_ERROROCCURRED:=0;
    p_debug('a','2');
    IF MODULEID IS NOT NULL THEN
    BEGIN
    p_debug('a','3');
    COLUMN_NAMES:='SELECTED,CPARTY,DEAL_ID,SCHEME,TRAN_TYPE,ASSET_TYPE,ASSET_GROUP,VALUE_DATE^Select,Deal ID,Scheme,Tran Type,Asset Type,Asset Group,Trade Date';
    LV_SQL := 'SELECT GRID_SQL FROM DEA_REPORT_MANAGER WHERE MODULE = :1';
    p_debug('a','4');
         EXECUTE IMMEDIATE LV_SQL INTO LV_GRID_SQL USING MODULEID;
         p_debug('a','5');
         LV_SQL := 'SELECT 0 SELECTED,CPARTY,DEAL_ID,SCHEME,TRAN_TYPE,ASSET_TYPE,ASSET_GROUP,VALUE_DATE FROM ( ';
         LV_SQL := LV_SQL || LV_GRID_SQL;
         LV_SQL := LV_SQL || ' ) WHERE DEAL_STATUS NOT IN (''DELETE'',''REJECT'') AND VALUE_DATE BETWEEN :1 AND :2 ORDER BY DEAL_ID';
    p_debug('a','6');
    OPEN REC_DEALDATA FOR LV_SQL USING FROM_DATE, TO_DATE;
    p_debug('a','7');
    RETURN;
    END;
    END IF;
    END Sp_Report_Manager;

  • Problem with out of memory and reservation of memory

    Hi,
    we are running a very simple java program on HP-UX that do some text substitution - replacing special characters with other characters.
    The files that are converted are sometimes very large, and now we have come to a point where the java server doing the work crashes with "Out of memory" message. (no stack) when it process one single 500MB large file.
    I have encountered this error before(with smaller files) and then I have made the maximum Heap larger, but now when I try to set it to 4000M
    i get the message:
    "Error occurred during initialization of VM
    Could not reserve enough space for old generation heap"
    When it crash with this message, my settings are:
    -XX:NewSize=500m -XX:MaxNewSize=1000m -XX:SurvivorRatio=
    8 -Xms1000m -Xmx4000m
    If I run with Xmx3000m instead the java program starts but I get Out of memory error like:
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    The GC log file created when it crashes looks like:
    <GC: -1 31.547669 1 218103808 32 219735744 0 419430400 0 945040 52428800 0 109051904 524288000 877008 877008 1048576 0.934021
    >
    <GC: -1 62.579563 2 436207616 32 218103808 0 419430400 945040 944592 52428800 109051904 327155712 524288000 877008 877008 1048
    576 2.517598 >
    <GC: 1 65.097909 1 436207616 32 0 0 419430400 944592 0 52428800 327155712 219048400 524288000 877008 877008 1048576 2.061976 >
    <GC: 1 67.160178 2 436207616 32 0 0 419430400 0 0 52428800 219048400 219048400 524288000 877008 877008 1048576 0.041408 >
    <GC: -1 128.133097 3 872415232 32 0 0 419430400 0 0 52428800 655256016 655256016 960495616 877008 877008 1048576 0.029950 >
    <GC: 1 128.163584 3 872415232 32 0 0 419430400 0 0 52428800 655256016 437152208 960495616 877008 877008 1048576 3.971305 >
    <GC: 1 132.135106 4 872415232 32 0 0 419430400 0 0 52428800 437152208 437152208 960495616 877008 876656 1048576 0.064635 >
    <GC: -1 256.378152 4 1744830464 32 0 0 419430400 0 0 52428800 1309567440 1309567440 1832910848 876656 876656 1048576 0.058970
    >
    <GC: 1 256.437652 5 1744830464 32 0 0 733282304 0 0 91619328 1309567440 873359824 1832910848 876656 876656 1048576 8.255321 >
    <GC: 1 264.693275 6 1744830464 32 0 0 733282304 0 0 91619328 873359824 873359824 1832910848 876656 876656 1048576 0.103764 >
    We are running:
    java version "1.3.1.02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1.02-011206-02:17)
    Java HotSpot(TM) Server VM (build 1.3.1 1.3.1.02-JPSE_1.3.1.02_20011206 PA2.0, mixed mode)
    We have 132GB of physical memory and a lot of not used Swap space, so I cant imagine we have a problem with that.
    Can anyone please suggest what to do proceed troubleshooting or to change some settings? I'm not into this Java really so I really need some help.
    Usually the java program handles thousands of smaller files (around 500 KB - 1 MB sized files).
    Thanks!

    You have a one to one mapping? Where one character is replaced with another?
    And all you do is read the file, replace and then write?
    Then there is no reason to have the entire file in memory.
    Other than that you need to determine if the VM (which is not a Sun VM) has an upper memory bound. That would be the limit that the VM will not go beyond regardless of memory in the system.
    We have 132GB of physical memory and a lot of not used Swap spaceOne would wonder why you have swap space at all.

  • Problem with Date Parameter

    Hi
    I am new to reporting services/report designer but have created a number of simple reports with Parameters using data from queries that have worked but I have a problem with this using Date and Time. 
    I am using MS Visual Studio 2008 (BIDS) and our SQL Server is Windows Server 2008 R2
    I need to allow the users of the report to choose a start date and an end date
    The Start Dates are held in a field called PhaseStartDate
    The End Dates are held in a field called PhaseEndDates
    I have tried multiple ways to try to get this to work with no success and with the latest attempt I get the message  
    "An error occurred during local report processing. The definition of the report 'JKVoidLoss' is invalid. The report parameter 'StartDate' has a default value or ValidValue that depends on the report parameter"Startdate". Forward dependancies
    are not valid"
    I will explain how I set up the Startdate. The EndDate is set up the same with the relevant values and fields.
    I created a new data source called StartDate. Under QUERY I have Select PhaseStartDate from QLHRA_VoidPhases. This runs okay when tested in Query designer and RUN.
    Under FIELDS I have Field name as PhaseStartDate and Field Source as PhaseStartdate
    Under PARAMETERS I have Parameter Name as PhaseStartDate and Parameter Value as [@StartDate]
    I set up a Parameter called StartDate with Data type as Date/Time
    Under Available Values I selected Get values from a query with Dataset being StartDate, Value field being PhaseStartdate and Label field being PhaseStartDate
    There are no Default Values
    I have tried moving the parameters up and down using the blue arrows under report data. I have tried multiple different methods to resolve this by changing values in the Properties screens.
    I also tried removing the DataSets and just using the Parameters with default settings. in preview, this ran the report but no matter what dates where entered the output was always the same.
    Any assistance will be greatly appreciated as I have spent hours on this so far
    Regards
    John

    Hi
    I am new to reporting services/report designer but have created a number of simple reports with Parameters using data from queries that have worked but I have a problem with this using Date and Time. 
    I am using MS Visual Studio 2008 (BIDS) and our SQL Server is Windows Server 2008 R2
    I need to allow the users of the report to choose a start date and an end date
    The Start Dates are held in a field called PhaseStartDate
    The End Dates are held in a field called PhaseEndDates
    I have tried multiple ways to try to get this to work with no success and with the latest attempt I get the message  
    "An error occurred during local report processing. The definition of the report 'JKVoidLoss' is invalid. The report parameter 'StartDate' has a default value or ValidValue that depends on the report parameter"Startdate". Forward dependancies are not valid"
    I will explain how I set up the Startdate. The EndDate is set up the same with the relevant values and fields.
    I created a new data source called StartDate. Under QUERY I have Select PhaseStartDate from QLHRA_VoidPhases. This runs okay when tested in Query designer and RUN.
    Under FIELDS I have Field name as PhaseStartDate and Field Source as PhaseStartdate
    Under PARAMETERS I have Parameter Name as PhaseStartDate and Parameter Value as [@StartDate]
    I set up a Parameter called StartDate with Data type as Date/Time
    Under Available Values I selected Get values from a query with Dataset being StartDate, Value field being PhaseStartdate and Label field being PhaseStartDate
    There are no Default Values
    I have tried moving the parameters up and down using the blue arrows under report data. I have tried multiple different methods to resolve this by changing values in the Properties screens.
    I also tried removing the DataSets and just using the Parameters with default settings. in preview, this ran the report but no matter what dates where entered the output was always the same.
    Any assistance will be greatly appreciated as I have spent hours on this so far
    Regards
    John
    As I understand what you need to do is to just remove parameter from the dataset query for populating the date values and then it should work fine
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Calling a procedure from Oracle Forms with OUT parameter

    HI,
    Can anyone tell me in detail how to call a procedure with OUT parameters from Oracle Forms 6i ?
    Thanks in advance.

    Hello,
    Just provide the out parameter in the call:
    Declare
      amount   number; -- OUT number argument populated by the procedure
    Begin
      -- call the X procedure --
      x( amount ) ;
    End;Francois

Maybe you are looking for