Error in my cursor

Oracle Forms6i
Hai All
While i am executing my cursor i got this error
This is my code
declare
in_time varchar2(25);
out_time varchar2(25);
intrin_time varchar2(25);
introut_time varchar2(25);
cursor test_cur is
select * from dail_att order by barcode;
begin
go_block('TEST_SRI');
first_record;
open test_cur;
loop
select intime,outtime,intrtimein,introuttime into in_time,out_time,intrin_time,introut_time from dail_att;
message('hai');
if :barcode is not null and in_time is not null then
update dail_att set outtime = :bartime where
barcode= :barcode and ATTEND_DATE = :bardate-1;
elsif :barcode is null then
insert into dail_att(barcode,intime,attend_date)
values(:barcode,:bartime,:bardate);
elsif :barcode is not null then
update dail_att set outtime = :bartime where
barcode= :barcode and ATTEND_DATE = :bardate;
elsif :barcode is not null and :bartime > in_time
and :bartime < out_time then
insert into dail_att
(barcode,intrtimein,attend_date)
values(:barcode,:bartime,:bardate);
elsif :barcode is not null and :bartime > in_time
and :bartime < out_time and :bartime > intrin_time then
update dail_att set introuttime = :bartime where
barcode= :barcode and ATTEND_DATE = :bardate;
end if;
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE' OR :BARCODE IS NULL;
NEXT_RECORD;
END LOOP;
message('hai');
forms_ddl('commit');
exception
when others then
--forms_ddl('rollback');
message(sqlerrm||dbms_error_Text);
message(sqlerrm||dbms_error_Text);
End;      
The Error is
ORA-01403 no data found ORA-00000 normal, success compailation
tell me how to solve this problem
Thanks & Regards
Srikkanth.M

Srikanth,
First print the cursor value using message.
or write
begin
exception
end
for the query the following
select intime,outtime,intrtimein,introuttime into in_time,out_time,intrin_time,introut_time from dail_att;
kanish

