Geeting TIMEOUT while executing a Stored Procedure.

Hi Gurus,
Am facing a TimeOut  issue while executing the Sql Stored Procedure.
I have changed a settings of Execution TimeOut to Zero (which is unlimited ), Am still unable to execute the Stored Procedure.
Should i have to add any TimeOut Command in my Sql Stored Procedure. If please suggest me.
Thanks in advance.

Time out is the client who throws the error  not SQL Server. Please read Erland's article
http://www.sommarskog.se/query-plan-mysteries.html
Are you sure there is blocking/locking? Is that possible someone run BEGIN TRAN and did not properly specify COMMIT TRAN?
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. 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.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

  • Strange error while executing a stored procedure: Incorrect syntax near '@p0'

    All, I am getting a strange error while executing a stored procedure: Incorrect syntax near '@p0'  using JDBC CallableStatment.
    Here is my code...
    CallableStatement cStmt = con.prepareCall("{call SET CHAINED ON EXEC <dbName>.<schemaName>.<SPName> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    cStmt.setString(1, "2012005881");
    cStmt.setString(2, "07");
    cStmt.setString(3, "10");
    cStmt.setString(4, "Case title");
    cStmt.setString(5, "Open");
    java.sql.Date dt1 = new java.sql.Date(2014,10,20);
    cStmt.setDate(6, dt1);
    cStmt.setString(7, "01");
    cStmt.setString(8, "N");
    cStmt.setString(9, "ADA Test");
    cStmt.setString(10, "N");
    cStmt.setString(11, "English");
    cStmt.setString(12, "N");
    cStmt.setString(13, "N");
    cStmt.setString(14, "N");
    cStmt.setString(15, "N");
    cStmt.setString(16, "N");
    cStmt.setString(17, "N");
    cStmt.setString(18, "07");
    cStmt.setString(19, "10");
    cStmt.setString(20, "juache0");
    java.sql.Date dt2 = new java.sql.Date(2014,10,20);
    java.sql.Date dt3 = new java.sql.Date(2014,10,20);
    cStmt.setDate(21, dt2);
    cStmt.setDate(22, dt3);
    cStmt.setString(23, "userid0");
    cStmt.setString(24, "");
    cStmt.setString(25, "");  
    cStmt.setString(26, "");
    java.math.BigDecimal bg1 = new java.math.BigDecimal(10);
    cStmt.setBigDecimal(27, bg1);
    cStmt.setString(28, "userid");
    cStmt.setString(29, "userid");
    int hadResults = cStmt.executeUpdate();
    Your help is greatly appreciated.
    I am executing the above using Jconnect3.0 driver, inside WebSphere Application Server V8.0
    Thanks
    Nags

    NOTE: I don't work with JDBC/jConnect so (at this point) just some questions ...
    1 - are you sending this to ASE, ASA, IQ, or some other RDBMS?
    2 - what is the value of <schemaname>?
    3 - do you have other prepareCall() instances that successfully call a stored proc? [would be interesting to see if there's a difference in the format of the calls]
    A quick google search shows a couple ways to submit a stored proc execution to the RDBMS, with the format depending on the format expected by the target RDBMS.
    I'm wondering if you really need/want the parentheses around the argument list, ie, what happens if you change
    from
    -- parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ( ?,?,?,?,?,...,? )
    to
    -- no parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ?,?,?,?,?,...,?
    In ASE if I wrap the parameters in parentheses I get the same error you're getting:
    ================== w/ parentheses => error
    1> sp_who (sa)
    2> go
    Msg 102, Level 15, State 1:
    Server 'CC1_V1', Line 1:
    Incorrect syntax near 'sa'.   <<=== sa == @p0 ??
    ================== w/out parentheses => works
    1> sp_who sa
    2> go
    fid spid status  loginame origname ...
       0   17 running sa       sa       ...
    ==================

  • Error ORA-04031 while executing a stored procedure from Pro C++ code

    I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
    Does anyone know why it is happening and any possible solutions?
    TIA
    Srithaj.

    One thing that can be done is to flush the shared pool before starting the application.
    alter system flush shared pool;
    Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
    null

  • JTA timeout while calling a stored procedure inside a DB Adapter

    Hi All,
    I am wondering if there is a way to increase the timeout interval for the DB Adapter at the BPEL process level than at a global level.
    Thanks,

    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.

  • Error while executing a stored procedure from forms6i

    When I execute a STORED PROCEDURE from ORACLE DB 10g this procedure works perfectly fine.
    But when I execute the same from the FORMs 6i I get the following error:
    PDE-PLU022 Don't have access to the stored program unit
    XMLPARSERCOVER in schema CARE.
    where XMLPARSERCOVER is the class and
    CARE is the schema.
    Regards,
    Jignesh S

    I have tried this with both the owner of the schema and the intended user, -from both forms and directly.
    All rights was granted on the stored procedure. Since posting I have found that one of the tables that the procedure might insert into, was not explicitly granted to the intended user, and after rectifying that the error message went away.
    -however, the procedure now silently "finishes" without any evidence that it ever ran, if invoked from the forms application. When invoked from SQL Plus (or JDev, or Toad) it runs as expected.
    I have no public synonym for the procedure, -is that necessary?
    The stored procedure in question is implemented in java, and published as a stored procedure. It does rather heavy lifting, when running, using a view against another server , updating local tables and quite a lot of data validation/cleansing, and logging. All recourses are within the same schema.
    Any ideas?

  • While executing java stored procedure i got an error

    I have used this command to load java source into data base
    loadjava -user ENCORA/ENCORA C:\framework\Packages\testdevelopement\HOST.java
    but while executing i got an error.
    SQL> create or replace function run_cmd(p_cmd in varchar2) return number
    2 as
    3 language java
    4 name 'HOST.RunThis(java.lang.String[]) return integer';
    5 /
    Function created.
    SQL> create or replace procedure RC(p_cmd in varchar2)
    2 as
    3 x number;
    4 begin
    5 x := run_cmd(p_cmd);
    6 end;
    7 /
    Procedure created.
    SQL> set serveroutput on size 1000000
    SQL> exec dbms_java.set_output(1000000)
    PL/SQL procedure successfully completed.
    SQL> exec rc('/usr/bin/ps -ef');
    BEGIN rc('/usr/bin/ps -ef'); END;
    ERROR at line 1:
    ORA-29540: class HOST does not exist
    ORA-06512: at "ENCORA.RUN_CMD", line 0
    ORA-06512: at "ENCORA.RC", line 5
    ORA-06512: at line 1
    can any one suggest me how can i resolve this problem?

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • Error while executing Multiple Stored Procedure through .sql file

    Hi Guru's.
    I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
    I have one test.sql file with Stored Procedure is like,
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton1');
    END skeleton1;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton2');
    END skeleton2;
    Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
    I am opening test.sql file from SQL PLUS,
    SQL>
    1 CREATE OR REPLACE PROCEDURE skeleton1
    2 AS
    3 BEGIN
    4 DBMS_Output.Put_Line('skeleton1');
    5 END skeleton1;
    6 /
    7 CREATE OR REPLACE PROCEDURE skeleton2
    8 AS
    9 BEGIN
    10 DBMS_Output.Put_Line('skeleton2');
    11* END skeleton2;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> show errors;
    Errors for PROCEDURE SKELETON1:
    LINE/COL ERROR
    6/1 PLS-00103: Encountered the symbol "/"
    SQL>
    Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
    Regards,
    Shatrughan

    Hi,
    Try this
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton1');
    END ;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton2');
    END;
    /Save the file and call it.
    Regards,
    Bhushan

  • Error while executing java stored procedure from a pl/sql procedure

    We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
    The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.NoClassDefFoundError
    Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
    Any pointers would be of great help!
    Thanks in advance

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • Problem while executing a Stored Procedure

    Hi,
    im a newbie,using Oracle 10g v(10.2.0.1.0) on linux machine.
    Im unable to execute following procedure through iSQLPLUS query interface.
    create or replace procedure pd_hr(
    pno varchar2,
    pdt date default sysdate,
    phr out number,
    perr_msg out varchar2
    ) as
    begin
         phr := 2;
    end pd_hr;
    VARIABLE phr number;
    VARIABLE perr_msg VARCHAR2(250);
    execute pd_hr('pno',NULL,phr,perr_msg);
    It flashes the following error when i try to execute the stored proc:
    ERROR at line 1:
    ORA-06550: line 1, column 44:
    PLS-00201: identifier 'PHR' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I executed the following query through DBA login before executing the procedure:
    GRANT EXECUTE ANY PROCEDURE TO "SCOTT";
    Any kind of assistance will be priceless!
    Peter

    Hi, Peter,
    user10707566 wrote:
    Thanks Frank, it worked seamlessly!
    btw what the ':' signifies here?":" just means "this is a bind variable".
    It's convenient, because when you name a bind variable "phr", you can use ":phr" without worrying whether there is a column or a local variable that is also called phr, and, if so, which one takes precedence.

  • Error while executing Java Stored Procedure.

    Hi,
    When I'm trying to execute my java stored procedure i'm getting the following error:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.ExceptionInInitializerError
    Does anybody has idea why this error comes and how can be resolved.
    Thanks in advance.
    Uday

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • Error while executing the stored procedure

    Hi All,
    When I try to execute the store procedure .The store procedure does not have parameter. I am getting the following error. The store procedure has been successfully complied.
    Thanks for all your help.
    uday
    ORA-01422: exact fetch returns more than requested number of rows
    01422. 00000 - "exact fetch returns more than requested number of rows"
    *Cause:    The number specified in exact fetch is less than the rows returned.
    *Action:   Rewrite the query or change number of rows requested                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi All,
    Here is the store proc and version. I do not have much exposure to pl sql store proc .
    Thanks for all your support and help.
    uday
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE     11.2.0.3.0     Production"
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    Here is the store proc .
    create or replace
    PROCEDURE TEST AS
    R_REGION VARCHAR2(5);
    R_listing2rifs_count number;
    R_listing2rifs number;
    listing2iag_count number; /* mentioned already: rp0428 */
    listing2iag number;
    R_rod2iag_count number;
    R_rod2iagnumber;
    R_rod2ra_count number;
    R_rod2ra number;
    begin
    select Region,
    sum(listing2rifs_count) as listing2rifs_count,
    round((sum(listing2rifs) / sum(listing2rifs_count))/30.4,1) as listing2rifs,
    sum(listing2iag_count) as listing2iag_count,
    round((sum(listing2iag) / sum(listing2iag_count))/30.4,1) as listing2iag,
    sum(rod2iag_count) as rod2iag_count,
    round((sum(rod2iag) / sum(rod2iag_count))/30.4,1) as rod2iag,
    sum(rod2ra_count) as rod2ra_count,
    round((sum(rod2ra) / sum(rod2ra_count))/30.4,1) as rod2ra
    into R_REGION,R_listing2rifs_count,R_listing2rifs,listing2iag_count,listing2iag,
    R_rod2iag_count,R_rod2iag,R_rod2ra_count,R_rod2ra
    from (select site.FK_REF_REGION_CODE Region,
    site.site_id,
    site.EPA_ID,
    site.name site_name,
    FEDERAL_FACILITY_DETER_CODE,
    NPL_STATUS_CODE,
    site.BRAC_TYPE_NAME,
    sis.FT_FLAG,
    listing_action,
    rifs_action,
    iag_action,
    rod_action,
    ra_action,
    listing.ACTUAL_COMPLETION_DATE as listing_date,
    iag.ACTUAL_COMPLETION_DATE as iag_date,
    first_rifs.ACTUAL_START_DATE as first_rifs_start_date,
    first_rod.ACTUAL_COMPLETION_DATE as first_rod_date,
    ra_start.ACTUAL_START_DATE as first_ra_start_date,
    case when first_rifs.ACTUAL_START_DATE is not null
    and listing.ACTUAL_COMPLETION_DATE is not null
    then 1
    else 0
    end as listing2rifs_count,
    first_rifs.ACTUAL_START_DATE - listing.ACTUAL_COMPLETION_DATE as listing2rifs,
    case when first_rifs.ACTUAL_START_DATE is not null
    and listing.ACTUAL_COMPLETION_DATE is not null
    then 1
    else 0
    end as listing2iag_count,
    iag.ACTUAL_COMPLETION_DATE - listing.ACTUAL_COMPLETION_DATE as listing2iag,
    case when first_rifs.ACTUAL_START_DATE is not null
    and listing.ACTUAL_COMPLETION_DATE is not null
    then 1
    else 0
    end as rod2iag_count,
    iag.ACTUAL_COMPLETION_DATE - first_rod.ACTUAL_COMPLETION_DATE as rod2iag,
    case when first_rifs.ACTUAL_START_DATE is not null
    and listing.ACTUAL_COMPLETION_DATE is not null
    then 1
    else 0
    end as rod2ra_count,
    ra_start.ACTUAL_START_DATE - first_rod.ACTUAL_COMPLETION_DATE as rod2ra
    from site
    LEFT OUTER JOIN
    (select fk_site_id,
    SPECIAL_INITIATIVE_CODE as FT_FLAG
    from SPECIAL_INITIATIVE_SITE sppi
    where SPECIAL_INITIATIVE_CODE = 'FT'
    ) SIS
    ON site.site_id = sis.fk_site_id
    LEFT OUTER JOIN
    (select fk_site_id,
    TYPE_SEQUENCE_CODE as listing_action,
    ACTUAL_COMPLETION_DATE
    from action
    where TYPE_CODE = 'NF'
    and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PC','PB','OA','OC','TO','TT'))
    and ACTUAL_COMPLETION_DATE is not null
    and TO_CHAR(action.ACTUAL_COMPLETION_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
    (SELECT min(TO_CHAR(ACTUAL_COMPLETION_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
    from action b
    WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
    and b.TYPE_CODE = 'NF'
    and b.ACTUAL_COMPLETION_DATE is not null
    ) listing
    ON SITE.SITE_ID = LISTING.FK_site_id
    LEFT OUTER JOIN
    (select FK_site_id,
    TYPE_SEQUENCE_CODE as rifs_action,
    ACTUAL_START_DATE,
    ACTUAL_COMPLETION_DATE
    from action
    where TYPE_CODE in ('NH','LW') /*('RI','NA','NH','FS','NK','NI','CO','BD','LW') */
    and LEAD_CODE = 'FF'
    and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PS','PB','OA','OS','TN','TT'))
    and ACTUAL_START_DATE is not null
    and TO_CHAR(action.ACTUAL_START_DATE,'YYYYMMDD') || TYPE_SEQUENCE_CODE =
    (SELECT min(TO_CHAR(ACTUAL_START_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
    from action b
    WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
    and b.TYPE_CODE in ('NH','LW') /*('RI','NA','NH','FS','NK','NI','CO','BD','LW') */
    and b.ACTUAL_START_DATE is not null
    ) first_rifs
    ON site.site_id = first_rifs.FK_site_id
    LEFT OUTER JOIN
    (select FK_site_id,
    TYPE_SEQUENCE_CODE as iag_action,
    ACTUAL_COMPLETION_DATE
    from action
    where TYPE_CODE = 'FI'
    and action.LEAD_CODE = 'FE'
    and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PC','PB','OA','OC','TO','TT'))
    and ACTUAL_COMPLETION_DATE is not null
    and TO_CHAR(action.ACTUAL_COMPLETION_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
    (SELECT min(TO_CHAR(ACTUAL_COMPLETION_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
    from action b
    WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
    and b.TYPE_CODE = 'FI'
    and b.ACTUAL_COMPLETION_DATE is not null
    ) iag
    ON site.site_id = iag.FK_site_id
    LEFT OUTER JOIN
    (select FK_site_id,
    TYPE_SEQUENCE_CODE as rod_action,
    ACTUAL_COMPLETION_DATE
    from action
    where TYPE_CODE = 'RO'
    and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PC','PB','OA','OC','TO','TT'))
    and ACTUAL_COMPLETION_DATE is not null
    and TO_CHAR(action.ACTUAL_COMPLETION_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
    (SELECT min(TO_CHAR(ACTUAL_COMPLETION_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
    from action b
    WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
    and b.TYPE_CODE = 'RO'
    and b.ACTUAL_COMPLETION_DATE is not null
    ) first_rod
    ON site.site_id = first_rod.FK_site_id
    LEFT OUTER JOIN
    (select FK_site_id,
    TYPE_SEQUENCE_CODE as ra_action,
    ACTUAL_START_DATE
    from action
    where TYPE_CODE = 'LY'
    and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PS','PB','OA','OS','TN','TT'))
    and ACTUAL_START_DATE is not null
    and TO_CHAR(action.ACTUAL_START_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
    (SELECT min(TO_CHAR(ACTUAL_START_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
    from action b
    WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
    and b.TYPE_CODE = 'LY'
    and b.ACTUAL_START_DATE is not null
    ) ra_start
    ON site.site_id = ra_start.FK_site_id
    WHERE site.FEDERAL_FACILITY_DETER_CODE = 'Y'
    and site.NPL_STATUS_CODE in (/*'P',*/'F','D','A')
    ) durations
    group by Region
    order by 1;
    end;
    errors:
    ORA-01422: exact fetch returns more than requested number of rows
    01422. 00000 - "exact fetch returns more than requested number of rows"
    *Cause: The number specified in exact fetch is less than the rows returned.
    *Action: Rewrite the query or change number of rows requested                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQLException while calling a Stored Procedure in Oracle

    Hi all,
    I am getting this error while calling a Stored Procedure in Oracle...
    java.sql.SQLException: ORA-00600: internal error code, arguments: [12259], [], [
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:207)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:540)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1273)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:780)
    at oracle.jdbc.driver.OracleResultSet.next(OracleResultSet.java:135)
    at StoredProcedureDemo.main(StoredProcedureDemo.java:36)
    The Program is ...
    import java.sql.*;
    public class StoredProcedureDemo {
         public static void main(String[] args) throws Exception {
              Connection con = null;
              ResultSet rs = null;
              Statement st = null;
              CallableStatement cs = null;
              int i;
              try {
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:SHYAM","scott","tiger");
                   System.out.println("Got Connection ");
                   st = con.createStatement();
                   String createProcedure = "create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS"
                             +" Emp_name VARCHAR2(10);"
                             +" CURSOR c1 (Depno NUMBER) IS"
                             +" SELECT Ename FROM emp WHERE deptno = Depno;"
                             +" BEGIN"
                             +" OPEN c1(Dept_num);"
                             +" LOOP"
                             +" FETCH c1 INTO Emp_name;"
                             +" EXIT WHEN C1%NOTFOUND;"
                             +" END LOOP;"
                             +" CLOSE c1;"
                             +" END;";
                   System.out.println("Stored Procedure is \n"+createProcedure);
                   i = st.executeUpdate(createProcedure);
                   System.out.println("After creating the Stored Procedure "+i);
                   cs = con.prepareCall("{call Get_emp_names(?)}");
                   System.out.println("After calling the Stored Procedure ");
                   cs.setInt(1,20);
                   System.out.println("Before executing the Stored Procedure ");
                   rs = cs.executeQuery();
                   System.out.println("The Enames of the given Dept are ....");
                   while(rs.next()) {
                        System.out.println("In The while loop ");
                        System.out.println(rs.getString(1));
              catch (Exception e) {
                   e.printStackTrace();
    Stored Procedure is ...
    create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS
    Emp_name VARCHAR2(10);
    CURSOR c1 (Depno NUMBER) IS
    SELECT Ename FROM emp WHERE deptno = Depno;
    BEGIN
    OPEN c1(Dept_num);
    LOOP
    FETCH c1 INTO Emp_name;
    EXIT WHEN C1%NOTFOUND;
    END LOOP;
    CLOSE c1;
    END;
    Stored procedure is working properly on sql*plus(Oracle 8.1.5)) editor. But it is not working from a standalone java application. Can anyone please give me a solution.
    thanks and regards
    Shyam Krishna

    The first solution is to not do that in java in the first place.
    DDL should be in script files which are applied to oracle outside of java.
    Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation.

  • Help required in executing the stored procedure and capturing the responce

    Hi,
    I have to execute a stored procedure in oracle database and if it successful then have to create a status IDOC.
    The stored procedure may throw an exception(it is not an out parameter), in such cases i should capture the exception as part of the response message and send this information while creating the status IDOC.
    i would like if the below is possible.
    As the stored procedure is not returning( this means if you execute the procedure manually it will display the result), will it be possible to capture the result which has the exception details?
    any direction to this will be highly appreciated.
    Many thanks.
    Regards,
    Rahul

    @Bhaskar,
    i need to execute the procedure by sending the input data from a file and capture the result after executing the procedure to create a status idoc
    im not sure how the provided links helps me here.
    i m not looking for any look ups. i would like to know is there any way that we can capture the result after executing the database procedure?
    Edited by: Rahul_10416 on Dec 5, 2011 10:07 PM

  • Error while calling a stored procedure using SQLJ

    I am calling a stored procedure defined inside a package through a SQLJ script. The first parameter of that procedure is a IN OUT parameter which is used as a ROWID for creating a cursor. That ROWID value is the same for every record in the table, thereby enabling us to create a cursor.
    When I give a hard-coded value as a parameter, I get an error stating that the assignment is not correct as the query is expecting a variable and not a literal. Hence I removed the hard-coded value and included a dymanic value in the SQLJ call.
    String strVal = "A";
    #sql{CALL ASSIGNMENTS_PKG.INSERT_ROW :{strVal},'SALARY_CODE_GROUP','BU',3,105,sysdate,1,sysdate,1,1)};
    Here "ASSIGNMENTS_PKG" is a package name and INSERT_ROW is the procedure.
    When the SQLJ program is run, I get an error stating:
    "PLS-00201: identifier 'A' must be declared"
    I read the error message, but I am not able to understand where I need to give the GRANT permission to.

    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.

Maybe you are looking for