Numeric Precision Error

Hi,
I am using ODP 10.2.0.2.21 with c# and .Net 2.0 and Oracle 10g.
Most of my stored procedures output the results back to the caller in the form of a generic REF CURSOR. When I call OracleDataAdapter.Fill to populate a data-set using a call to one of these stored procedures, it works fine as long as the stored procedure returns data. If no rows are returned, I get the following error:
[Oracle.DataAccess.Types.OracleTypeException]: numeric precision specifier is out of range (1 to 38).
Looking up this error, I've found that it normally occurs as a result of an attempt to run some DDL SQL that creates a table with a numeric column whose precision exceeds the maximum allowable e.g. numeric(39). This is not the case here, as the stored procedures that are failing are mostly pure select statements and do not even utilise temporary tables or bulk collection. It is almost as if the OracleDataAdapter is unable to get the schema representation of the column when there is not at least one row of data.
I have pasted the full exception stack below:
at Oracle.DataAccess.Types.OracleDecimal.ConvertToPrecScale(OracleDecimal value1, Int32 precision, Int32 scale)
at Oracle.DataAccess.Client.OracleParameter.PreBind_Decimal()
at Oracle.DataAccess.Client.OracleParameter.PreBind(OracleConnection conn, IntPtr errCtx, Int32 arraySize)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
Any help on this would be appreciated.
Regards
Roy Griffiths.

Hi Mark,
It would be difficult to distill this down to a small enough example to post, but I could email you an example if you want.
I have done a bit more investigation however, and believe that I have found the cause of the problem.
My application obtains the parameters for any stored procedure that it calls using OracleCommandBuilder.DeriveParameters. As this is an expensive call (it requires a round trip to the database), I cache the output when a stored procedure is called for the first time. Specifically, I store a number of properties for each stored procedure parameter, including its precision and scale. I then use the cached properties to build the parameters collection on the command object when the stored procedure is called.
I've noticed that the OracleParameter.Precision and OracleParameter.Scale properties always return zero, regardless of the definition of the parameter on the stored procedure. I've also noticed that there are 2 private member variables (m_precision and m_scale) that contain non-zero values. If I use reflection to obtain and cache these values and use them to set the scale and precision of Command.Parameters[n] then the problem goes away.
I'm not particularly keen on this as a solution however, and would much rather use the public properties for precision and scale (OracleParameter.Precision and OracleParameter.Scale). Do you have any idea why they don't return values?
Regards
Roy.