Similar Messages

  • Error Returning REF CURSOR

    I'm trying to return a REF CURSOR from a function and get the following error:
    ORA-00932: inconsistent datatypes: expected CURSER got NUMBER
    ORA-06512: at "CERTS.JIMMY", line 17
    ORA-06512: at line 10
    Here is my function:
    CREATE OR REPLACE PACKAGE jimmy
    AS
    TYPE refc IS REF CURSOR
    RETURN equipment%rowtype;
    FUNCTION getresults(p_ssan_in IN equipment.ssan%TYPE,
                             p_type_in IN equipment.equip_type%TYPE)
         RETURN refc;
    END jimmy;
    CREATE OR REPLACE PACKAGE BODY jimmy
    AS
    FUNCTION getresults( p_ssan_in IN equipment.ssan%TYPE,
                                  p_type_in IN equipment.equip_type%TYPE)
    RETURN refc
    IS
    l_cursor refc;
    isretired equipment.retired%TYPE := 'N';
    qry varchar2(100) := 'SELECT * ' ||
                                  'FROM equipment ' ||
                                  'WHERE ssan = :b1 ' ||
                                  'AND equip_type = :b2 ' ||
                                  'AND retired = :b3';
    BEGIN
    EXECUTE IMMEDIATE qry
         INTO l_cursor
         USING p_ssan_in, p_type_in, isretired;
    RETURN l_cursor;
    END getresults;
    END jimmy;
    The data types for the parameters are all varchar2. I don't know why it says it is returning a number.

    I tried your suggestion:
    BEGIN
    OPEN l_cursor
         FOR qry
         USING p_ssan_in, p_type_in, isretired;
    RETURN l_cursor;
    END getresults;
    But I get an error:
    PLS-00455: cursor 'L_CURSOR' cannot be used in dynamic SQL OPEN statement

  • Error while declaring cursor

    Hi all,when i am trying to declare a cursor in a procedure i am getting errors.Kindly correct me where i am going wrong
      1  CREATE OR REPLACE PROCEDURE xxc_lc_rcv_interface_prc IS
      2      v_a    NUMBER;
      3      v_b    NUMBER;
      4      v_c    NUMBER;
      5      v_d    NUMBER;
      6      v_e    NUMBER;
      7      v_f    NUMBER;
      8      v_g    NUMBER;
      9   CURSOR rcv_interface_cur
    10   IS
    11   SELECT shipment_header_id INTO v_c
    12   FROM RCV_SHIPMENT_HEADERS
    13   WHERE SHIPMENT_NUM = 'NOV1124';
    14   SELECT shipment_line_id INTO v_d
    15   FROM RCV_SHIPMENT_LINES
    16   WHERE SHIPMENT_HEADER_ID = v_c;
    17   BEGIN
    18     SELECT rcv_headers_interface_s.nextval INTO v_a FROM dual ;
    19     SELECT rcv_interface_group_s.nextval INTO v_b FROM dual;
    20     SELECT rcv_headers_interface_s.currval INTO v_e FROM dual ;
    21     SELECT rcv_interface_groups_s.currval  INTO v_f FROM dual;
    22     SELECT rcv_transactions_interface_s.nextval INTO v_g FROM dual;
    23  BEGIN
    24  INSERT INTO rcv_headers_interface
    25  (
    26  HEADER_INTERFACE_ID,
    27  GROUP_ID,
    28  PROCESSING_STATUS_CODE,
    29  RECEIPT_SOURCE_CODE,
    30  TRANSACTION_TYPE,
    31  AUTO_TRANSACT_CODE,
    32  LAST_UPDATE_DATE,
    33  LAST_UPDATE_LOGIN,
    34  LAST_UPDATED_BY,
    35  CREATION_DATE,
    36  CREATED_BY,
    37  VALIDATION_FLAG,
    38  COMMENTS,
    39  SHIPMENT_NUM,
    40  FROM_ORGANIZATION_ID,
    41  SHIP_TO_ORGANIZATION_ID,
    42  EXPECTED_RECEIPT_DATE
    43  --RECEIPT_HEADER_ID
    44  )
    45  VALUES
    46   (v_a,                                         --Header Interface ID
    47   v_b,                                          --Group ID
    48   'PENDING',                                    --Processing Status Code
    49   'INVENTORY',                                  --Receipt source Code
    50   'RECEIVE',                                    --Transaction Type
    51   'DELIVER'  ,                                   --AUT Transact Code
    52   sysdate,                                       --last update date
    53   1053,                                         --last updated by
    54   1053,                                        --Last Update Login
    55   sysdate,                                      --creation date
    56   1053,                                         --created by
    57   'Y',                                          --Validation Flag
    58   'Receiving Through Interface',                --Comments
    59   'NOV1124' ,                                --Shipment Number
    60   81,                                           --From Org
    61   82,                                           --To org
    62   sysdate                                     --Expected Receipt Date
    63  );
    64  END;
    65   BEGIN
    66  FOR crec IN rcv_interface_cur loop
    67  INSERT INTO rcv_transactions_interface
    68  (
    69               HEADER_INTERFACE_ID,
    70               GROUP_ID,
    71               INTERFACE_TRANSACTION_ID,
    72               TRANSACTION_TYPE,
    73               TRANSACTION_DATE,
    74               PROCESSING_STATUS_CODE,
    75               PROCESSING_MODE_CODE,
    76               TRANSACTION_STATUS_CODE,
    77               CATEGORY_ID,
    78               QUANTITY,
    79               LAST_UPDATE_DATE,
    80               LAST_UPDATED_BY,
    81               CREATION_DATE,
    82               CREATED_BY,
    83               RECEIPT_SOURCE_CODE,
    84               DESTINATION_TYPE_CODE,
    85               AUTO_TRANSACT_CODE,
    86               SOURCE_DOCUMENT_CODE,
    87               UNIT_OF_MEASURE,
    88               INTERFACE_SOURCE_CODE,
    89               ITEM_ID,
    90               --ITEM_DESCRIPTION,
    91               UOM_CODE,
    92               EMPLOYEE_ID,
    93               SHIPMENT_HEADER_ID,
    94               TO_ORGANIZATION_ID,
    95               SUBINVENTORY,
    96               FROM_ORGANIZATION_ID,
    97               FROM_SUBINVENTORY,
    98               EXPECTED_RECEIPT_DATE,
    99               SHIPPED_DATE,
    100               VALIDATION_FLAG
    101  )
    102  VALUES
    103       (v_e,                                          --Header Interface ID
    104       v_f,                                          --Group ID
    105       v_g,                                           --Interface_transaction_id
    106       'RECEIVE',                                       --Transaction Type
    107       sysdate,                                      --Transaction Date
    108       'PENDING',                                    --Processing Status Code
    109       'BATCH',                                      --Processing Mode Code
    110       'PENDING',                                    --Transaction Status Code
    111       120,                                          --Category ID
    112       2,                                           --Quantity
    113       sysdate,                                     --last update date
    114       1053,                                        --last updated by
    115       sysdate,                                      --creation date
    116       1053,                                           --created by
    117       'INVENTORY',                                  --Receipt source Code
    118       'INVENTORY',                                  --Destination Type Code
    119       'DELIVER' ,                                    --AUTO Transact Code
    120       'INVENTORY',                                  --Source Document Code
    121        'Each',                                     --Unit Of Measure
    122        'RCV',                                       --Interface Source Code
    123        2492,                                        --Item ID
    124        --'ABBY KITCHEN CURTAIN SET BEIGE/BURGUNDY',   --Item Description
    125        'EA',                                       --UOM COde
    126        1053,                                       --User
    127       v_c,                                         --Shipment Header ID
    128        v_d,                                        --SHipment Line ID
    129        82,                                           --To Organization ID
    130        'Brooklyn',                                     --Sub Inventory ID
    131        81,                                            --From Organization
    132        'Vessel',                                      --From Subinventory
    133        sysdate,                                       --Expected Receipt Date
    134        sysdate,                                      --Shipped Date
    135        'Y'                                           --Validation Flag
    136      );
    137  --END IF;
    138  END LOOP;
    139  END;
    140*     END xxc_lc_rcv_interface_prc;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> sho err
    Errors for PROCEDURE XXC_LC_RCV_INTERFACE_PRC:
    LINE/COL ERROR
    14/2     PLS-00103: Encountered the symbol "SELECT" when expecting one of
             the following:
             begin function pragma procedure subtype type <an identifier>
             <a double-quoted delimited-identifier> current cursor delete
             exists prior
             The symbol "begin" was substituted for "SELECT" to continue.
    141/0    PLS-00103: Encountered the symbol "end-of-file" when expecting
             one of the following:
             ( begin case declare end exception exit for goto if loop mod
             null pragma raise return select update while with
             <an identifier> <a double-quoted delimited-identifier>
             <a bind variable> << continue close current delete fetch lock
             insert open rollback savepoint set sql execute commit forall
             merge pipe purge

    hi,
    I have corrected your code
    CREATE OR REPLACE PROCEDURE xxc_lc_rcv_interface_prc
    IS
       v_a   NUMBER;
       v_b   NUMBER;
       v_c   NUMBER;
       v_d   NUMBER;
       v_e   NUMBER;
       v_f   NUMBER;
       v_g   NUMBER;
       CURSOR rcv_interface_cur
       IS
          SELECT shipment_header_id
            INTO v_c
            FROM rcv_shipment_headers
           WHERE shipment_num = 'NOV';
    BEGIN
       SELECT shipment_line_id
         INTO v_d
         FROM rcv_shipment_lines
        WHERE shipment_header_id = v_c;
       SELECT rcv_headers_interface_s.NEXTVAL
         INTO v_a
         FROM DUAL;
       SELECT rcv_interface_group_s.NEXTVAL
         INTO v_b
         FROM DUAL;
       SELECT rcv_headers_interface_s.CURRVAL
         INTO v_e
         FROM DUAL;
       SELECT rcv_interface_groups_s.CURRVAL
         INTO v_f
         FROM DUAL;
       SELECT rcv_transactions_interface_s.NEXTVAL
         INTO v_g
         FROM DUAL;
       BEGIN
          INSERT INTO rcv_headers_interface
                      (header_interface_id, GROUP_ID, processing_status_code,
                       receipt_source_code, transaction_type,
                       auto_transact_code, last_update_date, last_update_login,
                       last_updated_by, creation_date, created_by,
                       validation_flag, comments, shipment_num, from_organization_id, ship_to_organization_id, expected_receipt_date
                      --RECEIPT_HEADER_ID
               VALUES (v_a,                                  --Header Interface ID
                           v_b,                                         --Group ID
                               'PENDING',                 --Processing Status Code
                       'INVENTORY',                          --Receipt source Code
                                   'RECEIVE',                   --Transaction Type
                       'DELIVER',                              --AUT Transact Code
                                 SYSDATE,                       --last update date
                                         --,                                         --last updated by
                                         --,                                        --Last Update Login
                                         SYSDATE,                  --creation date
    --    ,                                         --created by
                       'Y',                                      --Validation Flag
                           'Receiving Through Interface',               --Comments
                                                         'NOV',  --Shipment Number
    --    ,                                           --From Org
    --    ,                                           --To org
                       SYSDATE                             --Expected Receipt Date
       END;
       BEGIN
          FOR crec IN rcv_interface_cur
          LOOP
             INSERT INTO rcv_transactions_interface
                         (header_interface_id, GROUP_ID,
                          interface_transaction_id, transaction_type,
                          transaction_date, processing_status_code,
                          processing_mode_code, transaction_status_code,
                          category_id, quantity, last_update_date,
                          last_updated_by, creation_date, created_by,
                          receipt_source_code, destination_type_code,
                          auto_transact_code, source_document_code,
                          unit_of_measure, interface_source_code, item_id,
                          --ITEM_DESCRIPTION,
                          uom_code, employee_id, shipment_header_id, to_organization_id, subinventory, from_organization_id, from_subinventory, expected_receipt_date, shipped_date, validation_flag
                  VALUES (v_e,                               --Header Interface ID
                              v_f,                                      --Group ID
                          v_g,                          --Interface_transaction_id
                              'RECEIVE',                        --Transaction Type
                          SYSDATE,                              --Transaction Date
                                  'PENDING',              --Processing Status Code
                          'BATCH',                          --Processing Mode Code
                                  'PENDING',             --Transaction Status Code
    --       ,                                          --Category ID
    --       ,                                           --Quantity
                          SYSDATE,                              --last update date
    --       ,                                        --last updated by
                                  SYSDATE,                         --creation date
    --       ,                                           --created by
                          'INVENTORY',                       --Receipt source Code
                          'INVENTORY',                     --Destination Type Code
                                      'DELIVER',              --AUTO Transact Code
                                                'INVENTORY',
                                                            --Source Document Code
                          'Each',                                --Unit Of Measure
                                 'RCV',                    --Interface Source Code
    --        ,                                        --Item ID
            --'ABBY KITCHEN CURTAIN SET BEIGE/BURGUNDY',   --Item Description
                          'EA',                                         --UOM COde
    --        ,                                       --User
                               v_c,                           --Shipment Header ID
                          v_d,                                  --SHipment Line ID
    --        ,                                           --To Organization ID
                          'Brooklyn',                           --Sub Inventory ID
    --        ,                                            --From Organization
                          'Vessel',                            --From Subinventory
                          SYSDATE,                         --Expected Receipt Date
                                  SYSDATE,                          --Shipped Date
                                          'Y'                    --Validation Flag
          --END IF;
          END LOOP;
       END;
    END xxc_lc_rcv_interface_prc;
    there are many syntax errors i have corrected .
    Note : code is not compiled or tested .Thanks,
    P Prakash
    Edited by: prakash on Nov 21, 2011 4:00 AM

  • Error while opening cursor

    Hi ,
    In a procedure ,
    I have a cursor query which gets me the sum of a sum(to_number(field_value1) grouped on a list of other fields.The datatype of that field_value1 is varchar2
    It has been running fine till now.But somehow , some non-numeric characters have been entered into this field.
    As a result the query is failing.
    I want the value of the other field for which the query is failing.
    What happens is the open is successful(The sqlcode after open cursor is 0 , but actually the cursor%found is false)
    The program continues into the fetch loop and jumps to the exception handler where I get the correct error which is 1722 Invalid number.
    I am not in a position to get exactly for which row the fetch is failing.
    Also , we are dealing with a huge volume of data , approximately (10000000) after grouping , so can't think of ungrouping the query and checking the value explicitly.
    Please Help.
    Thanks.

    Hi,
    I have created a stored function for handling this issue.
    Just check this code i have written the value in a file.
    =======================================
    CREATE OR REPLACE FUNCTION Chk_Number(S VARCHAR2) RETURN NUMBER is
    J VARCHAR2(10);
    FP UTL_FILE.FILE_TYPE;
    BEGIN
    J:=to_NUMBER(S);
    RETURN J;
    exception
    WHEN VALUE_ERROR THEN
         FP := UTL_FILE.FOPEN('/tmp','tmpt0','w');
         UTL_FILE.PUT_LINE(FP,S);
         UTL_FILE.FCLOSE(FP);
         RETURN 0;
    END;
    =======================
    DECLARE
    CURSOR C1 is select sum(Chk_Number(no)) NO
    from abc;
    BEGIN
    FOR R1 in C1
    LOOP
    DBMS_OUTPUT.PUT_LINE(R1.NO);
    END LOOP;
    END;
    This is one of the way.
    vinod

  • Error : Maximum Open Cursors Exceded

    Hi!
    The error appear in that check out or check an objet using OSCM. At first I cna do it but when i trying to check in or out files the messages appear. I don´t understand why and for waht action it appear.
    Any suggestion??
    Thanks!
    Matias

    Did you increase the max open cursors to 3000 as recommended in the OracleSCM install guide?
    Rob

  • Error in prepare cursor stmt, when executed from a cgi called from web apln

    We are facing with the following error message:
    Error Prepare cursor SELECT message FROM OPS$SVEERAMA.ERRORCODE ORDER BY message; error code: 549755810774, offset: 180388626432
    549755810774 is the sqlca.sqlcode when printed as long and is -3114 (negative) when printed as int.
    We are trying to execute a cgi from the web application, the cgi in turn tries to connect to the oracle database. The cgi script, tries to establish an oracle connection, and tries to execute a prepare cursor statement.
    We are using oracle 10g and proc - Pro*C/C++: Release 10.1.0.5.0, on linux x86_64 machine. We have two sqlca.h header files, one which has the struct sqlca's variables defined as long and the other as int. we are using the int one.
    Any help is much appreciated. Also if you can let us know what are essential for establishing a db connectivity from a cgi script.(any env variables, etc)

    All oracle error messages are negative number.
    /home/oracle>oerr ora 3114
    03114, 00000, "not connected to ORACLE"
    // *Cause:
    // *Action:I suspect that you have not successfully established a connection to the database. Unfortunately, I don't actually know what you need for CGI. I would check for other errors in the portion of the code where you establish the connection.
    John

  • Getting error in a cursor

    12/1 error :sql statement ignored
    12/145 error: column not allowed here.
    15/1 error: sql statement ignored
    15/145 error: column not allowed here
    create or replace procedure pps is
    ccsal number;
    cursor comm is
    select salary+nvl(commission_pct,0)from employees;
    begin
    open comm;
    loop
    exit when comm%notfound;
    fetch comm into ccsal;
    if ccsal>=3000 then
    ccsal:=ccsal*10/100;
    insert into emp(employee_id,last_name,salary,commission_pct,totsal) values(employees.employee_id,employees.last_name,employees.salary,employees.commission_pct,ccsal);
    elsif ccsal between 10000 and 20000 then
    ccsal:=ccsal*5/100;
    insert into emp(employee_id,last_name,salary,commission_pct,totsal) values(employees.employee_id,employees.last_name,employees.salary,employees.commission_pct,ccsal);
    end if;
    end loop;
    close comm;
    end;
    /

    You try this and let me know if it helped you .. I have made some changes ..
    CREATE OR REPLACE PROCEDURE pps
    IS
    -- ccsal NUMBER;
    -- empid employees.employee_id%TYPE;
    -- lname employees.last_name%TYPE;
    -- sal employees.salary%TYPE;
    -- cpt employees.commission_pct%TYPE;
    BEGIN
    FOR i IN (SELECT employee_id, last_name, salary, commission_pct,
    salary + NVL (commission_pct, 0) ccsal
    FROM employees)
    LOOP
    IF i.ccsal >= 3000
    THEN
    i.ccsal := i.ccsal * 10 / 100;
    INSERT INTO emp
    (employee_id, last_name, salary,
    commission_pct, totsal
    VALUES (i.employee_id, i.last_name, i.salary,
    i.commission_pct, i.ccsal
    ELSIF i.ccsal BETWEEN 10000 AND 20000
    THEN
    i.ccsal := i.ccsal * 5 / 100;
    INSERT INTO emp
    (employee_id, last_name, salary,
    commission_pct, totsal
    VALUES (i.employee_id, i.last_name, i.salary,
    i.commission_pct, i.ccsal
    END IF;
    END LOOP;
    END;
    Regards..
    Edited by: 180589 on May 4, 2013 12:28 PM

  • Error in function cursor in report version 9.0.4.10

    I created a funtion with this cursor
    Cursor C2(c_leasecomp lease.leaseid%Type) is
    select distinct sorg.orgid department
    from space_lease sl,spaceorg sorg,org org,
    (select case when (select 1 from space_lease where UOM_STD_ID = 'METR_MTR' and rownum = 1) = 1 then 1
    when (select 2 from space_lease where UOM_STD_ID = 'ACRE' and rownum = 1) = 2 then 2
    else 3
    end case_col
    from dual) d1
    where sl.uom_std_id = decode(d1.case_col,1,'METR_MTR',
    2,'ACRE',
    3,'PARK',
    null)
    and sl.leaseid = c_leasecomp
    and sl.bldgid = sorg.bldgid
    and sl.FLRID = sorg.FLRID
    and sl.spid = sorg.SPID
    and sorg.orgid = org.orgid
    and ( org.ORGCLASS = 'ABC'
    or org.ORGCLASS = 'GD'
    or sorg.orgid IN (select orgid from cst_spaceorg_exception))
    order by sl.leaseid;
    But am having the error below
    Error 103 at line 12 , column 34
    (-+ Case mode not null others<an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance----
    I ran this as an anonymous function is Sql and it worked. Is this the report engine thing or am doing something wrong. The Database is 10g

    Duplicate Report9i not generating more then 50852 pages in PDF format
    Regards,
    Martin Malmström

  • Error in dynamic cursor::

    hi experts
    please help me for this error
    In this code the cursor conditions are not appending to the query
    so when i am executing the result it is displaying the error
    can you help me on this
    SQL> CREATE OR REPLACE PROCEDURE test_dynamic_detailed_rpt (
      2     v_typ             IN       VARCHAR2,
      3     v_initiator   IN       VARCHAR2,
      4     p_rc                  OUT      sys_refcursor
      5  )
      6  IS
      7     v_sql   VARCHAR2(32767);
      8  BEGIN
      9     v_sql := 'SELECT  COUNT(*) FROM  txnlg tl WHERE ';
    10
    11      v_sql := v_sql||'tl.typ = ''1''';
    12
    13
    14           FOR j IN (SELECT tc.tgid, tc.tranid, tc.reqtype
    15                       FROM txnccde tc
    16                      WHERE tc.actstatus = 'Y'
    17                        AND tc.txndesc = v_typ)
    18           LOOP
    19              IF LENGTH (j.tgid) < 4
    20              THEN
    21                 v_sql := v_sql || ' OR ''UP''||J.tgid';
    22                 --'''|| v_typ|| ''')';
    23              ELSE
    24                 v_sql := v_sql || ' OR   J.tgid';
    25              END IF;
    26           END LOOP;
    27
    28     DBMS_OUTPUT.PUT_LINE(v_sql);
    29  END;
    30  /
    Procedure created.
    SQL>
    SQL> set serveroutput on;
    SQL>
    SQL> Var  p_rc refcursor;
    SQL>
    SQL> BEGIN
      2  test_dynamic_detailed_rpt('ALL','C',:p_rc);
      3  END;
      4  /
    SELECT  COUNT(*) FROM  txnlg tl WHERE tl.typ = '1'
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print p_rc;
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "p_rc"
    SQL>

    980560 wrote:
    I have coded that cursor . but the following error is occuring while
    executing the cursor .please help me to resolve this .
    CREATE OR REPLACE PROCEDURE test_dynamic_detailed_rpt (
    v_typ IN VARCHAR2,
    v_initiator IN VARCHAR2,
    p_rc OUT sys_refcursor
    IS
    v_sql VARCHAR2 (32767);
    BEGIN
    v_sql := 'SELECT COUNT(*) FROM txnlg tl WHERE ';
    v_sql := v_sql || 'tl.typ = ''1''';
    FOR j IN (SELECT tc.tgid, tc.tranid, tc.reqtype
    FROM txnccde tc
    WHERE tc.actstatus = 'Y')
    LOOP
    IF LENGTH (j.tagid) < 4
    THEN
    v_sql :=
    v_sql || ' OR ' || 'tl.txntype =' ||''''|| 'AP' ||j.tgid
    || '''';
    ELSE
    v_sql := v_sql || 'OR ' || 'tl.txntype =' ||''''||j.tgid||'''';
    END IF;
    END LOOP;
    DBMS_OUTPUT.put_line (v_sql);
    OPEN p_rc FOR v_sql;
    END;
    Procedure created.
    SQL>
    SQL> set serveroutput on;
    SQL>
    SQL> Var p_rc refcursor;
    SQL>
    SQL> BEGIN
    2 test_dynamic_detailed_rpt('ALL','C',:p_rc);
    3 END;
    4 /
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at P_DETAILED_REPRT, line 226
    ORA-06512: at line 2
    That error does not relate to the code you've posted. P_DETAILED_REPORT is not the name of your procedure.
    Please post the error you get from running the code shown. I suspect you are trying to build an SQL statement that is too large for the v_sql variable, but we don't have your data to be able to tell.
    I'll repeat what I said earlier:
    Perhaps if you posted some examples of your tables and data, and explained what output you are trying to get, we could help you to write it as a static SQL instead.Read this: {message:id=9360002}
    You'll find that the people who get the quickest answers around here are the ones who ask their questions properly with sufficient information and example data. If you keep people guessing what you want, then they often tend to get bored and go elsewhere.... so the choice is yours... help us to help you.

  • Error wrt Ref Cursor.

    Hi all,
    I have a package, and I am using the ref Cursor in my procedure. Here it is .....
    CREATE OR REPLACE PACKAGE BLABLA_PKG AS
    TYPE OUT_CURSOR IS REF CURSOR;
    PROCEDURE BLABLA_VIEW_PROCEDURE (BUS_ID IN VARCHAR2,
    XML_OUTPUT_CURSOR OUT OUT_CURSOR);
    END BLABLA_PKG;
    CREATE OR REPLACE PACKAGE BODY BLABLA_PKG AS
    PROCEDURE BLABLA_VIEW_PROCEDURE (BUS_ID IN VARCHAR2,
    XML_OUTPUT_CURSOR OUT OUT_CURSOR)
    IS
    V_CURSOR OUT_CURSOR;
    BEGIN
    OPEN V_CURSOR FOR
    SELECT SYS.XMLTYPE.getClobVal(OBJECT_VALUE)
    FROM MBR_VIEW
    WHERE extractValue(OBJECT_VALUE, '/BLABLA_TYPE/BUS/BUS_ID') = 456451232;
    END V_CURSOR;
    END BLABLA_PKG;
    WHEN I try to run the procedure its throwing an error as...
    Error(12,9): PLS-00113: END identifier 'V_CURSOR' must match BLABLA_VIEW_PROCEDURE' at line 2, column 16
    Can anyone help me out from this please??

    Thank you Bakker and sorry for my ignorance.
    And I have modified my packagage and compiled. Now i would like to execute the package. How would i do that?
    CREATE OR REPLACE PACKAGE BLABLA_PKG AS
    PROCEDURE BLABLA_VIEW_PROCEDURE (BLABLA_XML_RS OUT SYS_REFCURSOR, BUS_ID IN VARCHAR2
    END BLABLA_PKG;
    CREATE OR REPLACE PACKAGE BODY BLABLA_PKG AS
    PROCEDURE BLABLA_VIEW_PROCEDURE (BLABLA_XML_RS OUT SYS_REFCURSOR, BUS_ID IN VARCHAR2
    IS
    BEGIN
    OPEN BLABLA_XML_RS FOR
    SELECT SYS.XMLTYPE.getClobVal(OBJECT_VALUE)
    FROM BLABLA_VIEW
    WHERE extractValue(OBJECT_VALUE, '/BLABLA_TYPE/BUS/BUS_ID') = BUS_ID;
    END BLABLA_VIEW_PROCEDURE;
    END BLABLA_PKG;
    I am trying to execute it in the fallowing way, which is not working
    Execute BLABLA_PKG.BLABLA_VIEW_PROCEDURE(1111222, BLABLA_XML_RS);
    Could you please help me out....

  • Error retrieving REF CURSOR

    Hi,
    I have a problem retrieving a ResultSet from a REF CURSOR. I am using and OCI driver and Oracle 9i.
    Mi Code is like this:
    public static void main(String[] args) throws ClassNotFoundException,
    SQLException {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection(
    "jdbc:oracle:oci:@XXXXX", "login", "password");
    CallableStatement cs = conn.prepareCall("{?=call package.name(P_CODIGO => ?)}");
    cs.registerOutParameter(1,OracleTypes.CURSOR);
    cs.setInt(2,16782);
    cs.executeQuery();
    ResultSet result = ((OracleCallableStatement)cs).getCursor(1);
    result.next();
    ResultSetMetaData rsmd = result.getMetaData();
    for(int i = 0; i < rsmd.getColumnCount();i++){
    System.out.println(rsmd.getColumnName(i) + ": " + (result.getObject(i)).toString());
    cs.close();
    conn.close();
    Whe I try to get the ResultSet:
    ResultSet result = ((OracleCallableStatement)cs).getCursor(1);
    I receive an error like this:
    java.lang.UnsatisfiedLinkError: make_statement
         at oracle.jdbc.oci8.OCIDBAccess.make_statement(Native Method)
         at oracle.jdbc.oci8.OCIDBAccess.RefCursorBytesToDBStatement(OCIDBAccess.java:2401)
         at oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:3865)
         at oracle.jdbc.driver.OracleCallableStatement.getCursor(OracleCallableStatement.java:793)
         at pruebas.Callable.main(Callable.java:44)
    Exception in thread "main"
    In the web I found some examples but using a thin driver. In my case I must use the OCI driver.
    If somebody have any idea about the cause of this problem, please, tell me.
    regards,
    Alvaro

    hi,
    Mine is a standalone class which just calls a stored procedure which returns a REF CURSOR. When i try using getObject() method, i am getting the same error. i understand this is more of a configuration issue rather than a code issue. i have also called some other procedures from my class, which do some updates, etc and which are working fine. The error is as follows:-
    Exception in thread "main" java.lang.UnsatisfiedLinkError: make_statement
    at oracle.jdbc.oci8.OCIDBAccess.make_statement(Native Method)
    at oracle.jdbc.oci8.OCIDBAccess.RefCursorBytesToDBStatement(OCIDBAccess.java:2419)
    at oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:3836)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6039)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:5827)
    at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:698)
    at com.fmr.fims.common.StagingDatabaseHandler.getBatchListForStatus(StagingDatabaseHandler.java:160)
    at com.fmr.fims.common.StagingDatabaseHandler.main(StagingDatabaseHandler.java:39)
    i am unable to get to any solution to this issue. Trying not to use ResulSet wont work because the cursor does have a variable number of records which need to be retrieved one by one.
    Somebody please help. This is urgent.
    My code snippet is :-
    Connection conn = getConnection();
    CallableStatement stmt = conn.prepareCall("{call FEBCHK_ACTIONS.SP_GET_FAILED_BATCH_DOCS(?)}");
    stmt.registerOutParameter(1,oracle.jdbc.OracleTypes.CURSOR);
    boolean exec = stmt.execute();
    if(exec){
    ResultSet rs = (ResultSet)stmt.getObject(1);
    while(rs.next()){.......
    The line
    ResultSet rs = (ResultSet)stmt.getObject(1);
    gives the error.

  • How to clear the run time error in ref cursor

    good morning every one,
    the code as follows
    create or replace
    procedure Country_sel(key in varchar2)
    as
    cc Res_RelcountryLan.countrycode%type;
    len Res_Language.langname_en%type;
    lid Res_Language.langid%type;
    ab Res_Language.Abrivation%type;
    type refcursorr is ref cursor;
    cur refcursorr;
    d_stmt varchar2(100);
    begin
    d_stmt := 'select RCL.countrycode,RL.langid,RL.langname_'||key||',
    RL.Abrivation from  Res_RelCountryLan RCL inner join Res_Language RL ON RCL.LangId = RL.LangId';
    open cur for d_stmt;
    loop
    fetch cur into cc,lid,len,ab;
    if cur%found then
    dbms_output.put_line(cc||lid||len||ab);
    else
    exit;
    end if;
    end loop;
    close cur;
    commit;
    end  Country_sel;when i am running this code im getting
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "RASOOL.COUNTRY_SEL", line 11
    ORA-06512: at line 6can you please help me in getting rid of this problem.
    thanking you,
    prakash

    d_stmt varchar2(100); Increase the size of d_stmt. Your a assigning a larger string
    d_stmt := 'select RCL.countrycode,RL.langid,RL.langname_'||key||',RL.Abrivation from  Res_RelCountryLan RCL inner join Res_Language RL ON RCL.LangId = RL.LangId'; The size of the above string is more than 100 characters.

  • Getting errors in  a cursor

    The errors are:
    7/1- sql statement ignored
    7/6 item c11 is not a cursor
    15/1 : statement ignored
    15/11:cursor attribute not applied to non-cursor 'c22'
    requirement: i have to retrieve the top 3 salaries into one table and bottom two salaries into another table
    create or replace procedure eds is
    cursor c1 is select e.last_name,e.salary from employees e where 3>(select count(*) from employees where e.salary<salary);
    cursor c2 is select e.last_name,e.salary from employees e where 3>(select count(*) from employees where e.salary>salary);
    c11 c1%rowtype;
    c22 c2%rowtype;
    begin
    open c11;
    loop
    fetch c1 into c11;
    exit when c1%notfound;
    insert into empp(ename,salary) values(c11.last_name,c11.salary);
    open c2;
    loop
    fetch c2 into c22;
    exit when c22%notfound;
    insert into empp(ename,salary) values(c22.last_name,c22.salary);
    end loop;
    close c1;
    end loop;
    close c2;
    end;
    /

    Hi,
    your mixing up syntax. You have to open the cursors ( so the line : open c11; is wrong, should be changed to open c1; ) and also check the cursor for notfound ( so change c22%notfound into c2%notfound ). Total should probably look something like this to be able to compile :
    create or replace procedure eds is
    cursor c1 is select e.last_name,e.salary from employees e where 3>(select count(*) from employees where e.salary<salary);
    cursor c2 is select e.last_name,e.salary from employees e where 3>(select count(*) from employees where e.salary>salary);
    c11 c1%rowtype;
    c22 c2%rowtype;
    begin
    open c1;
    loop
    fetch c1 into c11;
    exit when c1%notfound;
    insert into empp(ename,salary) values(c11.last_name,c11.salary);
    open c2;
    loop
    fetch c2 into c22;
    exit when c2%notfound;
    insert into empp(ename,salary) values(c22.last_name,c22.salary);
    end loop;
    close c1;
    end loop;
    close c2;
    end;
    /Regards
    Bas

  • Error using XMLTYPE & Cursor

    Please help me on rectifying my query. this query returns
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.XMLTYPE", line 343
    ORA-06512: at line 1
                   SELECT          xmlelement("worflowAGMT",
                   XMLTYPE(CURSOR (SELECT
                                                 xmlelement("AGMT",
                                                           xmlelement("auditData"),                                        
                                                           xmlelement("AGMTID",h.AGMT_unq_id),
                                                                xmlelement("AGMTLevelValue", i.level_value),
                                                                xmlelement("AGMTSeqNbr", i.level_value),--not selected
                                                                xmlelement("nofication",
                                                                xmlelement("notificationId", i.notification_id),
                                                                     xmlelement("isNotifyInitiator", j.initiator_user_flag),
                                                                     xmlelement("isNotifyApprover", j.approver_user_flag),
                                                                     xmlelement("isNotifyReject", j.approver_user_flag),
                                                                     xmlelement("isNotifyCustomUsers", j.initiator_user_flag),
                                                                xmlelement("notifyCustomUsers",
                                                                     xmlelement("auditData"),
                                                                          xmlelement("notifyCustomId", k.notification_custom_id),
                                                                          xmlelement("role", xmlelement("roleId",k.role_id)),
                                                                          xmlelement("department", xmlelement("departmentId", k.department_id)),
                                                                          xmlelement("company", xmlelement("companyId", k.company_id)),
                                                                          xmlelement("division", xmlelement("divisionId", k.division_id))
                   FROM WORKFLOW_AGMT_TBL h,
                   AGMT_TBL i,
                   NOTIFC_TBL j,
                   NOTIFC_CUSTOMUSR_TBL k
                   WHERE h.workflow_unq_id = x.workflow_unq_id
                   AND h.AGMT_unq_id = i.AGMT_unq_id
                   AND i.notification_id = j.notification_id
                   AND j.notification_id = k.notification_id
                   )))--worflowAGMT                         
                   FROM WORKFLOW_TBL x, WF_WORKFLOW_TYPE y
                   WHERE y.workflow_type_id = x.workflow_type_id

    Hi,
    Most often, you get this type of error with CURSOR expression when it does not return any row, then the XMLType constructor fails.
    But it's hard to say here as you don't provide sample data.
    It looks like you want to aggregate rows coming from the CURSOR subquery. It's better to use XMLAgg function in this case.
    Something like :
    SELECT xmlelement("worflowAGMT",
            ( SELECT xmlagg(
                       xmlelement("AGMT",
    ...

  • Error on getting cursor in GenerateHead

    Dear All,
    There is a strange phenomenon in my OBIEE.
    I am using OBIEE 11.1.6.2 BP1, One Dashboard is created with several pages. On one of the page, when first visit, the following error returned
    Error
    View Display Error
    Error generating view. Error getting cursor in GenerateHead
    Error Details
    Error Codes: OAMP2OPY:ACIOA5LN
    Assertion failure: nExprs >= 2 at line 734 of C:\ADE\aime_1\bifndn\analytics_web\main/project/webreport/filterexprsqlvisitor.cpp
    When I switch to another page and back to this page again, all errors were gone...
    For the page found the above error code, there are 1 prompt with 3 reports
    There are 6 inputs in the prompt as
    Input 1: Char
    Input 2: Date
    Input 3: String (But this time NULL is selected as default)
    Input 4: String
    Input 5: String
    Input 6: Integer
    It is so strange.... Most appreciated if anyone can suggest the way to solve it.

    Even I'm facing the same issue in 11..1.1.7 version .
    And even more strange thing is that report are working fine in one env with same setup and in other it is throwing error .

Maybe you are looking for

  • 785GM-E65 and video out

    I am looking for an analog video out solution for this mobo. I bought a VGA to component video cable and that gets me an output with jiberish. I'm aiming for s-video or component. I read that some mobo's support s-video out through the VGA port. Does

  • MPEG-2 encoding problems

    I am having a problem with compressor and dvd studio pro, not really sure if it's one or the other. I have been exporting MPEG-2 through compressor straight from the timeline (I know compressor has problems using the QT Reference files) and although

  • SSD Utilities 2.00

    I'm trying to install the SSD Utility ver 2.00 released yesterday 3/26.  When I launch the exe it will give me and error (An error (-5001 : 0x80070002) has occured while running the setup).  I have tried it on two different laptops.  I have also trie

  • Forwarded meeting request shows as 'sent on behalf'

    When a user forwards a meeting request to someone else it shows as 'sent on behalf'. This means when the recipient replies it goes to the original meeting organizer. Is there any way to prevent this or is this by design? Can we disable it for certain

  • Queries for Lumia 820

    Dear all from where i can get angry birds FREE for Lumia 820 ?? Am i the only one who is facing problem using skype that there is no sign out option ? To send photos , music & videos first we have to turn on bluetooth in Lumia then we can send , is t