SQL toolkit 2.2 Stored Procedure Memory Leaks

Hi
we are using CVI 2012 and SQL Toolkit 2.2. My db is "MySql 5.5.28" and I use "MySQL Connector/ODBC 5.2(w)"
I use only stored procedure (with and without the output parameters).  If I call continuously a stored procedure,
with Sql toolkit code, I have memory leaks!! 
My code (without error handler) is:
// iDbConnId is the handle of DBConnect() called when program starts
iStmt = DBPrepareSQL(iDbConnId, "spGetPrData");
DBSetStatementAttribute(iStmt, ATTR_DB_STMT_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
DBExecutePreparedSQL(iStmt);
DBBindColLongLong(iStmt, 1, &llPrId, &lStatus1);
DBBindColInt(iStmt, 2, &iIpPort, &lStatus2);
while(DBFetchNext(iStmt) != DB_EOF)
    //get data
DBClosePreparedSQL(iStmt);
DBDiscardSQLStatement(iStmt);
If I call the same stored procedure by sql code ("CALL spProcedure()")
I don't have memory leaks!!
The code is (without error handler):
// iDbConnId is the handle of DBConnect() called when program starts
iStmt = DBActivateSQL(iDbConnId, "CALL spGetPrData();");
DBBindColLongLong(iStmt, 1, &llPrId, &lStatus1);
DBBindColInt(iStmt, 2, &iIpPort, &lStatus2);
while(DBFetchNext(iStmt) != DB_EOF)
    //get data
DBDeactivateSQL (iStmt)
It seems to me that the DBDeactivateSQL function free the memory correctly,
while the functions DBClosePreparedSQL and DBDiscardSQLStatement do not release properly the memory,
(or I use improperly the library functions!!!)
I also have a question to ask:
Can I open and close the connection every time I connect to the database or is it mandatory to open and close it just one time?
How can I check the status of the database connection, if is mandatory to open and close the db connection just one time?
Thanks for your help.
Best Regards
Patrizio

Hi,
one of the functions "DBClosePreparedSQL and DBDiscardSQLStatement" is a known problem. In fact, there is a CAR (Corrective Action Request 91490) reporting the problem. What version of the toolkit are you using?
About this function you refer to the manual:
http://digital.ni.com/manuals.nsf/websearch/D3DF4019471D3A9386256B3C006CDC78
Where functions are described. To avoid memory leaks DBDeactivateSQL must be used. DBDeactivateSQL is equivalent to calling DBCloseSQLStatement, then DBDiscardSQLStatement. DBDeativateSQL will work at all for parameterized SQL, as well.
Regarding the connection mode advice to you is to open the connection once and close it at the end of your operations. What do you mean with "state of the database connection"? Remember that if you have connection problems or something goes wrong, the errors appears in any point in your code where you query the database. Bye
Mario

Similar Messages

  • Execute SQL Task, OLE DB, Stored Procedure, Returns unexpected value upon second run

    when debugging SSIS, the "Execute SQL Task" runs a stored procedure and returns the expected value. When running the package a second time, the task returns an unexpected value. When running in VS2012 SQL editor, everything operates as expected.
    Please help me debug how to get the stored proc to return the same value every time the SSIS Package is run. thanks!
    Here is the sequence of events and what happens....
    Look for a Positor that matches the Application, Host, and User
    No matching PositorId is found, Creates new Positor row, returns that new PositorId
    Use PositorId to upload some data (Every thing works)
    re-run/debug the ssis pacakge
    Look for a Positor that matches the Application, Host, and User 
    <No clue what is happening>
    Returns -1 (SHOULD BE the same PositorId value returned in #2)
    "Execute SQL Task" Setup: No edits to Result Set nor Expressions
    "Execute SQL Task" Setup: GENERAL
    "Execute SQL Task" Setup: PARAMETER MAPPING
    SP called by "Execute SQL Task"
    CREATE PROCEDURE [posit].[Return_PositorId]
    AS
    BEGIN
    DECLARE @PositorId INT = [posit].[Get_PositorId]();
    IF (@PositorId IS NULL)
    BEGIN
    DECLARE @ProcedureDesc NVARCHAR(257) = OBJECT_SCHEMA_NAME(@@PROCID) + N'.' + OBJECT_NAME(@@PROCID);
    DECLARE @PositorNote NVARCHAR(348) = N'Automatically created by: ' + @ProcedureDesc;
    EXECUTE @PositorId = [posit].[Insert_Positor] @PositorNote;
    END;
    RETURN @PositorId;
    END;
    Supporting SQL Objects:
    CREATE FUNCTION [posit].[Get_PositorId]
    RETURNS INT
    AS
    BEGIN
    DECLARE @PositorId INT = NULL;
    SELECT TOP 1
    @PositorId = [p].[PO_PositorId]
    FROM [posit].[PO_Positor] [p]
    WHERE [p].[PO_PositorApp] = APP_NAME()
    AND [p].[PO_PositorHost] = HOST_NAME()
    AND [p].[PO_PositorUID] = SUSER_ID();
    RETURN @PositorId;
    END;
    GO
    CREATE PROCEDURE [posit].[Insert_Positor]
    @PositorNote NVARCHAR(348) = NULL
    AS
    BEGIN
    DECLARE @ProcedureDesc NVARCHAR(257) = OBJECT_SCHEMA_NAME(@@PROCID) + N'.' + OBJECT_NAME(@@PROCID);
    SET @PositorNote = COALESCE(@PositorNote, N'Automatically created by: ' + @ProcedureDesc);
    DECLARE @Id TABLE
    [Id] INT NOT NULL
    INSERT INTO [posit].[PO_Positor]([PO_PositorNote])
    OUTPUT [INSERTED].[PO_PositorId]
    INTO @Id([Id])
    VALUES(@PositorNote);
    RETURN (SELECT TOP 1 [Id] FROM @Id);
    END;
    GO
    CREATE TABLE [posit].[PO_Positor]
    [PO_PositorId] INT NOT NULL IDENTITY(0, 1),
    [PO_PositorApp] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorApp] DEFAULT(APP_NAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorApp] CHECK([PO_PositorApp] <> ''),
    [PO_PositorName] NVARCHAR(256) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorName] DEFAULT(SUSER_SNAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorName] CHECK([PO_PositorName] <> ''),
    [PO_PositorHost] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorHost] DEFAULT(HOST_NAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorHost] CHECK([PO_PositorHost] <> ''),
    [PO_PositorSID] VARBINARY(85) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorSID] DEFAULT(SUSER_SID()),
    [PO_PositorUID] INT NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorUID] DEFAULT(SUSER_ID()),
    [PO_PositorNote] VARCHAR(348) NULL CONSTRAINT [CL__PO_Positor_PO_PositorNote] CHECK([PO_PositorNote] <> ''),
    [PO_tsInserted] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__PO_Positor_PO_tsInserted] DEFAULT(SYSDATETIMEOFFSET()),
    [PO_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__PO_Positor_PO_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__PO_Positor_PO_RowGuid] UNIQUE NONCLUSTERED([PO_RowGuid]),
    CONSTRAINT [UK__Positor] UNIQUE CLUSTERED ([PO_PositorApp] ASC, [PO_PositorHost] ASC, [PO_PositorUID] ASC),
    CONSTRAINT [PK__Positor] PRIMARY KEY ([PO_PositorId] ASC)
    GO
    ssd

    The error is in item 7: Returns -1 (SHOULD BE the same PositorId value returned in #2); but no error message is returned or thrown from SSIS.
    The error message indicated referential integrity is not upheld when inserting records. This error message occurs AFTER the Execute SQL Task successfully completes; the E.SQL Task returns -1.  The executed SQL code will not allow values less than 0
    ([PO_PositorId] INT NOT NULL IDENTITY(0, 1),)
    [Platts Valid [41]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E2F.
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E2F  Description: "The statement has been terminated.".
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E2F  Description:
    "The INSERT statement conflicted with the FOREIGN KEY constraint "FK__PricingPlatts_Posit_PositorId". The conflict occurred in database "Pricing", table "posit.PO_Positor", column 'PO_PositorId'.".
    The aforementioned FOREIGN KEY constraint is due to the value being returned by the Execute SQL Task.; therefore, the error lies in the value returned by the Execute SQL Task.

  • Conversion of java Array to oracle SQL Array while calling Stored Procedure

    How java Array can be converted to oracle SQL array while calling Stored procedure with callable statement.
    i.e java Array ---> Sql Array in Oracle while setting the datatypes to callable statement arguments.

    Look at:
    http://forum.java.sun.com/thread.jsp?forum=48&thread=376735&tstart=0&trange=15
    Paul

  • Writing mulitple sql statements in 1 stored procedure

    Hi all, can i know how to create mulitple sql statements in 1 stored procedure??
    Eg the first sql statement will generate few results and my second sql statement will based on the first statement result to execute its second results and my third sql statements will on the second results to generate the final results which will be passed back to jsp pages as a resultset??
    For the time being, i only know how to create a single sql statement in one stored procedure..i had surf through the oracle website but cant find any solution. Can anyone help me?? Samples or links to any website will do.. Thanks alot...

    Hi Irene,
    If I understand your question correctly, then I have already written
    a similar (PL/SQL) stored procedure without any problems.
    However, I do think your question is more suited to the following
    forum:
    http://forums.oracle.com/forums/forum.jsp?id=478021
    I also think it will help others to answer your question if you
    include the following information:
    1. Version of Oracle you are using.
    2. The error message you are getting.
    3. The part of your code that is causing the problem.
    Also, have you looked at the following web sites?
    http://asktom.oracle.com
    http://metalink.oracle.com
    Good Luck,
    Avi.

  • Extraction SQL statement from oracle stored procedure stored in file

    Hi,
    I am newbie to oracle stored procedure. I need to extract the list of sqls present in oracle stored procedure. Besides that I also want to parse these sql statements to get the list of tables and columns used. Is there any tool which can help me in doing thats.
    thanks,
    govind

    why don't check on user_dependencies table instead?
    select referenced_name,referenced_type
    from user_dependencies
    where name='<your stored procedure name in upper case>'
    and referenced_type = 'TABLE'HTH,
    Prazy

  • Joining java array with SQL table in a stored procedure

    Hey,
    I am calling a pl/sql stored procedure from a java program passing two arrays (employees) and (departments) as parameters to the procedure. Within the procedure I have stored the arrays in a table of records like this:
    type t_emp_type is record (employee_id number, department_id number);
    type t_emp_tbl_type is table of t_emp_type index by binary_integer;
    Where all elements in employees are stored in the employee_id column and departments are stored in the department_id column. So basically I've got a table like:
    l_employee_tbl t_emp_tbl_type;
    Looped through the arrays and stored the data like:
    for i in 1..p_employees.count loop
    l_employee_tbl(i).employee_id := p_employees(i);
    l_employee_tbl(i).deparment_id := p_departments(i);
    end loop;
    Now I would like to compare my l_employee_tbl with a SQL table in the database. Basically I would like to join my l_employee_tbl table with a SQL table named departments on department_id, returning all department_id:s that was not found in table departments.
    However, it is not possible to select from a user-defined table type. I have also tried to use the table() function and to cast l_employee_tbl, but found out it can't be done with records. And I would really like to use records or some other type where define my PL/SQL data. I know that you should not mix PL/SQL and SQL but in this case I think it is more efficient to try joining these "tables". Does anyone have a solution for this or advice to try something else out? It would be most appreciated.
    Edited by: 963281 on 2012-okt-04 14:25
    Edited by: 963281 on 2012-okt-05 01:53

    963281 wrote:
    I am calling a pl/sql stored procedure from a java program passing two arrays (p_employees) and (p_departments) as parameters to the procedure. Within the procedure I have stored the arrays in a table of records like this:
    type t_emp_type is record (employee_id number, department_id number);
    type t_emp_tbl_type is table of t_emp_type index by binary_integer;Why do you create an associative array?
    Now I would like to compare my l_employee_tbl with a SQL table in the database. Basically I would like to join my l_employee_tbl table with a SQL table named departments on department_id, returning all department_id:s that was not found in table departments. Of course, not possible as the SQL engine does not support PL/SQL user defined types. PL/SQL however support user defined SQL types. Which makes SQL defined types a lot more flexible.
    However, it is not possible to select from a user-defined table type. I have also tried to use the table() function and to cast l_employee_tbl, but found out it can't be done with records. Never mind SQL and PL/SQL - as a generic programming data structure principle. How do you expect being able to cast an associative array (name-value pairs) to a standard array? The two data structures are very different. So I'm puzzled in how you expect to move a non-scalar name-value pair data structure into a non-scalar value only data structure?
    And I would really like to use records or some other type where define my PL/SQL data. Why exactly? If the Java or PL/SQL data structure is populated using SQL data and database data, and wanting to use that data structure in SQL, what is the point? Why pull SQL data into a client data structure at all then - surely it is far more performant and scalable to rather keep that data in the database, and do the joins/selects/filters/etc using SQL?
    There is also the issue of scalability of local data structures in PL/SQL. The PL/SQL engine runs inside an Oracle server process, consuming private process memory on the server. The bigger the data structures used in PL/SQL, the more server memory needs to be allocated to that server process. This does not scale. Especially not if 10 or more such server processes are running the same PL/SQL code and each server needs to grab large chunks of server memory.
    If the data from Java comes from another source (e.g. keyboard, etc), and you need a means of storing this data server-side for use by PL/SQL and SQL. There are 2 basic choices. PL/SQL arrays for smallish amounts of data - and basing these arrays preferable on SQL data types allowing the array to be used by both SQL and PL/SQL engines. If the amount of data is not smallish, then it should be stored in the SQL engine (database) as that is designed for that exact purpose. And if the data is transient, then a GTT (global temp table) structure can be used (and indexed for optimal access).

  • Speed test: PL/SQL vs. Java Stored Procedures

    I performed tests on these two procedures:
    ===========================================
    // Create a Statement
    Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    // Query the table
    ResultSet rset = stmt.executeQuery ("select SIFOB, SIFRA_GU from sezko");
    while (rset.next ()) {
    salary = rset.getInt(1);
    rset.updateInt (1, salary + 1);
    salary = rset.getInt(2);
    rset.updateInt (2, salary + 1);
    rset.updateRow();
    } // while
    conn.commit();
    // Close the RseultSet
    rset.close();
    // Close the Statement
    stmt.close();
    ===========================================
    procedure updateTable is
    cursor c_updateTable is select rowid, SIFOB, SIFRA_GU from sezko;
    begin
    for r_updateTable in c_updateTable loop
    update sezko set SIFOB = SIFOB + 1, SIFRA_GU = SIFRA_GU + 1 where rowid = r_updateTable.rowid;
    end loop;
    commit;
    end;
    ===========================================
    First procedure is written in Java (as Java Stored procedure) and second is PL/SQL.
    Java is about 10x slower than PL/SQL code.
    Can you explain bad performance results?
    thank you
    Matic & Ales

    Hi,
    I suppose the problem is not with the connection object,but with make connection to the database for every executeupdate or executeupdaterow called .Similarly for fetching the data from the database you
    can use the fetch size technique.Please check the 8.1.6 Java Developers guide for using this.
    Update Batching(For Batch updates and commits)
    Fetch Size(For Batch fetching)
    Oracle Row Pre-Fetching
    Regards
    Anand
    null

  • PL/SQL vs. Java stored procedures.

    After learning about PL/SQL I have to admit it looks ugly to me. Is there any concrete reasons why PL/SQL should be used over Java for stored procedures. I understand that PL/SQL is native to Oracle and procedures written in PL/SQL would probably out perform Java procedures, but what if performance was not the most critical issue. Looking at PL/SQL makes me think it would be hard to maintain.
    Thanks in advance.

    Hi
    There is a common mis-understanding here. 2008 will be the last year oracle is going to support Developer in Client server mode. Oracle does not claim to discontinue Developer, They are currently working on Developer Rel9i, which is truely a multi tiered archtecture. PLSQL will live as long as Oracle database lives.
    PLSQL is simple yet powerful language, it is getting better with each version. With the new 9i release, it is truely object oriented like any OO language like Java/C etc. Further you can override methods in Objects and override them in C, Java, PLSQL etc. What this means is that you can have a parent Object and have some method x implemented in PLSQL, you can then inherit another object from the parent object and override the same method x, this time you can write the method x in java or C. No other language can offer this feature. Further PLSQL also provides you with dynamic typing, like most other OO languages. These are some of the features of PLSQL.
    And ofcourse, the language you choose is purely a matter of choice. If you are going to write a database-centric application, PLSQL might be a right choice as it facilitates many things for us like exception handling, transaction etc.
    If you are writing a generic application that can interact with any database, then java might be a right choice as you and encapsulate the information in the language.
    HTH
    Arvind Balaraman

  • Using C#  instead of pl/sql in a CLR stored procedure,  benefits?

    Hello dear experts,
    I was just playing around with C# and a little stored procedure I deployed to my Oracle 11.
    My questions are:
    Is it possible to call this "CLR c#" stored procedure in a different way than I call a standard pl/sql stored procedure from a C# client, maybe by something like referring to the same c# classname which I chose to wrap the stored procedure/function in?
    Is it possible to eg. return c# classes or c# arrays / own datatypes created within the CLR stored procedure to a C# client?
    Can I build up a c# array within my oracle c# stored procedure and return it to a C# client directly, or do I still have to do all the marshalling based on the standard pre-defined data types (number, varchar2 etc) myself and copy them to c# class members?
    Example: I have c# stored procedure like this:
    namespace oracle
    public class Crosssorter
    public static int GetChute(int parcelNo)
    int nChute=0;
    OracleConnection dbcon = new OracleConnection();
    dbcon.ConnectionString = "context connection=true"; // Wir benutzen die Session des Aufrufers
    dbcon.Open();
    OracleCommand cmd = dbcon.CreateCommand();
    cmd.CommandText = "select ChuteNo ...[blabla] ";
    cmd.Parameters.Add(":1", OracleDbType.Int32, parcelNo, ParameterDirection.Input);
    OracleDataReader reader = cmd.ExecuteReader();
    while (reader.Read())
    nChute = reader.GetInt32(0);
    reader.Close();
    cmd.Dispose();
    return (nChute);
    Can I reuse the class "Crosssorter" within my c# client application in order to access the function 'GetChute' more easily or is this classname only chosen because it has to have a name?
    Can I write an oracle C# stored proc so that a complex c# object is returned?
    So instead of a simple thing like 'public static int GetChute(int parcelNo)' maybe something like
    'public static int GetChute(
    int parcelNo,
    CChuteObject myChute)' <---- !!
    where CChuteObject is a C# class?
    In case all this is not possible, is there a solution to achieve this easily?
    Thank you for reading and thinking.
    Bernd.

    Hi Bernd,
    For best results, you may want to post this over in the [.NET Stored Procedures|http://forums.oracle.com/forums/forum.jspa?forumID=254] forum.
    Greg

  • JDBC SQL Server Channel Calling Stored Procedure Won't Return Result Set

    Good afternoon, Experts
    We're calling a stored procedure in a sender communcation channel.  I can perform any SQL SELECT statement here, but for some reason when I execute the SP (EXECUTE StoredProcedureName) The Adapter Engine returns the following:
    Database-level error reported by JDBC driver while executing statement 'DECLARE @UpdateRecords bit SET @UpdateRecords = 0 EXECUTE ExportToSAP @UpdateRecords'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    Even stranger yet is is that this works just fine on our PI-DEV system.  I created an identical communication channel connecting to the same database with the same UID and PWD and it won't work in PI-QAS.
    Any help/ideas you could share would be greatly appreciated!!!
    Thanks,
    Chad

    Hi Chad.
    Normally, itu2019s a problem with your procedure. The Store Procedure is wrong and something is different between your DEV environment and QAS environment.
    Try to ask to DB team check it.
    Regards,
    Bruno

  • SQL query statement  for stored procedure / function listing ...

    Hi everyone,
    Is there a SQL query to list all the stored procedures and functions of an user in an Oracle 8 database?
    I have this idea:
    select * from USER_SOURCE where TYPE = 'PROCEDURE' or TYPE = 'FUNCTION'
    but I am not too sure whether this is correct.
    Thanks in advance,
    Eric

    Yeah
    I agree with you Garcia , my above posting was a correction to the query mentioned in the question only.
    you are correct
    If you only want the name of the object,
    SELECT Object_Name from User_Objects where object_type in ( 'PROCEDURE' ,'FUNCTION');
    is much faster than Selecting (distinct) from User_Source.

  • Working in Sql, not working in Stored procedure

    Dear friends,
    I am puzzled about this strange working of Oracle , although I know that there is some problem with my code. I paste my code here. The delete statement is working properly in SQL Plus 8.0, but it is not working when I call this stored procedure from the Form.
    FUNCTION delete_record_treaty (
    p_treaty_id T_RIN_TREATY_MST.TRTY_ID_GV%TYPE, p_value VARCHAR2,p_block VARCHAR2 )
    RETURN BOOLEAN IS
    v_treaty_type varchar2(5);
    BEGIN
    v_treaty_type := substr(p_treaty_id,1,3);
    if p_block !='T_RIN_GRP_DTL' and p_block != 'T_RIN_XOLSLAB_DTL' and p_block!='T_RIN_PMTSCHD_DTL' then
    delete from T_RIN_TREATY_MST where TRTY_ID_GV=p_treaty_id ;
    commit;
    end if;
    if v_treaty_type = 'QTA' then
    delete from T_RIN_GRP_DTL where TRTY_ID_MV=p_treaty_id and T_RIN_GRP_DTL.ROWID = p_value;
    commit;
    elsif v_treaty_type = 'XOL' then
    delete from T_RIN_XOLSLAB_DTL where TRTY_ID_MV=p_treaty_id ;
    delete from T_RIN_PMTSCHD_DTL where TRTY_ID_MV=p_treaty_id ;
    elsif v_treaty_type = 'FAC' then
    delete from T_RIN_PMTSCHD_DTL where TRTY_ID_MV=p_treaty_id ;
    end if;
    RETURN(TRUE);
    END delete_record_treaty;
    Thanks in advance.
    All the paramaters that I pass, are correctly being passed to this stored procedure.
    null

    I solved it.One parameter I was passing it wrongly.
    Gee :D
    Subramanian V.

  • User can Execute SQL Statement but not Stored Procedure

    I have a function in Access that calls a stored procedure to update a table. When I run it, it works fine but when the users try to run it, they get an error.
    If I change it run the actual SQL syntax that is in the stored procedure then the users can run it and update the table without any problems, which makes no sense to me. It's doing the same exact thing as the stored procedure. I'd much rather have them be
    able to run the procedures then writing the SQL in VBA modules because that's going to end up being a lot of code.
    Any idea on why it's like this and how to correct it? Any assistance would be appreciated.

    Hello,
    When you give a user permission to run a stored procedure, everything on that procedure but Dynamic SQL will be executed
    without evaluating user permissions on the objects the stored procedure deals with.
    On the link I provided above, you will see how to provide permissions to stored procedures. Try creating database roles, add user to database roles, then assign permissions to database roles.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Issue with Oracle.sql.NUMBER in Java Stored Procedure

    When we try to make a call to the Oracle.sql.NUMBER(String) inside a java stored procedure and pass values from '01' to '09', it throws java.lang.StringIndexOutOfBoundsException: String index out of range: 3
    We use Oracle 9.2.0.6 - JServer Release 9.2.0.6.0.
    It works fine for other values. Please find below the code used for simulating the issue outside the application. Thanks.
    create or replace and compile java source named testNumber as
    import oracle.sql.NUMBER;
    import java.sql.SQLException;
    public class TestNumber
           public static String convertNumber(String parm) {
                     NUMBER nTest;
                     try {
                             nTest = new NUMBER(parm);
                             return "TRUE";
                     }catch (SQLException sqle) {
                             return "FALSE";
    create or replace function test_number (p_str in varchar2) return varchar2 as
    language Java name 'TestNumber.convertNumber(java.lang.String) return
    java.lang.String';
    select test_number('05') from dual;  - Throws exception ORA-29532: Java call terminated by uncaught Java exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 3
    select test_number('5') from dual; - Works fine
    select test_number('010') from dual; - Works fine

    Siva,
    I'm only guessing, but it could be an Oracle bug, in which case I suggest checking with Oracle Support.
    (You do have a support contract, don't you? ;-)
    Did you try compiling and running your java class "TestNumber" outside the database?
    Class "oracle.sql.NUMBER" should be in Oracle's JDBC driver, I believe.
    Good Luck,
    Avi.

  • Send SQL query or call stored procedure, which is best???

    hello experts!!
    i would like to ask what will be the best implementation on querying a database using Java, send a SQL query(insert into table values...) or call stored procedure(just pass parameters)?? and also in stored procedure does "autoCommit/rollback" applies/make sense??

    I searched google for this:
    Stored Procedures vs. SQL
    and found this useful link:
    http://www.karlkatzke.com/stored-procedures-vs-sql-calls/
    I thiink you should also read up on other articles based on such google searches
    to get other opinions. Also, read the links provided by that article.
    Personnally, I think stored procedures should be avoided unless there is a definite
    advantage as specified in the above article. Especially not used for CRUD operations.
    Also, no matter where you put the SQL, it should be documented. I've seen too many stored procedures that aren't documented.

Maybe you are looking for

  • Error on deploying web dynpro application

    Hi, When I deploy the application , the following error is seen. did not accept login request as admin on port its a simple hellp world application I check the link http://help.sap.com/saphelp_nw04/helpdata/en/76/fb72ec091f4bf8a2d8ba321bb7e8d9/conten

  • E1200 - Could not get it to work with Apple Airport

    Could not get it to install and gave up after tearing out my hair in frustration What's great about it: Still wondering What's not so great: Everything else About me... Internet phone user Business Professional No, I would not recommend this to a fri

  • Cost estimate

    Hi Guru's Our project go live was this month of 11th. At the time i run cost estimate for all the materials. But i know this is month end activity. But my doubt is before next cost estimate for all the materials. Is it required for all the PP orders

  • Looking for Labview/ Labwindows developer in Chennai

    Hi, We are  looking for an experinced developer in Labview/ Labwindows Thanks, [email protected]

  • Jrew Install error message

    Trying to install 8i PE on my Win 98. Get the following error message... JREW caused an invalid page fault in module KERNEL32.DLL at 017f:bff87f05. Any suggestions on how to resolve would be greatly appreciated.