Similar Messages

  • CR XI R2 Cannot find Nth root - "Numeric Overflow" Error

    In Crystal Reports Xi Release 2, when i try to perform a calculation within a formula  X ^ Y where  Y = 1/years  and Y < 1, I receive a "Numeric Overflow" error when running the report.   Is there anything that can be done to work around or fix this?
    Thanks.

    Hello Jay,
    I'm assuming you meant 0 < years < 1
    One limitation is that Crystal Reports uses IEEE double precision floating point representation for internal numerical computation.  This limits the maximum expressible numeric value to approximately 10 ^ 308.
    If computational results exceed this magnitude, the "Numeric Overflow" error will result.
    Sincerely,
    Ted Ueda

  • ORA-01727 during impdp transportable datafiles:numeric precision specifier

    I started impdp the rman converted the datafiles into tartget and got error on one of the table:
    ORA-01727: numeric precision specifier is out of range 1 to 38
    I tried to fix it by create the table definition by change several columns number (126) to number (38), it worked, and then I tried to impdp again with tables=tablename
    content=data_only, it give me error that the imp dump file is specific for transportable tablespace.
    I dont know how to fix this issue. Can anybody help on this?
    Thanks in advance.

    Here is the error after I created the table and then trying to import the data:
    impdp system/password dumpfile=dp_tts.dmp table_exists_action=APPEND tables=asset.customer_ticket content=data_only;
    Import: Release 11.2.0.3.0 - Production on Mon May 6 01:01:41 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, Automatic Storage Management, OLAP, Data Mining
    and Real Application Testing options
    ORA-39002: invalid operation
    ORA-39061: import mode TABLE conflicts with export mode TRANSPORTABLE

  • ORA-30352: inconsistent numeric precision or string length

    Trying to create a materialized view and am getting this error.
    ORA-30352: inconsistent numeric precision or string length
    How do I fix this?

    Mix and matching of types with my facts and dimensions. Making them the same resolved this.
    Edited by: user7853353 on Jun 18, 2012 5:33 PM

  • Demonstrating numerical precision

    I'm running a workshop teaching high school students to use Labview.  For a lot of these kids, this will be the first time they use the program.  One of my favorite programming topics is understanding numerical precision and how important it is to a computer (signed vs. unsigned, integer vs. floating, 8-bit vs. 64-bit, etc).
    I'm trying to come up with some simple demonstrations in Labview to drive the point home.  Ideally, I'd assign an seemingly simple math problem to solve.  Maybe something they could do fairly easily in their head or on a calculator.  But when they program it in Labview, it comes up with a completely wrong answer because they didn't properly account for precision.
    For example, starting with a U8 integer equal to 1.  Double the number eight times in a loop.  If I ask them to predict the answer, they'll probably say "256".  But, of course, the program will come back with "0" which will force them to think why and figure it out.
    I'd welcome any clever suggestions to throw at the kids.  Nothing too complicated - I want them to be able to program it themselves after a introductory lesson on using Labview.  But something that will shock them a little and help wrap their heads around the concepts.
    Thanks!

    Definately make sure they understand that floats are not exact and test for equality just doesn't work!  I'm tired of debugging those kind of errors.  Rollover errrors is the other really common numerical error I see.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • - ORA-01727: numeric precision specifier is out of range (1 to 38)

    What is cause of above error??
    SQL> SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'my_sql_tuning_task_1') from DUAL;
    DBMS_SQLTUNE.REPORT_TUNING_TASK('MY_SQL_TUNING_TASK_1')
    GENERAL INFORMATION SECTION
    Tuning Task Name : my_sql_tuning_task_1
    Tuning Task Owner : SYS
    Workload Type : Single SQL Statement
    Scope : COMPREHENSIVE
    Time Limit(seconds): 3600
    Completion Status : COMPLETED
    Started at : 09/27/2012 13:24:45
    Completed at : 09/27/2012 13:24:45
    Schema Name: PDS
    SQL ID : 4wv8x1b10dvk0
    SQL Text : INSERT INTO dlg_participant
    (dp_dg_id, dp_dlg_id, dp_customer_id, dp_context,
    dp_inserted_timestamp, dp_moved_timestamp, dp_active,
    dp_internal_id)
    (SELECT
    cast(:1 as number(:"SYS_B_0")),
    cast(:2 as number(:"SYS_B_1")),
    mh_customer_id,
    mh_context,
    SYSDATE,
    SYSDATE,
    cast(:3 as number(:"SYS_B_2")),
    cast(:4 as number(:"SYS_B_3"))
    FROM
    (SELECT
    Relations.MARE_ID as mh_customer_id,
    :"SYS_B_4" as mh_context,
    null as mh_participant_id
    FROM
    (select *
    from Testuser.RelationsEnriched_10M
    ) Relations
    WHERE
    ((:5 >= Relations.MARE_ID))) AND
    NOT EXISTS (SELECT
    dp_id
    FROM
    dlg_participant,
    dlg_group
    WHERE
    (dp_dg_id = dg_id) AND
    (dg_dlg_id = :6) AND
    (dp_active = :7) AND
    (dp_customer_id = Relations.MARE_ID))) mh_container)
    Bind Variables :
    2 - (NUMBER):9
    4 - (NUMBER):9
    6 - (NUMBER):18
    8 - (NUMBER):18
    10 - (NUMBER):1500000
    11 - (NUMBER):1053
    12 - (NUMBER):0
    ERRORS SECTION
    - ORA-01727: numeric precision specifier is out of range (1 to 38)
    -------------------------------------------------------------------------------

    Strange as none of the number datatype is more than 38
    SQL> desc testuser.relationsenriched_10m
    Name Null? Type
    MAEX_VALUE_CODE_002 NUMBER(38)
    MAEX_PHONE_IND_DATE DATE
    MAEX_TOTAL_SWITCH_DATE DATE
    MAEX_VALUE_CODE_002_DATE DATE
    MARE_COMP_FS_PC VARCHAR2(199)
    MARE_DEALER_RETAIL VARCHAR2(7)
    MARE_CONSODATA_IND VARCHAR2(2)
    MAEX_VALUE_CODE_003 NUMBER(38)
    MARE_EXT_KEY1_NR VARCHAR2(199)
    MARE_GM_CARD_CODE VARCHAR2(199)
    MAEX_LAST_CHANGE_DATE DATE
    MAAD_MARE_ID NUMBER(38)
    MAEX_MAIL_IND_DATE DATE
    MARE_PERS_TITLE VARCHAR2(6)
    MARE_EXT_KEY3_NR VARCHAR2(199)
    MARE_BSM_DATE VARCHAR2(199)
    MARE_ID NUMBER(38)
    MARE_GM_CARD_STATUS VARCHAR2(199)
    MAAD_PREFERED_IND VARCHAR2(2)
    MAEX_SMS_IND_DATE DATE
    MARE_RELATED_CODE VARCHAR2(199)
    MARE_FAX FLOAT(126)
    MACA_MARE_ID NUMBER(38)
    MACA_REGDATE_OWNER_YEAR NUMBER(38)
    MAEX_EMAIL_IND_DATE DATE
    MAEX_MAILABLE_IND6 VARCHAR2(2)
    MARE_PERS_LAST_NAME VARCHAR2(42)
    MARE_PERS_SALUTATION VARCHAR2(9)
    MARE_PERS_FIRST_NAMES VARCHAR2(51)
    MARE_SUB_TYPE VARCHAR2(2)
    MACA_PREFERED_IND VARCHAR2(2)
    MAEX_CONTROL_GROUP_DATE DATE
    MARE_MOBILE_PHONE VARCHAR2(21)
    MARE_COMP_ID NUMBER(38)
    MARE_EXT_KEY1_CHAR VARCHAR2(16)
    MARE_FIRST_CONTACT_DATE DATE
    MARE_MOI1_DESCR VARCHAR2(21)
    MAEX_MAILABLE_IND9 VARCHAR2(2)
    MARE_MOI1 VARCHAR2(11)
    MARE_MAAD_ID_T NUMBER(38)
    MARE_COMP_SIZE_CAT NUMBER(38)
    MAEX_SMS_IND VARCHAR2(2)
    MARE_PERS_LAST_NAME_SECOND VARCHAR2(15)
    MAEX_VALUE_CODE_001_DATE DATE
    MARE_ORDER_T NUMBER(38)
    MARE_BSM_IND VARCHAR2(2)
    MACA_BRAND VARCHAR2(12)
    MACA_DEALER_RETAIL VARCHAR2(7)
    MARE_HOME_PHONE VARCHAR2(21)
    MAEX_MAIL_IND VARCHAR2(2)
    MARE_PERS_BIRTH_DATE DATE
    MARE_CNSMR_TYPE VARCHAR2(2)
    MAEX_MAILABLE_IND5 VARCHAR2(2)
    MARE_PERS_AGE NUMBER(38)
    MAEX_MAILABLE_IND1 VARCHAR2(2)
    MARE_INSRC_RNWL_DATE DATE
    MACA_NEW_USED VARCHAR2(5)
    MARE_LOAD_DATE DATE
    MARE_PERS_MAR_STATUS VARCHAR2(199)
    MARE_PERS_PREFIX VARCHAR2(7)
    MARE_COMP_SIZE NUMBER(38)
    MAEX_VALUE_CODE_100_DATE DATE
    MARE_HISTORY_FILE VARCHAR2(26)
    MARE_COMP_NAME VARCHAR2(108)
    MARE_IDX_T VARCHAR2(51)
    MARE_DEALER_RETAIL_NAME VARCHAR2(41)
    MACA_OWNER_TYPE VARCHAR2(2)
    MARE_CREATION_DATE DATE
    MARE_MACA_ID_T NUMBER(38)
    MARE_EXT_KEY3_CHAR VARCHAR2(199)
    MAAD_POSTAL_CODE VARCHAR2(8)
    MAEX_MARE_ID NUMBER(38)
    MARE_CNSMR_TYPE_CODE NUMBER(38)
    MARE_SOURCE VARCHAR2(5)
    MARE_LAST_CONTACT_DATE DATE
    MARE_EXT_KEY2_CHAR VARCHAR2(199)
    MAEX_ID NUMBER(38)
    MAEX_TOTAL_SWITCH VARCHAR2(2)
    MARE_EMAIL VARCHAR2(53)
    MARE_DEALER_SERV_NAME VARCHAR2(41)
    MARE_WORK_PHONE VARCHAR2(21)
    MAEX_VALUE_CODE_100 NUMBER(38)
    MAEX_PHONE_IND VARCHAR2(2)
    MARE_AERD VARCHAR2(199)
    MARE_SPS_FILE_ID NUMBER(38)
    MAEX_LOAD_DATE DATE
    MARE_MOI5 VARCHAR2(11)
    MAEX_MAILABLE_IND7 VARCHAR2(2)
    MAEX_VALUE_CODE_001 NUMBER(38)
    MARE_COMP_NAME_2 VARCHAR2(172)
    MARE_SOFI_NR VARCHAR2(17)
    MARE_COMP_CODE VARCHAR2(199)
    MARE_COMP_FS_CC VARCHAR2(199)
    MAEX_MAILABLE_IND4 VARCHAR2(2)
    MARE_DEALER_PREF VARCHAR2(7)
    MARE_LANG_CODE VARCHAR2(3)
    MACA_REGDATE_CAR_YEAR NUMBER(38)
    MARE_PERS_INITIALS VARCHAR2(7)
    MARE_DEAR_SALUTATION VARCHAR2(50)
    MAEX_MAILABLE_IND8 VARCHAR2(2)
    MAEX_TITLE_IND VARCHAR2(2)
    MARE_MATCHING_IDX VARCHAR2(199)
    MARE_MOI3 VARCHAR2(11)
    MARE_DEALER_PREF_NAME VARCHAR2(2)
    MARE_ENVELOPE_NAME VARCHAR2(199)
    MARE_PERS_CHILD_UNDER_18 VARCHAR2(199)
    MARE_MOI2 VARCHAR2(11)
    MARE_RELATED_DESCR VARCHAR2(199)
    MARE_EXT_KEY2_NR VARCHAR2(199)
    MARE_PERS_GENDER VARCHAR2(2)
    MACA_MODEL VARCHAR2(16)
    MARE_PERS_HH_SIZE VARCHAR2(199)
    MAEX_TITLE_IND_DATE DATE
    MARE_LAST_CHANGE_DATE DATE
    MARE_MOI4 VARCHAR2(11)
    MAEX_MAILABLE_IND2 VARCHAR2(2)
    MARE_DEALER_SERV VARCHAR2(7)
    MAEX_VALUE_CODES VARCHAR2(25)
    MARE_NAME_T VARCHAR2(51)
    MAEX_VALUE_CODE_003_DATE DATE
    MARE_PERS_HH_CARS VARCHAR2(199)
    MAEX_MAILABLE_IND3 VARCHAR2(2)
    MARE_ERD NUMBER(38)
    MAEX_CREATION_DATE DATE
    MARE_IERD VARCHAR2(199)
    MAEX_CONTROL_GROUP NUMBER(38)
    MAEX_EMAIL_IND VARCHAR2(2)
    MARE_COMP_FS_TOT VARCHAR2(199)
    MARE_RELT_ID NUMBER(38)
    MARE_PERS_ID NUMBER(38)
    SQL> desc pds.dlg_participant
    Name Null? Type
    DP_ID NOT NULL NUMBER(18)
    DP_DG_ID NOT NULL NUMBER(9)
    DP_DLG_ID NOT NULL NUMBER(9)
    DP_CUSTOMER_ID NOT NULL NUMBER(38)
    DP_CONTEXT NOT NULL NVARCHAR2(128)
    DP_INSERTED_TIMESTAMP NOT NULL DATE
    DP_MOVED_TIMESTAMP NOT NULL DATE
    DP_PART_STAMP NVARCHAR2(3)
    DP_ACTIVE NOT NULL NUMBER(18)
    DP_INTERNAL_ID NUMBER(18)
    DP_CUSTOM_VALUES NCLOB

  • Numeric overflow error in aggregation level formula

    The formula for Revenue/Quantity is giving me the following error:
    Error: [314]: numeric overflow: search table error:  [6944] AttributeEngine: overflow in numeric calculation;Error executing physical plan: exception 6944: AttributeEngine/Parallel/Aggregation.cpp:573 AttributeEngine: overflow in numeric calculation; $function$=read; $message$=unable to read measures RAOL01:_SYS_CE__popid_24_531C272BF80A349FE10000007F000002_558972en TEST_Revenue fixed16.12 ,in executor::Executor in cube: RAOL01:_SYS_CE_$REQUEST$_popid_24_531C272BF80A349FE10000007F000002_558973: calcEngine search on olapIndex failed.
    I am aware that if Quantity is zero then we get this error, but I have already handled it and Quantity is never zero.
    Both the measures are Decimal, any suggestions as to how to handle this?

    My first guess you have reached the upper limit of the datatype on concerned column and the AttributeEngine is not capable now to handle the numeric overflow, hence throwing the error message.
    Try converting it to higher datatypes like double, you can also try to do an workaround with datatype conversion functions like TO_DOUBLE before aggregation func.
    If you are using something like sum("COL1") try using sum(TO_DOUBLE("COL1"))

  • DBMS_LOB.LOADFROMFILE causes numeric value error

    The code below causes a numeric value error when I do LOADFROMFILE. Do you have any suggestions. Thanks.
    declare
    locator bfile;
    cloblocator clob;
    buffer varchar2(1000);
    lsize integer := 0;
    amount INTEGER := 1000;
    v_filename varchar(50) := 'notify_offer_tbl';
    begin
    locator := bfilename('IDEA_DATA_DIR','notify_offer_tbl');
    insert into imsa.t_unix_logs values ('notify_offer_tbl', locator, empty_clob());
    Select fileloclob into cloblocator from imsa.t_unix_logs where filename ='notify_offer_tbl' for update;
    if dbms_lob.fileexists(locator) = 1 then
    dbms_output.put_line('Exists');
    if dbms_lob.fileisopen(locator) = 1 then
    dbms_output.put_line('open');
    else
    dbms_output.put_line('close');
    dbms_lob.fileopen(locator, DBMS_LOB.FILE_READONLY);
    lsize := dbms_lob.getlength(locator);
    dbms_output.put_line('File Length: ' || to_char(lsize));
    DBMS_LOB.LOADFROMFILE(cloblocator, locator, lsize);
    commit;
    end if;
    end if;
    DBMS_LOB.READ(cloblocator, amount, 1, buffer);
    dbms_output.put_line('File ' || buffer);
    DBMS_LOB.FILECLOSE(locator);
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error -- ' || SUBSTR(sqlerrm, 1, 200));
    DBMS_LOB.FILECLOSE(locator);

    Yes. The column clobcol (in the SELECT in your example) should be set to empty_clob() or already contain a CLOB, before selecting the column value into the local variable. The example in the DBMS_LOB documentation page is misleading as it does not mention this.
    Note also that it is best to use dbms_lob.getlength to establish the value for
    the amount parameter.
    Hope this helps others searching for information on this - I have spent some painful hours working this out!
    Peter

  • Numeric Overflow error on NPer function

    I am trying to use this NPer function and it's acting real weird. If I use the same numbers that my database fields hold, it works and when I switch to database fields it works fine one time and next time I try to refresh data, it gives me this "numeric overflow" error..
    In Crystal help example, they shows that the payment has to be a negative number. So I am following that. If i switch it to the positive number, then it works bit it gives me negative # of months plus it's wrong number.
    Not sure whats going on and would really appreciate any help...
    Thanks
    Raj

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with your directly

  • Numeric overflow error using binary integer

    Hi experts,
    I am facing issue while solving a numeric overflow error. after analyzing we came to know that in the below code BINARY_INTEGER is causing the issue as input is exceeding its range. I tried to replace BINARY_INTEGER by varchar2(20) but its saying
    "Error(580,20): PLS-00657: Implementation restriction: bulk SQL with associative arrays with VARCHAR2 key is not supported."
    We need to remove this binary_integer. I dont know how to do this. Can anybody give some idea or what code change required here ? thanks in advance. Cheers.. Below is the code,
    ===================================================
       PROCEDURE UpdateCost_
          p_Cost_typ IN OUT NOCOPY CM_t,
       IS
          TYPE ObjektIdTab_itabt IS TABLE OF ObjektId_tabt INDEX BY BINARY_INTEGER;
          v_cost_IdTab_itab ObjektIdTab_itabt;
          v_CM_ID INTEGER := p_Cost_typ.costm.CM_ID;
          BEGIN
                SELECT CAST(MULTISET
                        (SELECT Costwps.CMKostId
                          FROM CM_Pos_r NRPos,
                                CMK_z_r costzpps,
                                CMG_Cost_v Costwps
                          WHERE NRPos.CM_ID = v_CM_ID
                            AND NRPos.SNRId_G = SNRCT.SNRPos.SNRId_G
                            AND costzpps.CM_ID = NRPos.CM_ID
                            AND costzpps.CMSNRPosId = NRPos.CMSNRPosId
                            AND costzpps.Kost_s = Kost.Costnzl.Kost_s
                            AND Costwps.CMKz_Id = costzpps.CMKz_Id
                            AND Costwps.TypCode NOT IN
                                (SELECT kw.TypCode
                                   FROM TABLE(Kost.Kostwt_tab) kw
                        ) AS ObjektId_tabt )
                  BULK COLLECT
                  INTO v_cost_IdTab_itab
                  FROM TABLE(p_Cost_typ.SNR_tab) SNRCT,
                       TABLE(SNRCT.Kost_tab) Kost
             FOR v_i IN 1 .. v_cost_IdTab_itab.COUNT LOOP
                FOR v_j IN 1 .. v_cost_IdTab_itab(v_i).COUNT LOOP
                   DELETE FROM CMG_Cost_v WHERE CMKostId = v_cost_IdTab_itab(v_i)(v_j);
                END LOOP;
             END LOOP;
    END;
    ===================================================

    Thanks for your reply. I tried with INDEX by NUMBER. but oracle says its not a valid use of index by thing. and moreover I also tried with by removing INDEX BY clause. but in that case we are not at all getting any data in for loop. some people says to use extend clause. But again I am not sure How to do so. Can you please let me know code for this.
    I know you are trying to help by you need to STOP telling us what problem you have and SHOW US. Saying 'Oracle says' is useless. Post EXACTLY what code you are using, the EXACT steps you are using to compile that code and the EXACT result that you are getting.
    You also made no comment about the 'overflow' issue. A BINARY_INTEGER (PLS_INTEGER) has a very large range of values:
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/datatypes.htm#i10726
    >
    The PLS_INTEGER data type stores signed integers in the range -2,147,483,648 through 2,147,483,647, represented in 32 bits.
    >
    If you are trying to create a collection of more than 2 BILLION of anything you have a serious problem with either WHAT you are trying to do or HOW you are trying to do it. Your 'overflow' issue is more likely a symptom that you are really running out of memory. You should ALWAYS have a LIMIT clause when you do BULK COLLECT statements.
    Also see this section in that doc: SIMPLE_INTEGER Subtype of PLS_INTEGER
    You need to address your LIMIT issue first and then address any other issues that arise from actually executing the code.
    Then see the section 'SELECT INTO Statement with BULK COLLECT Clause' in that doc
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/tuning.htm#BABEIACI
    That section has an example that shows you do NOT need to use an INDEX BY clause to create collections as you are trying to do. So your not 'getting any data in for loop' is NOT related to the lack of that clause.
    That example also shows you that you do NOT use 'extends' when doing BULK COLLECT. The bulk collection automatically extends the collection as needed to hold the entire results (assuming you don't run out of memory for 2 BILLION things).
    Example 12-22 in that same doc shows the proper way to use a double loop and a BULK COLLECT with a LIMIT clause
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/tuning.htm#BABCCJCB
    Here is very simple sample code you can use in the SCOTT schema to understand how the double loop and LIMIT clauses work together.
    >
    The FETCH does a BULK COLLECT of all data into 'v'. It will either get all the data or none if there isn't any.
    The LOOP construct would be used when you have a LIMIT clause so that Oracle would 'loop' back to
    get the next set of records. Run this example in the SCOTT schema and you will see how the LIMIT clause works.
    I have 14 records in my EMP table.
    DECLARE
      CURSOR c1 IS (SELECT * FROM emp);
      TYPE typ_tbl IS TABLE OF c1%rowtype;
      v typ_tbl;
    BEGIN
      OPEN c1;
      LOOP                                                 --Loop added
        FETCH c1 BULK COLLECT INTO v LIMIT 3; -- process 3 records at a time
            -- process the first 3 max records
           DBMS_OUTPUT.PUT_LINE('Processing ' || v.COUNT || ' records.');
            FOR i IN v.first..v.last LOOP
                DBMS_OUTPUT.PUT_LINE(v(i).empno);
            END LOOP; 
        EXIT WHEN c1%NOTFOUND;
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('All done');
    END;
    In the FOR loop you would do any processing of the nested table you want to do
    and could use a FORALL to do an INSERT into another table.
    >
    I strongly suggest that you modify your code to work with a VERY SMALL set of data until it works properly. Then expand it to work with all of the data needed, preferably by using an appropriate LIMIT clause of no more than 1000.

  • Numeric Value error 1426

    Hi,
    How to retrive the value of below query.
    I am encountered with numeric value error.
    select power(10,333333333333) from dual;Thanks in advance

    You did look up the error in the online documentation?
    Why not?
    If you would have done so you would have gotten
    Cause: Evaluation of an value expression causes an overflow/underflow.
    Action: Reduce the operands.
    Looks clear to me.
    Looks like you should have done this first in order to avoid redundant questions.
    Sybrand Bakker
    Senior Oracle DBA
    Edited by: sybrand_b on 25-jun-2009 2:49

  • Serious Problem In Oracle9i regarding numerical value error.

    Dear Experts,
    The below code gives numerical value error where cursor is fetching data(in the 'for' line).
    But the cursor's query is executing properly in a SQL window.
    Version is Oracle9i Release 9.2.0.1.0 - Production
    PL/SQL Release 9.2.0.1.0 - Production
    Database Server created in Windows platform.
    Code------
    CREATE OR REPLACE Procedure INTGD.Ge_b_p_Test_Decode As
    Cursor c_Decode Is
    select decode(txt_party_sex,'M','MALE','FEMALE') Txt_Refund_Type
    from ge_b_motor_pool_policy_details
    Union
    Select 'P' From Gen_Proposal;
    lv_refund_type varchar2(10);
    l_Error_Msg Varchar2(500);
    Begin
    For i In c_Decode Loop
    Begin
    lv_refund_type := i.Txt_Refund_Type;
    Insert Into Ge_b_Test_Decode Values (lv_refund_type);
    Commit;
    Exception
    When Others Then
    l_Error_Msg := Substr(Sqlerrm, 1, 500);
    Dbms_Output.Put_Line(l_Error_Msg);
    End;
    End Loop;
    End;
    Please help ASAP.
    Regards,
    jishnu

    Dear Experts
    CREATE TABLE GE_B_MOTOR_POOL_POLICY_DETAILS
    TXT_RO_CODE VARCHAR2(10 BYTE) NOT NULL,
    TXT_OO_CODE VARCHAR2(10 BYTE) NOT NULL,
    NUM_POLICY_NUMBER NUMBER(25),
    NUM_ENDORSEMENT_SRL_NO NUMBER(3),
    NUM_SCHEDULE_CERTIFICATE_NO NUMBER(5),
    TXT_ENDORSMENT_POLICY_NUMBER VARCHAR2(23 BYTE),
    NUM_REFERENCE_NUMBER NUMBER(14) NOT NULL,
    DAT_REFERENCE_DATE DATE NOT NULL,
    NUM_XML_JOB_NO NUMBER(20),
    TXT_PRE_CAL_BASIS VARCHAR2(20 BYTE),
    CUR_NET_TP_PREMIUM NUMBER(20),
    CUR_TOT_TP_PREMIUM NUMBER(20),
    CUR_TP_SERVICE_TAX NUMBER(20),
    DAT_POLICY_EXPIRE_DATE DATE,
    NUM_POL_TERM NUMBER(3),
    TXT_POL_TERM_UNIT CHAR(1 BYTE),
    TXT_PARTY_TYPE CHAR(1 BYTE),
    TXT_PARTY_CODE VARCHAR2(30 BYTE),
    TXT_PARTY_FIRSTNAME VARCHAR2(60 BYTE),
    TXT_PARTY_MIDDLENAME VARCHAR2(60 BYTE),
    TXT_PARTY_LASTNAME VARCHAR2(60 BYTE),
    TXT_PARTY_SEX CHAR(1 BYTE),
    DAT_POLICY_START_DATE DATE,
    TXT_PARTY_ADDR1 VARCHAR2(100 BYTE),
    TXT_PARTY_ADDR2 VARCHAR2(100 BYTE),
    TXT_PARTY_ADDR3 VARCHAR2(100 BYTE),
    NUM_PARTY_PINCODE NUMBER(6),
    TXT_PARTY_STAKE_CODE VARCHAR2(10 BYTE),
    CUR_PAYMENT NUMBER(10),
    TXT_POL_INDICATOR VARCHAR2(10 BYTE),
    TXT_MAIN_POL_TYPE VARCHAR2(10 BYTE),
    TXT_POLICY_CATEGORY_FLEET_SCHD CHAR(1 BYTE),
    DAT_VOUCHAR_DATE DATE,
    TXT_PAY_MODE VARCHAR2(10 BYTE),
    TXT_PARTY_NAME VARCHAR2(60 BYTE),
    CUR_VOUCHAR_AMOUNT NUMBER(20),
    TXT_VOUCHAR_NUMBER VARCHAR2(30 BYTE),
    TXT_INSTRUMENT_NUMBER VARCHAR2(20 BYTE),
    DAT_INSTRUMENT_DATE DATE,
    TXT_NARRATION VARCHAR2(100 BYTE),
    DAT_INTIMATION_DATE DATE,
    DAT_INCEPTION_DATE DATE,
    TXT_PRODUCT_CODE VARCHAR2(10 BYTE),
    TXT_POLICY_EVENT VARCHAR2(10 BYTE),
    TXT_NIL_ENDORSEMENT_INDICATOR CHAR(1 BYTE),
    TXT_ENDORSEMENT_TYPE VARCHAR2(23 BYTE),
    TXT_REFUND_TYPE VARCHAR2(23 BYTE),
    TXT_CANCELLATION_TYPE VARCHAR2(23 BYTE),
    TXT_MEMBER_CODE VARCHAR2(10 BYTE),
    TXT_EVENT_SEQ_NO VARCHAR2(10 BYTE),
    TXT_MEMBER_POLICY_NO VARCHAR2(42 BYTE),
    DAT_VEHICLE_PURCHASE DATE,
    TXT_VEHICLE_NEW_SECOND_HAND VARCHAR2(10 BYTE),
    TXT_VEHICLE_CATEGORY VARCHAR2(10 BYTE),
    TXT_VEHI_COMMERCIAL_PASSENGER VARCHAR2(10 BYTE),
    TXT_VEHI_REGISTRATION_NO_1 VARCHAR2(3 BYTE),
    TXT_VEHI_REGISTRATION_NO_2 VARCHAR2(3 BYTE),
    TXT_VEHI_REGISTRATION_NO_3 VARCHAR2(3 BYTE),
    TXT_VEHI_REGISTRATION_NO_4 VARCHAR2(4 BYTE),
    TXT_REGISTRATION_NO VARCHAR2(15 BYTE),
    DAT_VEHI_REGISTRATION_DATE DATE,
    TXT_VEHI_REG_AUTHORITY VARCHAR2(30 BYTE),
    NUM_VEHI_MANU_YEAR NUMBER(10),
    TXT_VEHI_ENGINE_NO VARCHAR2(30 BYTE),
    TXT_VEHI_CHASSIS_NO VARCHAR2(30 BYTE),
    TXT_MAKE_MODEL VARCHAR2(10 BYTE),
    NUM_GROSS_VEHICLE_WT NUMBER(15),
    NUM_SEATING_CAPACITY_CABIN NUMBER(3),
    TXT_VEHI_FULE_TYPE VARCHAR2(10 BYTE),
    TXT_LPG_CNG_KIT_IN_BUILT VARCHAR2(3 BYTE),
    TXT_TYPE_OF_PERMIT VARCHAR2(10 BYTE),
    TXT_VEHI_USED_TUTION VARCHAR2(3 BYTE),
    TXT_VEHI_USED_COMMERCIAL VARCHAR2(3 BYTE),
    TXT_VEHI_DESIGNED_HANDICAPED VARCHAR2(3 BYTE),
    TXT_EXTN_OF_GEO_REQUIRED VARCHAR2(3 BYTE),
    NUM_CUBIC_CAPACITY NUMBER(5),
    NUM_LICENSE_CARRYING_CAPACITY NUMBER(8),
    TXT_NO_TRLR_TOWED_BY_TOW_VEH VARCHAR2(10 BYTE),
    TXT_TRAILERS_TOWED_BY VARCHAR2(10 BYTE),
    CUR_POL_RISK_PREMIUM NUMBER(20),
    CUR_POL_RISK_DISCOUNT NUMBER(20),
    CUR_POL_RISK_OVERLOAD NUMBER(20),
    CUR_TOT_POL_RISK NUMBER(20),
    TXT_WISH_TO_REDUCE_TPPD_COVER VARCHAR2(3 BYTE),
    NUM_NO_NON_FARE_PAY_PASSENGER NUMBER(3),
    NUM_NO_NON_FARE_PASS_EXCL_EMP NUMBER(3),
    TXT_WISH_TO_COVER_EMP_NON_FARE VARCHAR2(3 BYTE),
    NUM_NO_OF_LL_TO_DRVR_CLNR_CON NUMBER(3),
    NUM_NO_OF_WCL_TO_COOLIES NUMBER(3),
    NUM_NO_OF_PAID_DRVR_CLNR_COND NUMBER(3),
    CUR_TOT_SI_FOR_DRVR_CLNR_CON NUMBER(15),
    NUM_NO_UNNAMED_PERSNS_PRSNLACC NUMBER(3),
    CUR_TOT_SI_FOR_UNNAMED_PERSNS NUMBER(15),
    TXT_TYPE_OF_GOODS_TRANSPORTING VARCHAR2(10 BYTE),
    TXT_HOLD_VALID_DRV_LICENSE VARCHAR2(10 BYTE),
    NUM_PROPOSAL_TYPE NUMBER(5),
    NUM_MEMBER_ENDORSEMENT_TYPE NUMBER(5),
    NUM_VEHICLE_INTL_TYPE NUMBER(5),
    NUM_MEMBER_MAKE_CODE NUMBER(5),
    NUM_MEMBER_PAYMENT_MODE NUMBER(5),
    NUM_MEMBER_POLICY_CODE NUMBER(3),
    NUM_XID NUMBER(10),
    TXT_MULTI_PAYMENT CHAR(1 BYTE),
    TXT_POLICY_FLAG CHAR(1 BYTE),
    NUM_RECORD_SEQUENCE NUMBER(30),
    NUM_SCHEDULE_NUMBER NUMBER(5),
    NUM_SCHEDULE_ENTRY_NUMBER NUMBER(10),
    DAT_EVENT_DATE DATE,
    NUM_OUT_XID NUMBER(10),
    DAT_PROCESS_RUN_DATE DATE,
    TXT_HIRE_IMT35_APPLICABLE VARCHAR2(3 BYTE),
    DAT_ENDT_START_DATE DATE,
    TXT_OTHER_MAKE VARCHAR2(50 BYTE),
    TXT_TRANSIT_FROM VARCHAR2(30 BYTE),
    TXT_TRANSIT_TO VARCHAR2(30 BYTE),
    NUM_ACTUAL_DISTANCE NUMBER(15),
    TXT_TRAILER_ATTACHED VARCHAR2(1 BYTE),
    NUM_NO_TRAILER_ATTAH_TOWING_BY NUMBER(10),
    TXT_TRAILER_PURPOSE_TOWED_BY VARCHAR2(3 BYTE),
    TYPE_OF_OTHER_VEHI_MISC VARCHAR2(10 BYTE),
    NUM_NUMBER_OF_DRIVERS NUMBER(3),
    NUM_NUMBER_OF_TRADE_CERTIFI VARCHAR2(3 BYTE),
    TXT_WHETHER_TWO_WHEELER_OR_NOT VARCHAR2(3 BYTE),
    CUR_WAGES_IN_RS NUMBER(15),
    NUM_AREA_IN_SQUARE_METER NUMBER(15),
    TXT_TYPE_OF_PREMISES VARCHAR2(3 BYTE),
    NUM_AREA_OPENAIRCARPARK_IMT64 NUMBER(15),
    NUM_NO_PREMISES_BEYOND_450 NUMBER(3),
    TXT_LIABILITYWORKAWAYIMT65 VARCHAR2(3 BYTE),
    NUM_NO_LLPASSEXCLUDEMP_IMT46 NUMBER(3),
    TXT_WHETHER_VEHIUSEDDEMOIMT60 VARCHAR2(3 BYTE),
    TXT_WHETHERVEHICLETUITIONIMT61 VARCHAR2(3 BYTE),
    NUM_NO_LLDRIVERCLNRCONDUCIMT28 NUMBER(3),
    NUM_MISC_VEHICLECLASS_MEMBER NUMBER(10),
    TXT_PA_OD_COVER_REQUIRED VARCHAR2(1 BYTE),
    NUM_DISTANCE_TRAVELLED_VEHICLE NUMBER(10),
    NUM_NO_OF_DAYS NUMBER(10),
    CUR_TP_LOADING NUMBER(20),
    TXT_DUMMY_1 VARCHAR2(100 BYTE),
    TXT_DUMMY_2 VARCHAR2(100 BYTE),
    TXT_DUMMY_3 VARCHAR2(100 BYTE),
    TXT_DUMMY_4 VARCHAR2(100 BYTE),
    TXT_DUMMY_5 VARCHAR2(100 BYTE),
    NUM_DUMMY_1 NUMBER(2),
    NUM_DUMMY_2 NUMBER(2),
    NUM_DUMMY_3 NUMBER(3),
    NUM_DUMMY_4 NUMBER(4),
    DAT_DUMMY_1 DATE,
    DAT_DUMMY_2 DATE,
    DAT_DUMMY_3 DATE,
    DAT_DUMMY_4 DATE
    here txt_party_sex char(1) column is used in the pl/sql program
    CREATE TABLE GEN_PROPOSAL
    NUM_REFERENCE_NUMBER NUMBER(14) NOT NULL,
    DAT_REFERENCE_DATE DATE NOT NULL,
    NUM_POLICY_NUMBER NUMBER(20) DEFAULT 0 NOT NULL,
    NUM_POLICY_YEAR NUMBER(4) DEFAULT 0 NOT NULL,
    NUM_DEPARTMENT_CODE NUMBER(3) NOT NULL,
    NUM_POLICY_TYPE NUMBER(3) NOT NULL,
    NUM_ENDORSEMENT_NUMBER NUMBER(20) DEFAULT 0 NOT NULL,
    NUM_ENDORSEMENT_YEAR NUMBER(4) DEFAULT 0 NOT NULL,
    NUM_PROPOSAL_TYPE NUMBER(2) NOT NULL,
    TXT_PROPOSAL_STATUS VARCHAR2(2 BYTE) NOT NULL,
    NUM_COVERNOTE_NUMBER NUMBER(16),
    DAT_COVERNOTE_DATE DATE,
    TXT_NAME_OF_INSURED VARCHAR2(200 BYTE) NOT NULL,
    MEM_ADDRESS_OF_INSURED VARCHAR2(255 BYTE) NOT NULL,
    TXT_TELEPHONE VARCHAR2(30 BYTE),
    TXT_FAX VARCHAR2(15 BYTE),
    NUM_BUSINESS_CODE NUMBER(2),
    NUM_INDUSTRY_CODE NUMBER(4),
    NUM_PREVIOUS_POLICY_YEAR NUMBER(4),
    NUM_PREVIOUS_POLICY_NUMBER NUMBER(20),
    NUM_PREVIOUS_OFFICE_CODE NUMBER(6),
    NUM_PREVIOUS_POLICY_TYPE NUMBER(3),
    CUR_TOTAL_PREMIUM NUMBER(13,2) NOT NULL,
    CUR_PREMIUM_RECEIVED NUMBER(13,2) DEFAULT 0 NOT NULL,
    NUM_DEVELOPMENT_OFFICER_CODE NUMBER(8),
    NUM_AGENT_CODE NUMBER(14),
    NUM_SPECIAL_CLIENT_CODE NUMBER(8),
    DAT_DATE_OF_ISSUE_OF_POLICY DATE,
    DAT_DATE_OF_EXPIRY_OF_POLICY DATE,
    DAT_PREV_POLICY_EXPIRY_DATE DATE,
    TXT_OCCUPATION VARCHAR2(50 BYTE),
    NUM_NO_OF_CLAIMS NUMBER(8) DEFAULT 0 NOT NULL,
    NUM_ENDORSEMENT_TYPE NUMBER(2),
    DAT_HOURS_EFFECTIVE_FROM DATE,
    CUR_PREMIUM_COMPUTED NUMBER(13,2) NOT NULL,
    CUR_SERVICE_TAX NUMBER(13,2) DEFAULT 0 NOT NULL,
    CUR_ENDT_AMOUNT NUMBER(13,2) DEFAULT 0 NOT NULL,
    CUR_ENDT_SERTAX NUMBER(13,2) DEFAULT 0 NOT NULL,
    CUR_STAMP_DUTY NUMBER(11,2) DEFAULT 0 NOT NULL,
    YN_STAMP_DUTY_CHARGEABLE NUMBER(1) NOT NULL,
    CUR_SUM_INSURED NUMBER(16) NOT NULL,
    NUM_OWN_SHARE NUMBER(5,2) NOT NULL,
    NUM_AGENT_BILL_NO NUMBER(12) DEFAULT 0 NOT NULL,
    NUM_AGENT_COMM NUMBER(13,2) DEFAULT 0 NOT NULL,
    DAT_ENDT_START_DATE DATE,
    DAT_ENDT_END_DATE DATE,
    TXT_USER_ID VARCHAR2(8 BYTE),
    NUM_PC_ID NUMBER(2),
    NUM_SESSIO_ID NUMBER(5),
    NUM_PIN_CODE NUMBER(6),
    CUR_SPECIAL_DISCOUNT NUMBER(13,2),
    DAT_PROPOSAL_DATE DATE DEFAULT trunc(sysdate),
    CUR_ENDT_STAMP_DUTY NUMBER(11,2) DEFAULT 0 NOT NULL,
    NUM_ENDT_POLICY_NUMBER NUMBER(20) DEFAULT 0 NOT NULL,
    TXT_ENDT_FLAG CHAR(1 BYTE),
    NUM_INSTMNT_NO NUMBER(2) DEFAULT 0 NOT NULL,
    NUM_PREVIOUS_COMPANY_CODE NUMBER(6),
    NUM_COUNTRY_CODE NUMBER(3) NOT NULL,
    NUM_CURRENCY_CODE NUMBER(3) NOT NULL,
    NUM_AGENT_COMM_RATE NUMBER(4,2),
    NUM_SPECIAL_DISCOUNT_RATE NUMBER(4,2),
    DAT_COVERNOTE_RCVD_DATE DATE,
    TXT_SECTOR_CODE VARCHAR2(5 BYTE) NOT NULL,
    NUM_CLASS_CODE NUMBER(3) NOT NULL,
    TXT_MANUAL_CODE VARCHAR2(3 BYTE) NOT NULL,
    TXT_CUST_POLICY_NO VARCHAR2(20 BYTE) NOT NULL,
    TXT_CUST_ENDT_POLICY_NO VARCHAR2(20 BYTE) NOT NULL,
    DAT_LAST_UPDT_DTTM_DATE DATE DEFAULT sysdate NOT NULL,
    TXT_ARCHIVAL_STATUS CHAR(1 BYTE) DEFAULT 'F' NOT NULL,
    NUM_RENEWAL_POLICY_NO NUMBER(20) DEFAULT 0 NOT NULL,
    TXT_LAST_RECORD_STATUS CHAR(2 BYTE) NOT NULL,
    TXT_EMAIL_ADDRESS VARCHAR2(200 BYTE),
    NUM_SUB_CLASS_CODE NUMBER(3),
    CUR_STAFF_DISCOUNT NUMBER(13,2),
    CUR_GROUP_DISCOUNT NUMBER(13,2),
    CUR_LONGTERM_DISCOUNT NUMBER(13,2),
    CUR_TERRORISM_LOADING NUMBER(13,2),
    NUM_REINSTATEMENT_CLAIM_NO NUMBER(20),
    NUM_AGENT_MOD_COMM_RATE NUMBER(4,2),
    TXT_BUSINESS_FLAG VARCHAR2(3 BYTE),
    YN_SEZ NUMBER(1),
    TXT_PAN_NO VARCHAR2(15 BYTE),
    TXT_COMM_SHARE VARCHAR2(2 BYTE),
    TXT_CROSS_REFERENCE_NUMBER VARCHAR2(200 BYTE),
    DAT_CROSS_REFERENCE_DATE DATE,
    NUM_GROUP_CODE NUMBER(8),
    TXT_PRODUCT_TYPE VARCHAR2(2 BYTE),
    DAT_ACTUAL_EXPIRY_OF_POLICY DATE
    )

  • PL/SQL NUMERIC VALUE ERROR

    Hi ,
    We have following code and sending the data through attachnmet its giving the pl/sql numeric value error.
    Please correct me.
    __Code Details:::__
    CREATE OR REPLACE PROCEDURE APPS.print_reports
    IS
    wfile_handle UTL_FILE.file_type;
    lv_file VARCHAR2 (100);
    lv_date VARCHAR2 (20);
    mail_conn UTL_SMTP.connection;
    lv_rep_headers VARCHAR2 (32000);
    p_o_srv_result xxcss_prf_report_pkg.ref_cur_srv_prog;
    lv_str_type XXCSS_PRF_STRING;
    lv_line VARCHAR2 (32767);
    lv_send_to VARCHAR2 (200);
    lv_host_name VARCHAR2 (200) := 'outbound.cisco.com';
    l_vtab CHAR := CHR (9);
    lv_from VARCHAR2 (200) := '[email protected]';
    lv_att_file_name VARCHAR2 (200);
    lv_path VARCHAR2 (200);
    p_request_type VARCHAR2 (1) := 'E';
    p_request_id NUMBER;
    errbuf VARCHAR2 (2000);
    retcode NUMBER;
    crlf VARCHAR2 (2) := CHR (13) || CHR (10);
    lv_line_data Clob;
    lv_clob clob;
    BEGIN
    BEGIN
    SELECT VALUE
    INTO lv_path
    FROM v$parameter
    WHERE NAME = 'utl_file_dir';
    EXCEPTION
    WHEN OTHERS
    THEN
    lv_path := '\tmp';
    END;
    lv_rep_headers :=
    'REGION'
    || CHR (9)
    || 'COUNTRY'
    || CHR (9)
    || 'CUSTOMER NAME'
    || CHR (9)
    || 'ERP CUSTOMER NUMBER'
    || CHR (9)
    || 'PROFILE ID'
    || CHR (9);
    FOR i IN ( SELECT DISTINCT srv_program_id srv_prgm
    FROM xxcss_prf_cust_srv_programs
    ORDER BY srv_program_id ASC)
    LOOP
    lv_rep_headers := lv_rep_headers ||i.srv_prgm || CHR (9);
    END LOOP;
    lv_rep_headers := lv_rep_headers || CHR (13);
    BEGIN
    XXCSS_PRF_REPORT_PKG.offline_daemon (p_request_id,
    p_request_type,
    p_o_srv_result,
    errbuf,
    retcode);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.PUT_LINE ('Error in Offline');
    END;
    lv_att_file_name := 'Eligibility_reports'||p_request_id||'.xls';
    -- DBMS_OUTPUT.PUT_LINE (lv_rep_headers);
    wfile_handle := UTL_FILE.fopen (lv_path, lv_att_file_name, 'W');
    UTL_FILE.put_line (wfile_handle, lv_rep_headers);
    BEGIN
    LOOP
    FETCH p_o_srv_result INTO lv_str_type;
    EXIT WHEN p_o_srv_result%NOTFOUND;
    lv_line := NULL;
    FOR i IN 1 .. lv_str_type.COUNT
    LOOP
    lv_line := lv_line || lv_str_type (i) || CHR (9);
    END LOOP;
    lv_line := lv_line || CHR (13);
    UTL_FILE.put_line (wfile_handle, lv_line);
    END LOOP;
    lv_str_type.DELETE;
    END;
    UTL_FILE.fclose (wfile_handle);
    BEGIN
    wfile_handle := UTL_FILE.FOPEN (lv_path, lv_att_file_name, 'R');
    -- DBMS_OUTPUT.PUT_LINE ('inside file');
    LOOP
    UTL_FILE.GET_LINE (wfile_handle, lv_line_data,32767);
    -- DBMS_OUTPUT.PUT_LINE (lv_line_data);
    lv_clob := lv_clob || lv_line_data;
    END LOOP;
    UTL_FILE.FCLOSE (wfile_handle);
    EXCEPTION
    WHEN OTHERS
    THEN
    errbuf := sqlerrm;
    UTL_FILE.FCLOSE (wfile_handle); -- close file
    DBMS_OUTPUT.PUT_LINE ('Exception'||errbuf);
    NULL;
    END;
    DBMS_OUTPUT.PUT_LINE ('afterdata');
    --DBMS_OUTPUT.PUT_LINE (lv_line_data);
    SELECT email_id
    INTO lv_send_to
    FROM xxcss_prf_offline_report_tb
    WHERE request_id = p_request_id AND report_type = p_request_type;
    mail_conn := UTL_SMTP.open_connection (lv_host_name, 25);
    UTL_SMTP.Helo (mail_conn, lv_host_name);
    UTL_SMTP.Mail (mail_conn, 'sangrdas');
    UTL_SMTP.Rcpt (mail_conn, lv_send_to);
    UTL_SMTP.OPEN_Data(mail_conn) ;
    DBMS_OUTPUT.PUT_LINE ('Sending Data');
    UTL_SMTP.write_Data (
    Mail_Conn,
    'Date: '
    || TO_CHAR (SYSDATE, 'Dy, DD Mon YYYY hh24:mi:ss')
    || crlf
    || 'From: '
    || lv_from
    || crlf
    || 'Subject: ELIGIILITY Report_'
    || p_request_id
    || crlf
    || 'To: '
    || lv_send_to
    || crlf
    || 'MIME-Version: 1.0'
    || crlf
    || -- Use MIME mail standard
    'Content-Type: multipart/mixed;'
    || crlf
    || ' boundary="-----SECBOUND"'
    || crlf
    || '-------SECBOUND'
    || crlf
    || 'Content-Type: text/plain;'
    || crlf
    || 'Content-Transfer_Encoding: 7bit'
    || crlf
    || 'some message text'
    || crlf
    || -- Message body
    'more message text'
    || crlf
    || '-------SECBOUND'
    || crlf
    || 'Content-Type: text/plain;'
    || crlf
    || ' name="'|| lv_att_file_name||'"'
    || crlf
    || 'Content-Transfer_Encoding: 8bit'
    || crlf
    || 'Content-Disposition: attachment;'
    || crlf
    || ' filename="'
    || lv_att_file_name
    || '"'
    ||crlf
    ||crlf
    ||lv_clob
    || crlf
    ||crlf
    ||crlf
    || '-------SECBOUND');
    UTL_SMTP.CLOSE_Data(mail_conn) ;
    UTL_SMTP.quit (mail_conn);
    DBMS_OUTPUT.PUT_LINE ('After Mail');
    EXCEPTION
    WHEN OTHERS THEN
    errbuf := sqlerrm;
    DBMS_OUTPUT.PUT_LINE ('ERROR Sending Data'||errbuf);
    ROLLBACK;
    END;
    /

    Yet again, opening a new thread for an existing issue...
    Need help in UTL file
    Same old, same old...
    need a report code
    need to create the header dynamically for a report
    Would have thought you'd get the idea of posting on the forums by now.

  • Function - numeric Overflow error

    Dear All,
    I have a function that is causing a ORA-01426: numeric overflow error
    My values from the variables are as follows
    v_highest_Uprn is 10033233499
    v_start_uprn is 10033223500
    Any ideas how to fix this. Thanks in advance.
    FUNCTION get_next_uprn RETURN NUMBRT IS
    /* Loop through numbers betweeen the next_uprn and the highest in the active range. */
    /* Check to see if the new uprn exists in the database , if no rows returns then return the new uprn. */
    v_start_uprn NUMBER;
    v_highest_uprn NUMBER;
    v_uprn_exists NUMBER;
    v_new_uprn NUMBER;
    BEGIN
    SELECT next_uprn ,
    highest_uprn
    INTO v_start_uprn,v_highest_uprn
    FROM PD_PROPERTY_NUMBERS
    WHERE active_sequence = '*';
    v_new_uprn :=v_start_uprn ;
    FOR rec IN v_start_uprn..v_highest_uprn LOOP
    IF v_new_uprn > v_highest_uprn THEN
    Bs7666_Standard.bs7666_error(35635);
    END IF;
    SELECT uprn INTO v_uprn_exists
    FROM PD_BLPUS
    WHERE uprn = v_new_uprn;
    v_new_uprn := v_new_uprn + 1;
    END LOOP;
    RETURN v_new_uprn;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RETURN v_new_uprn;
    END get_next_uprn;

    Hi
    The loop control variable in a FOR loop is an integer (or similar) it seems; those numbers are simply too big for it.
    Change your code to something like:
    FOR rec IN 1 .. v_highest_uprn - v_start_uprn + 1 LOOP
    Luis

  • Numeric Precision on Key Figures

    Numeric Precision on Key Figures
    Hi Sdn,
    What is the impact of the setting "Key Figure with Maximum Precision" on types Amount, Integer and Number? We are trying to import amounts or numbers with 9 places to the right of the decimal point. How does this setting help us, or does not?
    We are loading from a flat file. How the above impact, source flat file, staging and query design and display?
    Thanks for the help.
    Saf.

    Hi Saf,
    Did you find an answer to your question. I am facing the same problem right now.
    Could you please suggest how you did resolve the issue and the impacts...!!!
    Thanks in Advance.
    Best Regards,
    Giftedbrain.

Maybe you are looking for