Stored Procedure fails to return all rows of data.

Our HR database uses a procedure to build a list of employee IDs (ie. 1,3,14,...1210,1215) then calls a procedure to with a variable to extract details per employee. Unfortunately the list is 947 ids, however only 887 rows are returned.
As a test I split the list in two and called the procedure. If I add the data rows together I get 947, hence I know the employees are valid. Can anyone suggest why a long list of Ids should fail? Is there a limit a stored procedure can return?
The procedure (simplified down a bit) is:
ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
 @EmpIds varchar(4000)
AS
SELECT    E.empid as EmpId ,E.Surname
    FROM    Employee E
    WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
I can run the procedure as:
"exec sp_Employee_CreateTable @EmpIds=N'1,3,14.....999'" which returns (say) 700 rows  and  "exec sp_Employee_CreateTable @EmpIds=N'1001,.....1215'" which returns 247 rows. (ie. 700+247 = 947 which is correct.
But exec sp_Employee_CreateTable @EmpIds=N'1,3,14......1215' only returns 887 rows.
I have looked at the length of the data passed to the procedure (1,3,...1215) which equals 4126 chars, therefore I bumped the varchar space from 4,000 to 6,000 which is still within limits, however the number of rows returned was still 887.
Any help would be gratefully received.

Hi Scott. I run the script you suggested (thank you), the var EmpIds was set to a string with over 930 ids. The returned data set started with 0 but only had 888 rows. As mentioned above I refer the 930+ list as full list, and the 888 as the short list.
The difference (around 47) were the last values in the full list.
Although EmpIds was set to 6K it definately seems like it gets to around 4K chars then ignores any other values.
Re "since you pass....". Absolutely. I have modified the Employee_CreateTable with the var update to 6K/
ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
 @EmpIds varchar(6000),
 @IncludeLeavers Bit
AS
    SELECT    E.empid as EmpId ,E.Surname, E.Firstname as Forename,E.PayrollID, E.intextno as Extension, EJ.position as Position, [dbo].[GetEmployeeDepartment](E.empid) as Department, [dbo].[GetEmployeeLocation](E.empid) as Location,
E.title as Title, EJ.ReportsTo,
            CoEmail,E.[left]
    FROM    Employee E INNER JOIN EmployeeJobs EJ
    ON        E.empid = EJ.empid
    WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
            AND (E.[left]=0 or E.[left]=@IncludeLeavers)
    ORDER BY E.Surname, E.Firstname, E.empid

Similar Messages

  • Stored procedure with select return multiple rows

    hi,
    in transact the stored procedure is . .
    CREATE PROCEDURE MIPROCEDIMIENTO @CODE INT AS
    BEGIN
    SELECT COD, NAME, LASTNAME FROM EMPLOYE WHER COD = @CODE;
    END
    in oracle how?
    please, i speak spanish. .
    thanks

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10767/procedures_plsql.htm#TDPNG60035
    Sybrand Bakker
    Senior Oracle DBA

  • Tabular: Row filter on USERNAME() still returns all rows if current user is NOT matched in table??

    I have a table (basically the same setup in the various dynamic security in tabular blogs) where the table contains WindowsUserName stored as domain\username.
    I have a Row Filter on the table: SecurityTable has a filter of =SecurityTable[WindowsUserName]=USERNAME()
    When a user connects to the tabular model AND their name is matched in one of the rows they return JUST the rows with their match.  Which makes sense.
    However, if a user connects and their Windows user name is NOT in a row in that table....they return ALL rows???
    That makes no sense to me.
    It behaves almost as if it is doing a check and if it DOESN'T find a match it just returns all values.
    What am I missing?
    --------------EDIT-----------
    Found the issue: that use was (unknown to me) a domain admin, so... admin rights trump all :)

    Resolved:
    User had admin rights, didn't realize this at the time.

  • Stored procedure in  package return multiple columns from multiple tables

    Hi ,
    Can a single stored procedure return multiple column values from different tables.
    example:
    tabA: col2, tabB:col3,tabC:col4 etc.
    one more question:
    if a stored procedure like to return 10 columns for a particular record from a single table do i need to define a TYPE statement for each colum like
    TYPE col1 is TABLE of varchar
    TYPE col2 is TABLE of varchar
    here i want to return only one row, not many rows.
    thanks

    You can try one procedure with OUT or IN/OUT parameters that collect the values from one or more sql statements.
    CREATE OR REPLACE PROCEDURE P1
    (P_COD IN TABLE.COD%TYPE,
    P_DESC1 OUT TABLE1.DESC1%TYPE,
    P_DESC2 OUT TABLE2.DESC2%TYPE)
    IS
    BEGIN
    SELECT table1.DESC1, table2.DESC2
    INTO P_DESC1, P_DESC2
    FROM TABLE1, table2 WHERE
    table1.COD = P_COD and
    table1.cod = table2.cod ;
    END P1;
    JP

  • Query to return ALL rows even those with zero counts

    Hi,
    The following query will return only those rows that have a non zero count value:
    select c.id, a.name, count(*) as XYZ from CON c, CUST a
    where c.help !='1' and (c.id = a.id) group by c.id, a.name order by c.id;
    The results are:
    1 ME 3
    3 YOU 4
    What i want is to return all rows in CUST and the count, XYZ, that correspond to each row in CUST that matches the whare condition above, even if the count is zero.
    ie
    1 ME 3
    2 WE 0
    3 YOU 4
    Can this be done?

    You may want to get the counts then do the outer join. If you simply count with an outer join you will get 1 for 'WE' because there is a row in the cust table with 'WE'. This may work for you;
    with
      cust as (
       select 1 id, 'ME' name from dual union all
       select 2 id, 'YOU' name from dual union all
       select 3 id, 'WE' name from dual),
      con as (
       select 1 id, '2' help from dual union all
       select 1 id, '2' help from dual union all
       select 1 id, '2' help from dual union all
       select 2 id, '2' help from dual union all
       select 2 id, '2' help from dual union all
       select 2 id, '2' help from dual union all
       select 2 id, '2' help from dual)
    -- end of test data 
    select a.id, a.name, nvl(c.cnt,0) xyz
    from cust a, 
       (select id, help, count(*) cnt
       from con
       where help !='1'
       group by id, help) c
    where a.id = c.id(+)

  • SOAP TO JDBC scenario: calling stored procedure which will return the value

    Hi
    I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
    Result contains following values.
    return code as ( 0 Or 1) and also specific exception message if its return code as 1.
    Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
    Regards
    Kumar

    The OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
    Receive (to receive data from sender)
    Send Sync (to stored procedure and get response)
    Send Async (to mail receiver)
    Regards,
    Prateek

  • I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".

    Hello,
    I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
    Suppose , 
    Parameter value : person 1,person2,person3 
    table structure : 
    Project Name | officers 1 | officers 2
    here, officers 1 or officers 2 may contain names of multiple people.
    expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2. 
    please explain or provide solution in detail 
    - Thanks

    Hi Visakh,
    Thanks for reply.
    But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
    Your solution is working fine for following scenario : 
    Project 
    Officers 1
    Officers 2
    p1
    of11
    off21
    p2
    of12
    off22
    with parameter : of11,off22 : it will give expected output
    And its not working in case of :
    Project 
    Officers 1
    Officers 2
    p1
    of11,of12
    off21,off23
    p2
    of12,of13
    off22,off24
    with parameter : of11,off22 : it will not give any row in output
    I need patten matching not exact match :) 
    ok
    if thats the case use this modified logic
    CREATE PROC GetProjectDetails
    @PersonList varchar(5000)
    AS
    SELECT p.*
    FROM ProjectTable p
    INNER JOIN dbo.ParseValues(@PersonList,',')f
    ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
    OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
    GO
    Keep in mind that what you've done is a wrong design approach
    You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • "Failed to validate all rows" when inserting in master detail scenario

    Hi,
    I have problem writing data in a master detail scenario..
    i use the following bean method to write data.
    Data is inserted in the master table successfully but when i try to commit in the details table i get the error "Failed to validate all rows in a transaction."
    public void save(ActionEvent actionEvent)
    //writing into master table
    DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iterBind =
    (DCIteratorBinding)bindings.get("Master1Iterator");
    MasterVOImpl vo_pr = (MasterVOImpl ) iterBind.getViewObject();
    Row r=vo_pr.createRow();
    r.setAttribute("Name", name);
    Number num =(new oracle.jbo.server.SequenceImpl("new_seq",vo_pr.getDBTransaction())).getSequenceNumber();
    r.setAttribute("Id",num);
    vo_pr.insertRow(r);
    vo_pr.getDBTransaction().commit();
    //writing into details table
    DCIteratorBinding scopeiterBind =
    (DCIteratorBinding)bindings.get("Detail2Iterator");
    DetailVOImpl vo_sc = (DetailVOImpl) scopeiterBind.getViewObject();
    Row rs=vo_sc.createRow();
    rs.setAttribute("iddetail",iddetail);
    rs.setAttribute("Name", Name);
    rs.setAttribute("id",num);
    vo_sc.insertRow(rs);
    vo_sc.getDBTransaction().commit();
    Note: the Detail iterator used here is the one under the master in the AM

    In case your model defined a view link from master to detail should try to get the detail iterator from the master and use this to create the new row.
    Row r=vo_pr.createRow();
    r.setAttribute("Name", name);
    Number num =(new oracle.jbo.server.SequenceImpl("new_seq",vo_pr.getDBTransaction())).getSequenceNumber();
    r.setAttribute("Id",num);
    vo_pr.insertRow(r);
    // this method gets the detail iterator for the master row you just created.
    // The name of the method depends on the view link in your model you expose to the master view
    Row rs=vo_pr.getDetail().createRow();
    rs.setAttribute("iddetail",iddetail);
    rs.setAttribute("Name", Name);
    // this value should be added by the framework
    //rs.setAttribute("id",num);
    vo_sc.insertRow(rs);
    vo_pr.getDBTransaction().commit();Timo

  • Returning a row of data in a stored procedure

    Please help me remember how to return a row or rows from a pl/sql query in a stored procedure.
    I am having a major brain fart.

    If want to return a resultset from stored procedures see here for an example
    http://asktom.oracle.com/~tkyte/ResultSets/index.html

  • Stored procedure fails when run from SSIS DataFlow task

    I'hv a stored procedure (with dynamis SQL), taking colums names as parameters to run and returns dynamic columns in output. E.g. if I pass @ipselect = '*' it will returns all columns in output, when I pass @ipselect =  'column1, column2, column3'  
    ,it will returns 3 columns in output.
    Now I have SSIS package. I've Data Flow task in foreach loop container and it is taking parameter from client table. e.g
    clientid       column name
    1                        *
    2                columns1,columns2,column3
    3               columns1,columns2,column3,columns4,columns5,column6
    4                       *
    Foreach container loop through each client id and set ipselect parameter with
    column name  and that value is being passed to @ipselect stored procedure in Dataflow task. When there is @ipselect = '*' it runs fine ,returns all columns and write to destination. But when there is ipselect = 'columns1,columns2,column3',
    it fails with below error:
    [OLE DB Source [1]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E55.
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E55  Description: "Column does not exist.".
    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "OLE DB Source" (1) returned error code 0xC0202009.  The component returned a failure code when the pipeline engine called PrimeOutput().
    The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.
    Any suggestion or solution would be really helpful.
    Thanks!!

    Hi Kevin,
    Just an addition. To create SSIS package programmatically, please refer to the document:
    http://msdn.microsoft.com/en-us/library/ms345167.aspx 
    To implement dynamic column mapping through SSIS Script Component, please refer to:
    http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/ 
    http://blog.quasarinc.com/ssis/best-solution-to-load-dynamically-change-csv-file-in-ssis-etl-package/ 
    Regards,
    Mike Yin
    TechNet Community Support

  • Basic Stored Procedure Help - Not Returning Data

    Hello All:
    To be fair, I come from a SQL Server environment and have never written anything for PL/SQL / Oracle before, this is my first attempt, so if anything is better or more efficient, please let me know. The immediate problem I am having is, I have the Stored Procedure below, and all I want to do is return the data in the table, so that I can fill my DataSet in code. But when I run the code against this stored procedure, it always brings back no data (if I simply do a standard "SELECT * FROM lkAllocation", I get the results, so I know data is there and the connection is good). If run the procedure in my window in Oracle SQL Developer (call PAYSOL.spallocationselectall();), my results window shows no data as well. What is wrong with this Store Procedure?
    create or replace
    PROCEDURE spAllocationSelectAll IS
    AllocationID Integer;
    AllocationName Varchar2(50);
    BEGIN
    AllocationID := 0;
    AllocationName := '';
    SELECT
    AllocationID,
    AllocationName
    INTO
    AllocationID,
    AllocationName
    FROM
    lkAllocation
    ORDER BY
    AllocationName;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END spAllocationSelectAll;

    Hi and welcome to the forum.
    But when I run the code against this stored procedure, it always brings back no data I presume that your code will fail when having more than one record in your table.
    Did you check your error logging table?
    Anyway:
    Your approach will not give you your desired results.
    You're selecting two column values in two variables and nothing else happens.
    No OUT-parameters declared
    Perhaps you're better off using a function instead of a procedure etc,etc...
    When you have more than one record on your table, you'll run into a TOO_MANY_ROWS error this way...
    See:
    PL/SQL 101 : Understanding Ref Cursors
    and
    Re: Dynamic sql or ref cursor or what
    or
    How to return table value from stored procedure without ref cursor
    In short: do a search on this forum on 'REF CURSOR'...
    Also try to read, learn, do searches and understand a bit about Oracle, by studying the docs.
    http://www.oracle.com/pls/db102/homepage
    Concepts: http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/toc.htm
    Fundamentals: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/toc.htm
    And check out http://asktom.oracle.com as well...

  • Why recompiling a stored procedure would change returned data?

    We have a web ASP.net application and Oracle database. Everything was working fine for at least last 5 years and now we can't figure out why
    our stored procedures no longer work.
    Here is what huppening
    On our Oracle database if we do SELECT * FROM web_usertable we see every user who can ‘access’ the our system via website.
    user1 is me
    583 user1 null John q us 0 02 605
    670 user2 null Ed      Black us 0 02 693
    Information about me and user2 is in the Oracle.
    The only difference is that I have been in the database for years and user2 is for about one month.
    When I go to the website and ‘enter’ ... Website is calling USP_GETUSERPROFILE that returns all my data. Everything works fine
    When user2 performs exactly the same task no data from Oracle is being returned. (Why NOT??? Data is in the Oracle Table)
    Order of things doesn’t make any difference: I can go 1st and everything would work ... then user2 and his data isn’t working OR he can go 1st and nothing being returned and I go 2nd and everything will work for me.
    Here is what we found and it is only one of many ways we can reproduce this problem:
    I go 1st and everything would work (We know that code and Stored Procedure is working) user2 goes 2nd and no data is returned (Something is wrong)(Why NOT??? Data is in the Oracle Table)
    Without closing any windows or restarting any application or IIS or any other actions … if at this point we simply drop and recreate USP_GETUSERPROFILE all user2 data immediately comes back.
    This issue is not only occurring with user2 data. It appears that any recently added user has this problem.
    It also isn’t limited to the USP_GETUSERPROFILE procedure we found other instances when recompiling a Stored Procedure solved a problem.
    We don't even know where to look. We also suspect that it might have someting to do with .NET because some other stored procedures in our applications being executed by C++ code don't have this problem.
    Edited by: user11296530 on Aug 21, 2009 10:56 AM

    terrn wrote:
    that would do it, I guess
    now the newbie question: within the function block: how do I assign the results va1 and va2 from a select query into the attributes of the object? I couldn't find an example where that's demonstrated (if possible).
    simplified I should have:
    create or replace function my_function(a number, b varchar2) return my_type
    as
    my_obj my_type;
    begin
    -- here:
    select val1, val2 from table1 -- this is always only one row
    -- my_obj := my_type(a,b); -- how do I assign those here?
    return my_obj;
    end
    select my_type(val1,val2) into my_obj
    from table1;Edited by: Toon Koppelaars on Feb 24, 2011 10:16 AM

  • How to Store the result sets of a stored procedure that is returning more that one result set in two different table ?

    Hi Experts,
       I have on stored procedure which returns mote than one resultset i want that to store in two different temp table how can achieve this in SQL server.
     following is the stored procedure and table that i need to create.
    create procedure GetData as begin select * from Empselect * from Deptend 
    create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
    Insert into #tmp1 (Ddeptid , deptname ,Location )
    exec GetData
    create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
    Insert into #tmp (empId,ename,deptId,salary)
    exec GetData
    Niraj Sevalkar

    You cant get two resultsets out of SP like this. The workaround is to merge and bring the resultsets.
    For this number of columns as well as corresponding datatypes have to be compatible. Also you will need one additional column which indicates resultset value. Then use this as filter to get your desired resultset out
    create procedure GetData as
    begin
    select 'resultset1' as Cat,*,.. N columns from Emp
    union all
    select 'resultset2' as Cat,*,.. N columns from Dept
    end
    create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
    Insert into #tmp1 (Ddeptid , deptname ,Location )
    Select column1,column2,column3
    from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
    Integrated Security=SSPI','Execute yourdb..GetData')
    WHERE Cat = 'resultset1'
    create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
    Insert into #tmp (empId,ename,deptId,salary)
    Select column1,column2,column3, column4
    from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
    Integrated Security=SSPI','Execute yourdb..GetData')
    WHERE Cat = 'resultset2'
    also see
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
    Another method is to populate table with relevant resultset within procedure itself and then select from the table directly outside.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Calling Java Stored Procedure failed SQLXML

    I tried to upload a simple class to Oracle in which I want to use java.sql.SQLXML class using:
    loadjava -u user/passwd@host:1521:xyz -v -resolve C:\develop\workspaces\Test\src\lbb\apc\test\JavaStoredProcedureTest.java
    loadjava answers with:
    creating : source lbb/apc/test/JavaStoredProcedureTest
    loading  : source lbb/apc/test/JavaStoredProcedureTest
    resolving: source lbb/apc/test/JavaStoredProcedureTest
    errors   : source lbb/apc/test/JavaStoredProcedureTest
        ORA-29535: Quelle erfordert Neukompilierung
        lbb/apc/test/JavaStoredProcedureTest:6: cannot find symbol
        symbol  : class SQLXML
        location: package java.sql
        import java.sql.SQLXML;Then I found that the Oracle JDBC driver does not support the SQLXML type, thus changing my program to use XMLType:
    XMLType sqlXml = (XMLType)rs.getSQLXML(1);but it doesn't help as well as it doesn't help to use
    Clob clob = rs.getClob(1);Finally I tried (and failed) to use
    Object obj = rs.getObject(1);
    results in:
    java.sql.SQLException: ORA-29532:Java call terminated by uncaught Java exception:What can I do to solve this problem?

    I wrote it for an example. sorry i should be clear.
    Here is the code i am running check WORKING & NOT WORKING lines. What am i missing
    PL SQL package
    CREATE OR REPLACE PACKAGE BODY APPS.hypr_Reference_designator as
    function hypr_xsl ( dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
    return varchar2
    as language java name 'hypr_ref_designator_xsl.hypr_xsl(java.lang.String,java.lang.String) return java.lang.String';
    procedure hypr_xsl(dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
       is
       itemNum VARCHAR2(30);
       db Varchar2(30);
       print_string varchar2(200);
       begin
          db:=dbInstance;
            itemNum:=Parent_ItemNum;
          print_string := hypr_xsl(db,itemNum);  --NOT WORKING
                print_string := hypr_xsl('DEV','123'); --WORKING
          commit;
          DBMS_OUTPUT.PUT_LINE(print_string || db || itemNum);
       end hypr_xsl;
    END hypr_Reference_designator;Java Stored Procedure
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED APPS.HYPR_REF_DESIGNATOR_XSL as import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    import java.util.Properties;
    public class hypr_ref_designator_xsl {
        public hypr_ref_designator_xsl() {
        public static void main(String[] args) {
    public static String hypr_xsl(String  dbinstance, String parent_itemNum) {
    System.out.print(dbinstance);
    System.out.print(parent_itemNum);
    return "";
    //does some process here
    }

  • Cursor in stored procedure fails

    Hi,
    In our application we have a stored procedure which is called with in parameters to generate data into some table. This procedure is being called from another procedure.
    This procedure has been used to generate data into the table without any problem since oracle 9i. Last year we have upgraded to oracle 11g after that this procedure is failing intermittently to generate data. When this procedure is executed 50 times it fails atleast once to generate data. If we rerun the procedure for the failed case it generates the data without any change to program code nor any change in underlying data. It doesn't fail if we rerun. Therefore we are unable to simulate the problem.
    Procedure has got a very simple code.
    proc1 (p1 date,p2 date) is
    begin
    for c1_rec in c1 (select col1,col2
    from x,y where x.......)
    loop
    end loop;
    end;
    First we thought for some reason this procedure was not executed at all. But it is not the case. Actually it calls the procedure but the cursor inside the procedure doesn't fetch any records. Also it doesn't report any oracle error.
    Appreciate if any one can help me in this.
    Thanks & Regards,
    Raja

    vaidyanathanraja wrote:
    4. If there is a logical error, the same procedure should not generate data when it is rerun. Behaviour should be the same at all times.Incorrect. Something like NLS settings for example can make the same code, behave differently. E.g. a date string is passed and implicitly converted to a date. And this will work for most dates from different session using different NLS settings (e.g. yyyy/mm/dd versus yyyy/dd/mm). And these sessions will provide different results using the same parameters calling the same application code.
    There are a number of such run-time factors that influences code.
    5. Failed means it didn't generate the expected output. Which means that there is a problem with that SQL being executed the way it is, with the parameters used. You need to isolate the problem further.
    6. Parameter values are right.Have you proved that by using a test case that runs the very same SQL via a test proc, using the same parameter, via a job? Ran that test case interactively via sqlplus?
    You need to pop the hood and isolate the problem.
    7. I came across one blog saying different behaviour for REF CURSOR between oracle 10g and 11g and he says it is oracle bug. I don't know whether it is applicable for this case also.Bahumbug. There are many Oracle bugs. As there is in all software. However, you have not provided any evidence of a bug.
    Application code is behaving inconsistently. That is the symptom. Oracle system code is not relevant until you can prove that the inconsistency is not in the application code, but lower down the call stack.

Maybe you are looking for