Error rep-1401 in formula of report buider

I am trying to read number from table for a speciific date for which that number does not exit i.e return value is null. I am unable to handle it.
My code look like this
declare
vnum number;
begin
select pnum into vnum from XYZ where pdate=:P1_date
if pnum is null
return 0;
else return pnum;
end if;
end;
I also tried
declare
vnum number;
begin
select pnum into vnum from XYZ where pdate=:P1_date
exception when no_data_found then
return 0;
else return pnum;
end if;
end;

declare
vnum number;
begin
  select pnum into vnum from XYZ where pdate=:P1_date;
  return vnum;
exception when no_data_found then
return 0;
end;

Similar Messages

  • Iam getting the error REP-1401: '': Fatal PL/SQL error occurred. when i

    When i run the report to generate xml file in report builder the following error messages are displayed.
    REP-0069: Internal error
    REP-57054: In-process job terminated:Terminated with error:
    REP-1401: '': Fatal PL/SQL error occurred.
    pls help me.Its urgent
    Regards,
    Kranthi

    Hi;
    What is EBS version? Is it custom report or not?
    See below which is mention similar errors
    Autoinvoice Error: ORA-1403: no data found [ID 1209403.1]
    APXIIMPT - Payable Open Interface Import Fails on "REP-1401: 'cf_source_nameformula': Fatal PL/SQL error occurred. ORA-01403: no data found" [ID 222058.1]
    Regard
    Helios

  • Ora-06503/rep-1401 with my second report

    hello :D
    im making my second report (new to reports, self studying)
    i encountered REP-1401-'cf_itemtypeformula': Fatal PL/SQL error occured.
    then i tried to trace the error by putting srw.message() in parts of the code to try to figure out the problem
    here is cf_itemtype currently
    function CF_itemtypeFormula return Char is
    itype char(60);
    begin
         srw.message(1000,'item type is'||:p_itemtype);
         --return ' ';
    if :p_itemtype = '%-ALL' then
         itype:=' ';
         srw.message(1005,'itype code is'||itype);
         return itype;
    else
         srw.message(1003,'item type is'||:p_itemtype); --it prints this one
         itype:='AND il.itty_code= itty.code and itty.item_type = '''||:p_itemtype||''' ';
         --itype:=' ';
         srw.message(1005,'itype code is'||itype); --and never reaches this line i think.
         return itype;
    end if;
    exception
         when value_error then
              srw.message(1007,'value error');
    end;
    i think the error is because of this line
    'AND il.itty_code= itty.code and itty.item_type = '''||:p_itemtype||''' '
    because when i comment it out and uncomment itype:=' '; the srw.message(1005,'itype code is'||itype); works
    thanks

    Hi,
    You just need to increase the length of itype.
    Or even better option is to return the value directly without assigning to a local variable.
    return ('AND il.itty_code= itty.code and itty.item_type = '''||:p_itemtype||''' ');Your over all function without the SRW messages will be like, you don't even need Exception handler:
    function CF_itemtypeFormula return Char is
    begin
    if :p_itemtype = '%-ALL' then
      return (' ');
    else
      retrun ('AND il.itty_code= itty.code and itty.item_type = '''||:p_itemtype||''' ');
    end if;
    end;Also I have doubt about your if statement, I dont understand what you are trying to do by this.
    > if :p_itemtype = '%-ALL' then
    May be you just need to check if :p_itemtype is null
    so may be your above IF clause will be like
    > if :p_itemtype IS NULL then
    Edited by: Arif Khadas on Apr 21, 2010 10:37 AM

  • Error rep-1401 in report 6i

    dear sirs,
    when i run the report i got this error rep_1401 cf_2formula fatal pl/sql error occurred
    known that after i trace i find that the error come because report not see the value inside the paramater :budg_type
    the code is here
    function CF_2Formula return Number is
    cursor c1 is SELECT
    to_char(A.DUE_DATE,'mm') ,
    SUM(nvl (b.EST_CRAFT,0)) man,
    SUM(nvl (b.EST_TOOL,0)) tol,
    SUM(nvl (b.EST_SUPPLY,0)) con,
    SUM(nvl (b.EST_SPARES,0)) mat,
    SUM(nvl (b.EST_MISC,0)) misc
    FROM PLANNING_SIMULATION A ,maintenance_plans b
    WHERE A.EQUIPMENT_ID = B.equip_EQUIPMENT_ID(+)
    AND A.MAINTENANCE_WORK_ID = B.mw_MAINTENANCE_WORK_ID(+)
    AND to_number(to_char(a.due_date,'yyyy')) =:YEAR
    and A.EQUIPMENT_ID IN (SELECT EQUIPMENT_ID FROM EQUIPMENT WHERE
                   COSTCENTER_COST_CENTER_ID = :COST_CENTER)
    and to_char(A.DUE_DATE,'mm') = :mon
    group by to_char(A.DUE_DATE,'mm');
    rec c1%rowtype;
    total number(10,3);
    begin
    open c1;
    fetch c1 into rec;
    close c1;
    total := nvl(rec.mat,0)+nvl(rec.con,0)+nvl(rec.man,0)+nvl(rec.tol,0)+nvl(rec.misc,0);
    --if :cf_budg_type = 'material' then
    if :budg_type = 'material' then
         total := rec.mat;
         return(total);
    elsif :budg_type = 'contract' then
         total := rec.con;
         return(total);
    elsif :budg_type = 'manpower' then
         total := rec.man;
         return(total);
    elsif :budg_type = 'tool' then
         total := rec.tol;
         return(total);
    elsif :budg_type = 'misc.' then
         total := rec.misc;
         return(total);
    elsif :budg_type = 'totals' then
         return(total);
    end if;
    end;
    when i make hash for the if statement it work without problem, please advice me how to solve this and why if statement not feel what inside the paramter even i try to print the contents of paramater and it was ok
    help me pls
    Yasser

    I think the problem is that
    to_number(interface_header_attribute1)fails when there are non numeric values in interface_header_attribute1.
    You could write a stored function in the database for converting char-values to number-values.
    These function should catch the conversion errors and return an appropriate default (or null).
    You then could use your own function instead of buildin to_number-function.
    Edited by: hm on 05.09.2011 01:25

  • Error REP-0001 While starting the Report service

    Hi
    When trying to start the reports service from 9iAS, i am getting error message as "REP-0001 Unable to open the message file", and in the Window Title it shows "Message 16200 not found, No message file for product rw".
    Regards
    Ranganath

    Hi,
    You(The user) need to have access permission to read the mesg files. The DBA installing Reports will be able to run the reports.
    Grant read access to rwus.msb and rwus.msg files on $ORACLE_HOME/reports/mesg/
    Try to run it, should work.
    Thanks,
    Oracle Reports Team.

  • Error rep-1401

    I am trying to read number from table for a speciific date for which that number does not exit i.e return value is null. I am unable to handle it.
    My code look like this
    declare
    vnum number;
    begin
    select pnum into vnum from XYZ where pdate=:P1_date
    if pnum is null
    return 0;
    else return pnum
    end if;
    end;
    I also tried
    declare
    vnum number;
    begin
    select pnum into vnum from XYZ where pdate=:P1_date
    exception when no_data_found then
    return 0;
    else return pnum
    end if;
    end;

    I'm suprised these even compile. Try reading the pl/sql user guide and refernce for proper syntax.
    You want sometheng like this.
    declare
    vnum number;
    begin
    select pnum into vnum from XYZ where pdate=:P1_date
    return vnum;
    exception when no_data_found then
    return 0;
    end;By the way, this forum is specificaly for the SQL Developer tool. You should ask general questions in the SQL and PL/SQL forum.

  • See this error in report REP-1401: cf_1formula: Fatal PL/SQL errir occurred

    hi mater
    sir i use oracel reprot 6i
    i try to use formula for calculation see
    function avggFormula return Number is begin
    :cp_1 := (:bugamt-nvl(:totexp,0)/:bugamt)*100 ;
    return(:cp_1);
    end;
    this formula complie rightly no error
    but when i run my report
    that give me this error
    REP-1401: 'cf_1formula': Fatal PL/SQL errir occurred.
    ORA-01476: divisor is equal to zero
    please give me idea how i solve my this error
    thank;
    aamir

    Hi Aamir,
    The problem is that divisor by 0 (zero) is not possible.
    So you need to make sure that in your calculation there's no division by zero.
    In your case :bugamt is equal to zero then you will get this error.
    So just make sure that :bugamt is not equal to zero.
    You can do this as follows:
    function avggFormula return Number is begin
    IF :bugamt != 0 THEN
    :cp_1 := (:bugamt-nvl(:totexp,0)/:bugamt)*100 ;
    END IF;
    return(:cp_1);
    end;
    Regards
    Arif

  • REP-1401:'cf_1formula': Fatal PL/SQL error occured, ORA-01403: no data fou

    hi,
    my report is giving error REP-1401:'cf_1formula': Fatal PL/SQL error occured,
    ORA-01403: no data found
    There are two table emp1 and emp2 created from employees table from HR schema
    I have deleted some records from table emp2 where department id is 110
    main query is
    select employee_id, first_name, department_id from emp1
    now i created a foumula column
    function CF_1Formula return Number is
    dept number;
    begin
    select department_id into dept from emp2 where employee_id = :employee_id;
    return(dept);
    end;
    the above error is given when report is run. i tried
    exception
    when_no_data_found then
    dept:=000
    but problem is not solved
    i want to disply any number in this foumula column if the record is not found

    M. Khurram Khurshid wrote:
    exception
    when_no_data_found then
    dept:=000try this code in formula
    function CF_1Formula return Number is
    dept number;
    begin
    select department_id into dept from emp2 where employee_id = :employee_id;
    if dept is not null then
    return(dept);
    else
    return 0;
    end if;
    end; Hope this will help you...
    If someone response is helpful or correct please, mark is accordingly.

  • REP-1401: Fatal PL/SQL error occurred. ORA-01403: no data found

    Hi guys,
    I am getting error 'REP-1401: Fatal PL/SQL error occurred. ORA-01403: no data found ' when run the report
    and i m also use formula column in my report.
    can any body help me why it's coming.
    following code is used in formula column plz check and verify:
    function CF_3Formula return Char is
    T1 VARCHAR2(100);
    begin
    SELECT
         VAT_REG_NO INTO T1
    FROM
         JA_IN_HR_ORGANIZATION_UNITS JIHOU,
         HR_LOCATIONS HL--,
         --MTL_TXN_REQUEST_HEADERS MTLH
    WHERE
    JIHOU.ORGANIZATION_ID=HL.INVENTORY_ORGANIZATION_ID AND
    JIHOU.LOCATION_ID=HL.LOCATION_ID AND
    --Jihou.ORGANIZATION_ID = Mtlh.Organization_Id AND
    -- Hl.INVENTORY_ORGANIZATION_ID =Mtlh.Organization_Id AND
    -- MTLH.ATTRIBUTE10=SUBSTR(HL.LOCATION_CODE,1,3) AND
    SUBSTR(HL.LOCATION_CODE,1,3)= :TO_ORG1 ;
    RETURN (T1);
    end;
    plz help me out.

    Hi;
    What is EBS version? Is it custom report or not?
    See below which is mention similar errors
    Autoinvoice Error: ORA-1403: no data found [ID 1209403.1]
    APXIIMPT - Payable Open Interface Import Fails on "REP-1401: 'cf_source_nameformula': Fatal PL/SQL error occurred. ORA-01403: no data found" [ID 222058.1]
    Regard
    Helios

  • Rep-1401: 'beforereport': Fatal PL/SQL error occured

    Hi all
    I am working in Oracle reports 6i.
    in my report i hav two program units.
    iam calling them in before report trigger. Then iam getting the following error
    rep-1401: 'beforereport': Fatal PL/SQL error occured
    ORA-03120: two-task conversion routin: integer overflow
    and if i call any one of them they are working fine.
    whenever i call two of them at a time iam getting above error.
    can anybody help me.....

    in the before report trigger check the code where u r assigning value to a variable...like fetching cursor into some variable......or assigning to any variable and there the variable must be smaller than the value being assigned to it....

  • Rep-1401: formula name : Fatal Pl/SQL error occured

    Hi,
    I am using report builder 6.0 and recently came across a error while running the report. Rep-1401:<formula name> : Fatal Pl/SQL error occured.
    I created a formula column in the report. In that i have three local variable.
    f_val number := 0;
    s_val number := 0;
    t_val number := 0;
    t_val := f_val/s_val ; --> this gives the above fatal error.
    t_val := (f_val + 1)/s_val; --> this gives the above fatal error
    t_val := f_val/(s_val + 1); ---> no error
    if i change the value of s_val
    s_val := 1;
    t_val := f_val/(s_val - 1) ; ----> this gives the above fatal error.
    Can anyone help me to solve this problem or is it report builder bug.
    Please help me, as i desperately need help.
    Thanks

    Thanks for ur reply.
    I used nvl too, but the same error occurred.
    For the information in my question I by mistake typed
    t_val := (f_val + 1)/s_val; --> this gives the above fatal error.
    but when the value of f_val = zero and s_val is zero why it gives fatal error when i divide, i used nvl on both the variable while dividing but still got the same error.
    but if s_val is greater than zero then no error occurs.
    please help me, I feel it is a bug.

  • Rep-1401 : Fatal PL/SQL error occured

    Hi,
    I am using report builder 6.0 and recently came across a error while running the report. Rep-1401:<formula name> : Fatal Pl/SQL error occured.
    I created a formula column in the report. In that i have three local variable.
    f_val number := 0;
    s_val number := 0;
    t_val number := 0;
    t_val := f_val/s_val ; --> this gives the above fatal error.
    t_val := (f_val + 1)/s_val; --> this gives the above fatal error
    t_val := f_val/(s_val + 1); ---> no error
    if i change the value of s_val
    s_val := 1;
    t_val := f_val/(s_val - 1) ; ----> this gives the above fatal error.
    Can anyone help me to solve this problem or is it report builder bug.
    Please help me, as i desperately need help.
    Thanks

    The best way to handle this is to just add an exception handler that handles a zero divide.
    EX:
    function...blah
    var3:=var/var2...
    EXCEPTION
    when zero_divide then
    var3:= 0;Zero Divide is a built-in exception to handle cases just like this - so if you run into it, you can set it to whatever you want

  • REP-1401 'beforereport' Fatal PL/SQL error occurred. ORA 00000 normal.

    Hi,
    I am running the report Journals - General (132 char)- file name GLRGNJ.rdf from
    Oracle Report Builder 6.0.8.11.3.
    I have commented all the (srw.user_exit) in the Before Report trigger but i still
    get the message:
    REP-1401 'beforereport' Fatal PL/SQL error occurred. ORA 00000 normal,
    successful completion.
    Can anyone suggest a solution please?
    Thanks,
    Faris

    Dear sir, i am created one formula column in Reports6i and the following error has come. Could u please find out a solution. Thanks in advance.
    my function is below
    function CF_Branch_NameFormula return Char is
    lc_branch_name varchar2(100);
    begin
    SELECT rtrim(substr(FVT.DESCRIPTION
    ,instr(FVT.DESCRIPTION,'-',1)+1
    ,100)) INTO lc_branch_name
    FROM FND_FLEX_VALUES FFV, FND_FLEX_VALUES_TL FVT
    WHERE FFV.flex_value_Set_id = 1007956
    AND FFV.FLEX_VALUE_ID = FVT.FLEX_VALUE_ID
    AND FFV.FLEX_VALUE = FVT.FLEX_VALUE_MEANING
    AND FVT.DESCRIPTION <> 'xxx'
    and rownum<=1
    AND SUBSTR(FVT.FLEX_VALUE_MEANING,3,2) = :P_BRANCH;
    return (lc_branch_name);
    end;

  • REP-1401: 'cf_10formula': Fatal PL/SQL error occurred. ORA-06502: PL/SQL: numeric or value error

    Hi Team,
    I am running one conc programme.
    After running I am getting below  error. I checked the issue on metalink  and other, seems that it is an size related issue. I have increased the size of formula columns and placeholdder too.
    But still getting issue.
    My requirement is to get comma seperated values using SQL query itself. Neither i wanted to create layout of the report , since it is a XML publisher report and nor  I am including it on RTF template.
    I want the CF_10 formula column to be populated with comma seperated values.
    MSG-00187: From Date 01-Sep-2014
    REP-1401: 'cf_10formula': Fatal PL/SQL error occurred.
    ORA-06502: PL/SQL: numeric or value error
    And Here is my code for CF_10
    function CF_10Formula return Number is
    begin
       SELECT NVL(TO_CHAR(sum(Amount),'99,99,99,999'),0) into :CP_5 --NVL(ROUND(sum(Amount)),0) into :CP_5
    --  xxhw_Coll_cat(category)     "Intercat  Catg"
    FROM hhxw_Region_col_v
    WHERE Category IN ('Intercompany - CATV')
    AND trunc(gl_date) BETWEEN TO_DATE(:P_FROM_DATE, 'DD/MM/RRRR') AND TO_DATE(:P_TO_DATE, 'DD/MM/RRRR');
    RETURN ROUND(:CP_5);
    end;
    Anyone please suggest me.
    Regards,
    Sachin

    Hi,
    1)Why are you selecting the value into a report item? Select into a local variable and return that
    RETURN :CP_5 --> This one!!
    2)And you should avoid applying functions to DB columns in where clauses wherever possible, so oracle can use indexes on them if applicable:
    AND gl_date >= To_date(:P_FROM_DATE, 'DD/MM/RRRR')
    AND gl_date < To_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
    I think you are taking 2 column in the Layout CF_10 and CP_5 right? if so, then use below Query.
    FUNCTION cf_10formula
      RETURN NUMBER
    IS
      v_amount NUMBER:null;
    IS
    BEGIN
      BEGIN
        SELECT nvl(round(SUM(amount)), 0)
        INTO   v_amount --> Retruns the value for CF_10 column
        FROM   hhxw_region_col_v
        WHERE  category IN ( 'Intercompany - CATV' )
        AND    gl_date >= to_date(:P_FROM_DATE, 'DD/MM/RRRR')
        AND    gl_date < to_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
        :CP_5 := nvl(trunc(v_amount),0); --> Retruns the value for CP_5 column
      EXCEPTION
      WHEN OTHERS THEN
        v_amount := 0;
        srw.message(1003,'Error in Getting  :' ||p_from_date);
      END;
    END;
    And
    If you've got a number function returning into a number field then all you should need to do to make the comma appear is to change the number format mask in field.
    From 40000 to 40,000

  • REP-1401: 'no_daysformula':Fatal PL/SQL error occured. ora-06503: PL/SQL : Functio returned without value. REP-0619: You cannot run without a layout.

    Hi everyone.
    Can anyone tell me what is wrong in this code below?
    Code:
    function NO_DAYSFormula return Number is
    begin
      IF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
      AND :P_TO_DT<:MATURITY_DATE
      AND :ACCT_OPN_DT>:P_FR_DT
      THEN RETURN (:P_TO_DT-:ACCT_OPN_DT+1);
      ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
      AND :P_TO_DT<:MATURITY_DATE
      AND :ACCT_OPN_DT<:P_FR_DT
      THEN RETURN (:P_FR_DT-:P_TO_DT+1);
      ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
       AND :P_TO_DT>:MATURITY_DATE
       AND :ACCT_OPN_DT<:P_FR_DT
      THEN RETURN (:P_FR_DT-:MATURITY_DATE+1);
      END IF;
    END;
    It gets compiled successfully but when i run the report, i get 2 errors.
    Error 1:
    REP-1401: 'no_daysformula':Fatal PL/SQL error occurred.
    ora-06503: PL/SQL : Function returned without value.
    Error 2:
    REP-0619: You cannot run without a layout.
    Should i use only 1 return statement?
    Can i use as many return statements as i want?
    What is the exact mistake? Please let me know.
    Thank You.

    Let me clear you the first thing...
    If you get any fatal errors while running the report (e.g., function returned without value,no value etc.,) the report will show
    REP-0619: You cannot run without a layout.
    So you just correct the function 'no_daysformula' .
    First of all you run the report without that formula column.
    If it works fine then , Check the return value of your formula column (Your formula column properties --> Return value --> value (It will be DATE as i think so).
    As function will always return a single value, Check your formula 'no_daysformula' returns the same.
    declare a return variable say for example..
    DECLARE
    V_DATE DATE;
    BEGIN
    --YOUR CODE---
    RETURN V_DATE := (RETURN VALUE)
    END;
    Last but not least ... use Else condition to return (NULL or any value ) in your code and check..
    If any Problem persists let me know
    Regards,
    Soofi.

Maybe you are looking for

  • Photo orientation in pictures app messed up after ...

    Hello. First of all kudos to Nokia for creating such brilliant devices. My Lumia 900 has been performing well for me, and it's a fantastic phone. But there's a problem with the orientation of my photos after I plug my Lumia into my PC. Most of the pi

  • Is there a street view on maps?

    Is there a street view on maps?

  • Callout webservices - Urgent!

    Hi, I am trying to test callout to an external web service from Oracle Express Edition 10g, ver. 10.1.2. I have also installed JDeveloper 10.1.3.2.0. I have tested web service call in and it works perfectly fine. But I have a few very basic questions

  • Modeling Business Model Layer  in obiee 10g

    Hi Experts, Please help me in modeling this. I have requirement like this D1 ,D2,D3 , D4(Time Dimension) and Fact1, Fact2. Here D1's primary key is Foreign key for D1.1 and D1.1's Primary key is the Foreign key for D1.2 and D1.2 is connected to the D

  • PS Elements 4,0 irritations (are they my fault)

    My irritation level with elements is elevated to some degree. Why? 1) When opening an image elements brings it in out of focus then as it finishes loaded it goes sharp. My clients think I have out of focus images. I would rather they see in focus all