Validation returns : no data found + unhandled user-defined exception

Hi, I'm working with Application Express 4.1.1.00.23.
I have an application for timesheet management.
On one page, I've got a report (not interactive) in which you can enter the hours you've worked. First you add a free line, choose the task and then enter the hours you've spent.
You can only have one empty line at a time. If you try to add a line when you already have an empty line, a validation will display an error. It worked fine in version 3.2. Now we upgraded to 4.1 and get a weird error :
1) The validation msg appears fine
2) The report appears fine
3) There is a msg at the end of the report saying :
report error:
ORA-01403: no data found
ORA-06510: PL/SQL: unhandled user-defined exception
Could somebody point out the source of this problem ?
Thank you!
Here is the debug :
0.31117     0.00204     parse query as: FEUILLES_DE_TEMPS     4     
0.31319     0.07865     ...Execute Statement: select NULL "CHECK$01", NULL "nom_projet2", NULL "NO_TACHE_ENTRE", NULL "NO_TACHE", NULL "NO_SEMAINE_EMPLOYE", NULL "NOM_TACHE", NULL "Tâches", NULL "SEQUENCE", NULL "Heures dim", NULL "DIM", NULL "Heures lun", NULL "LUN", NULL "Heures mar", NULL "MAR", NULL "Heures mer", NULL "MER", NULL "Heures jeu", NULL "JEU", NULL "Heures ven", NULL "VEN", NULL "Heures sam", .........
0.39191     0.00158     print column headings     4
0.39342     0.02546     rows loop: 500 row(s)     4
0.41889     0.00087     report error: ORA-01403: no data found ORA-06510: PL/SQL: unhandled user-defined exception
.....

Hi, thanks for your answer. Here is the validation we are executing. I'm pretty sure its fine since count(*) always return a value (plus we see V2 in the debug...) :
declare
l_count number;
begin
apex_debug_message.enable_debug_messages(7);
apex_debug_message.log_message('-----------------------------------V1----------------------------------');
-- get remaining empty tasks count
SELECT count(*) into l_count
FROM VIEW_TACHE_SYSTEME
WHERE NO_TACHE NOT IN (SELECT DISTINCT NO_TACHE FROM TACHE_JOUR WHERE NO_SEMAINE_EMPLOYE = :P36_NO_SEMAINE_EMPLOYE);
apex_debug_message.log_message('-----------------------------------V2----------------------------------');
apex_debug_message.log_message(l_count);
if l_count = 0 then
return 'Veuillez utiliser la tâche vide avant d''ajouter une ligne.';
else
return null;
end if;
end;
Here is the debug :
0.14643     0.00318     ...Validation "ADD_ROW_VALIDATION" - Type: FUNC_BODY_RETURNING_ERR_TEXT     4     
0.14961     0.00318     ...Execute Statement: declare function x return varchar2 is begin declare l_count number; begin apex_debug_message.enable_debug_messages(7); apex_debug_message.log_message('-----------------------------------V1----------------------------------'); -- get remaining empty tasks count SELECT count(*) into l_count FROM VIEW_TACHE_SYSTEME WHERE NO_TACHE NOT IN (SELECT DISTINCT NO_TACHE FROM TACHE_JOUR WHERE NO_SEMAINE_EMPLOYE = :P36_NO_SEMAINE_EMPLOYE); apex_debug_message.log_message('-----------------------------------V2----------------------------------'); apex_debug_message.log_message(l_count); if l_count = 0 then return 'Veuillez utiliser la tâche vide avant d''ajouter une ligne.'; else return null; end if; end; return null; end; begin wwv_flow.g_computation_result_vc := x; end;     4     
0.15280     0.01299     -----------------------------------V1----------------------------------     6     
0.16578     0.00310     -----------------------------------V2----------------------------------     6     
0.16888     0.00235     0     6     
0.17123     0.00225     ......Result = Veuillez utiliser la tâche vide avant d'ajouter une ligne.     4     
0.17347     0.00276     ......Did NOT pass     4     
0.17624     0.00314     Add error onto error stack     4     
0.17938     0.00343     ...Error data:     4     
0.18280     0.00327     ......message: Veuillez utiliser la tâche vide avant d'ajouter une ligne.     4     
0.18607     0.00446     ......display_location: INLINE_IN_NOTIFICATION     4     
0.19053     0.00323     ......is_internal_error: false     4     
0.19375     0.00323     ......error_backtrace: - PL/SQL Call Stack - object line object handle number name c000000382130f30 717 package body APEX_040100.WWV_FLOW_ERROR c000000382130f30 833 package body APEX_040100.WWV_FLOW_ERROR c00000039da9b5c8 154 package body APEX_040100.WWV_FLOW_VALIDATION c00000039da9b5c8 363 package body APEX_040100.WWV_FLOW_VALIDATION c00000039da9b5c8 784 package body APEX_040100.WWV_FLOW_VALIDATION c00000039da9b5c8 905 package body APEX_040100.WWV_FLOW_VALIDATION c00000039d1142c8 10005 package body APEX_040100.WWV_FLOW c000000381287050 31 anonymous block

Similar Messages

  • Unhandled user-defined exception in dbms_session?

    hi guys,
    I've had some code that's been working for a while but just now has started giving me the following:
    SQL> select *
      2    from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for Linux: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.00
    SQL> begin
      2 
      3 
      4          dbms_session.set_nls('cursor_sharing','FORCE');
      5         
      6         
      7  end;                                                     
      8  /
    begin
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "SYS.DBMS_SESSION", line 158
    ORA-06512: at line 4I've closed my sessions and restarted, it doesn't matter whether this is running via a stored proc or as an anonymous block like the above - what should I be looking for to find the cause of this?
    I don't think I've been changing anything except using the dbms_session.set_identifier procedure, but certainly not in the sessions that I've been setting this nls parameter...

    sybrand_b wrote:
    You can not use set_nls to change this parameter, you need 'execute immediate 'alter system... etc'
    And it is a bad hack to work around not using bind variables.
    Sybrand Bakker
    Senior Oracle DBAalso a work around for when your system's parameter is set to 'SIMILAR' but you're trying to use certain XML functionality:
    SQL> alter session set cursor_sharing = SIMILAR;
    Session altered.
    Elapsed: 00:00:00.00
    SQL> with t as (select xmltype('<validation>
      2                                <error id="1">
      3                                  <sys_message>test</sys_message>
      4                                  <cust_message>testing</cust_message>
      5                                  <cust_code>blahblah</cust_code>
      6                                </error>
      7                              </validation>') pi_xml from dual)                  
      8            SELECT xtab.sys_message
      9                  ,xtab.cust_message
    10                  ,xtab.cust_code
    11              FROM xmltable('/validation/error'
    12                    passing (SELECT pi_xml
    13                               FROM T)
    14                    COLUMNS
    15                      ID            NUMBER   path '/error/@id'
    16                      ,sys_message  VARCHAR2(1000) path '/error/sys_message'
    17                      ,cust_message VARCHAR2(1000) path '/error/cust_message'
    18                      ,cust_code    VARCHAR2(1000) path '/error/cust_code') xtab;
                                </validation>') pi_xml from dual)
    ERROR at line 7:
    ORA-01780: string literal required
    Elapsed: 00:00:00.00
    SQL> alter session set cursor_sharing = 'FORCE';
    Session altered.
    SQL> with t as (select xmltype('<validation>
      2                                <error id="1">
      3                                  <sys_message>test</sys_message>
      4                                  <cust_message>testing</cust_message>
      5                                  <cust_code>blahblah</cust_code>
      6                                </error>
      7                              </validation>') pi_xml from dual)                   
      8            SELECT xtab.sys_message
      9                  ,xtab.cust_message
    10                  ,xtab.cust_code
    11              FROM xmltable('/validation/error'
    12                    passing (SELECT pi_xml
    13                               FROM T)
    14                    COLUMNS
    15                      ID            NUMBER   path '/error/@id'
    16                      ,sys_message  VARCHAR2(1000) path '/error/sys_message'
    17                      ,cust_message VARCHAR2(1000) path '/error/cust_message'
    18                      ,cust_code    VARCHAR2(1000) path '/error/cust_code') xtab; 
    SYS_MESSAGE
    CUST_MESSAGE
    CUST_CODE
    test
    testing
    blahblah
    1 row selected.edit:
    incidentally, the exact same result can be retrieved with with cursor_sharing = similar if you do it this way...:
    SQL> alter session set cursor_sharing = SIMILAR;
    Session altered.
    Elapsed: 00:00:00.00
    SQL> with t as (select xmltype('<validation>
      2                                <error id="1">
      3                                  <sys_message>test</sys_message>
      4                                  <cust_message>testing</cust_message>
      5                                  <cust_code>blahblah</cust_code>
      6                                </error>
      7                              </validation>') pi_xml from dual)                     
      8        SELECT extractvalue(pi_xml,'/validation/error[@id=1]/sys_message')  sys_message
      9              ,extractvalue(pi_xml,'/validation/error[@id=1]/cust_message') cust_message
    10              ,extractvalue(pi_xml,'/validation/error[@id=1]/cust_code')    cust_code
    11          FROM (SELECT pi_xml
    12                  from t); 
    SYS_MESSAGE
    CUST_MESSAGE
    CUST_CODE
    test
    testing
    blahblah
    1 row selected.Edited by: WhiteHat on May 11, 2011 5:11 PM

  • Error : ORA-06510: PL/SQL: unhandled user-defined exception

    Hi,
    Please help on this Error.
    Here is my code for Trigger
    Code for Trigger
    CREATE OR REPLACE TRIGGER TRG_EXCEP AFTER INSERT ON TEST FOR EACH ROW
    DECLARE
         vInt NUMBER := 0;
         vErr EXCEPTION;
    BEGIN
         vInt := :OLD.TEST_ID;
         IF vInt > 10 THEN
              INSERT INTO TEST1 VALUES (:NEW.TEST_ID,:NEW.TEST_NAME);
         ELSE
              RAISE vErr;
         END IF;
    EXCEPTION
              WHEN vErr THEN
                   INSERT INTO TEST1 VALUES (0,:NEW.TEST_NAME);
    END;
    While inserting in to the table TEST iam getting the following error
    Error on line 0
    INSERT INTO TEST VALUES (147541,'Mm',SYSDATE)
    ORA-00001: unique constraint (DB_TEST.SYS_C005327) violated
    ORA-06512: at "DB_TEST.TRG_EXCEP", line 13
    ORA-06510: PL/SQL: unhandled user-defined exception
    Someone help me please ...............
    Thanks,
    Murali.V

    Hi,
    I made the mistake here
    INSERT INTO TEST1(id,name) VALUES (0,:NEW.TEST_NAME);
    where i defined the id as primary key.
    But the another problem for me now is while compiling the trigger after i modified,
    i get this error
    11:37:05 Error: TRIGGER DB_TEST.TRG_EXCEP
    On line: 7
    PLS-00553: character set name is not recognized
    Please help.
    Thanks,
    Murali.V

  • Ora-06510 ora-06512  unhandled user-defined exceptions

    hi,
    i try to execute command
    exec wwv_context.sync but i get following errors
    16:35:45 Error executing statement: ORA-06550: row 2, column 1:
    16:35:45 PLS-00201:identifier 'WWV_CONTEXT.SYNC' must be declared
    16:35:45 ORA-06550: row 2, column 1
    please help.

    What's the status for this object?
    select status from dba_objects where object_name ='<your_object>';

  • Trapping user defined exceptions in forms

    hi guys..
    i have a database trigger that goes like that:
    CREATE OR REPLACE TRIGGER loan_trig
    before insert on loans
    for each row
    declare
    lcount number(10);
    duplicate_loan exception;
    begin
    select count(1) into lcount from loans
    where branch_code=:new.branch_code
    and client_code=:new.client_code;
    if lcount>0 then
    raise duplicate_loan;
    end if;
    end;
    now how do i trap this user defined exception on the form ?
    declaring the exception in the form & handling it in the exeption handler section doesn't seem to work and i get the following error:
    "when button pressed trigger raised unhandled exception
    ora-06510"
    ora-06510:unhandled user-defined exception
    what am i doing wrong?
    if i have to handle the exception in the trigger body how do i do that?
    thankx in advance..

    Hello,
    raise duplicate_loan; won't avoid the trigger to insert and commit. If you really want to avoid the insertion, use the raise_applicatrion_error() instead.
    For instance : Raise_Application_Error( -20001, 'Insertion cannot be validated' );Then in your Forms module, you can catch it like this:
       Begin
       Insert Into ...
       when others then
          LC$Erreur := Substr( SQLERRM,1 , 500 );
          LN$err_code := ABS(SQLCODE);
          If LN$err_code = 20001 Then ...
       End;
    ...Francois

  • Returns No Data Found

    Hi i have a query like this
    SELECT
    pro.project_name "Project Name",
    POBJ.NAME "Object Name",
    X."Major" "Internal Major",
    X."Minor" "Internal Minor",
    X."Normalized" "Internal Normalized",
    X."IDR" "Internal Defect Rate",
    Y."Minor" "External Minor",
    Y."Major" "External Major",
    Y."Normalized" "External Normalized",
    Y."EDR" "External Defect Rate",
    NULL "Total Defects"
    FROM
    PROJECTS PRO,
    PROJECT_OBJECTS POBJ,
    (SELECT
    MN."PRO_ID",
    MN."POBJ_ID",
    MN."Major",
    MN."Minor",
    MN."Normalized",
    DR."IDR_PRO_ID",
    DR."IDR_POBJ_ID",
    DR."IDR"
    FROM
    MAJOR_MINOR_NORMALIZED MN FULL OUTER JOIN IDR DR
    ON
    MN."PRO_ID" = DR."IDR_PRO_ID" AND
    MN."POBJ_ID" = DR."IDR_POBJ_ID" ) X,
    (SELECT
    EE."PRO_ID" EE_PRO_ID,
    EN."PRO_ID" EN_PRO_ID,
    EE."POBJ_ID" EE_POBJ_ID,
    EN."POBJ_ID" EN_POBJ_ID,
    EN."Major" "Major", EN."Minor" "Minor", EN."Normalized" "Normalized",
    EN."Normalized" / DECODE(EE."External_Effort",0,NULL,EE."External_Effort") "EDR"
    FROM
    EXTR_MAJOR_MINOR_NORMALIZED EN FULL OUTER JOIN EXTERNAL_EFFORT EE
    ON
    EE."PRO_ID" = EN."PRO_ID" AND
    EE."POBJ_ID" = EN."POBJ_ID") Y
    WHERE
    PRO.ID = 2673 AND
    2673 = POBJ.PRO_ID AND
    2673 = DECODE(X."PRO_ID",NULL,2673,X."PRO_ID") AND
    2673 = DECODE(X."IDR_PRO_ID",NULL,2673,X."IDR_PRO_ID") AND
    POBJ.ID = DECODE(X."POBJ_ID",NULL,POBJ.ID,X."POBJ_ID") AND
    POBJ.ID = DECODE(X."IDR_POBJ_ID",NULL,POBJ.ID,X."IDR_POBJ_ID") AND
    2673 = DECODE(Y."EE_PRO_ID",NULL,2673,Y."EE_PRO_ID") AND
    2673 = DECODE(Y."EN_PRO_ID",NULL,2673,Y."EN_PRO_ID") AND
    POBJ.ID = DECODE(Y."EE_POBJ_ID",NULL,POBJ.ID,Y."EE_POBJ_ID") AND
    POBJ.ID = DECODE(Y."EN_POBJ_ID",NULL,POBJ.ID,Y."EN_POBJ_ID")
    In the above query all the X Contents have data and Y Contents are not having data but i need to display if X contents are there and make Y contents as Blank if no data exists
    The Query will return value ony if the data existing both X and Y
    if either one of the X or Y having data it will return no data found how to give the where clause condtion for such cases i tryed many ways was not able to get the result
    thanks
    Sudhir

    I did like this
    Create or Replace View IDRS as
    SELECT
    MN."PRO_ID",
    MN."POBJ_ID",
    MN."Major",
    MN."Minor",
    MN."Normalized",
    DR."IDR_PRO_ID",
    DR."IDR_POBJ_ID",
    DR."IDR"
    FROM
    MAJOR_MINOR_NORMALIZED MN FULL OUTER JOIN IDR DR
    ON
    MN."PRO_ID" = DR."IDR_PRO_ID" AND
    MN."POBJ_ID" = DR."IDR_POBJ_ID
    CREATE OR REPLACE FORCE VIEW "EXTERNAL_DEFECT_RATE" ("EE_PRO_ID", "EN_PRO_ID", "EE_POBJ_ID", "EN_POBJ_ID", "Major", "Minor", "Normalized", "External_Effort", "EDR") AS
    SELECT
    EE."PRO_ID" EE_PRO_ID,
    EN."PRO_ID" EN_PRO_ID,
    EE."POBJ_ID" EE_POBJ_ID,
    EN."POBJ_ID" EN_POBJ_ID,
    EN."Major", EN."Minor", EN."Normalized",EE."External_Effort",
    EN."Normalized" / DECODE(EE."External_Effort",0,NULL,EE."External_Effort") "EDR"
    FROM
    EXTR_MAJOR_MINOR_NORMALIZED EN FULL OUTER JOIN EXTERNAL_EFFORT EE
    ON
    EE."PRO_ID" = EN."PRO_ID" AND
    EE."POBJ_ID" = EN."POBJ_ID"
    now i am trying to create a full outer join i am getting errors like this
    Select *
    from
    EXTERNAL_DEFECT_RATE edr full outer join on IDRS
    on
    idrs."pro_id" = edr."EE_PRO_ID" and
    simileare other join condtion
    but i get Column Ambigiously defined error
    tx
    Sudhir

  • CSV spreadsheet returning "no data found"

    Hi,
    In one of the reports, I enabled CSV Output so the report can be downloaded.
    When I download it, using Excel 2000, I have no problem, I can see all the right data.
    However, one of my user, who uses Excel 2002, when saves the file and opens it, returns "no data found" on screen.
    Is this an Excel issue? Is Apex not compatible with Excel 2002? Please advise.
    Thanks!

    Do you have any items on your report page, which you use as a condition for the report? Eventually, you need to compute those items on load. If I remember correctly that was the problem I had before.
    Denes Kubicek

  • Discoverer Report  returning ' no data  found '

    Hi  ...
    i  have an issue with one discoverer  report  .
    Discoverer report  name : EDI Price Exception Report.
    when i ran the report  in Discoverer  Desktop edition  It is returning 'No Data Found ' But  i am taken the  Query from admin edition  and tried to  ran in  PL/SQL Developer/TOAD  by setting  Org_id condition
    it's returning Data  . the Desktop Edition of Discoverer for  some specific date  Range  it's giving Data  But  from last month on wards  it's not returning any Data.
    in Discoverer Report  Desktop  it's not retuning the Data from  November to till date
    Oracle  Applications  11i
    Discoverer 4i
    Oracle Data base :9i 
    OS : Windows.
    Attached the Sql  which i used to generate the Report :
    I HAVE USED THE FOLLOWING  :-for initialize the profile options
    EXEC FND_GLOBAL.APPS_INITIALIZE (0,52163,660);
    EXEC APPS.FND_CLIENT_INFO.SET_ORG_CONTEXT(2922);
      SELECT A.CUST_PO_NUMBER,
             A.ORDER_NUMBER,
             A.ORDERED_DATE,
             A.ORDER_TYPE,
             -- C.CUSTOMER_ID,
             C.CUSTOMER_NUMBER,
             C.CUSTOMER_NAME,
             B.LINE_NUMBER,
             B.ORDERED_ITEM,
             MSI.SEGMENT1 ACCO_ITEM,                               -- GRW 20060407
             MSI.DESCRIPTION,
             -- MSI.INVENTORY_ITEM_ID,
             (SELECT MCI.CUSTOMER_ITEM_NUMBER
                FROM MTL_CUSTOMER_ITEMS MCI,
                     MTL_CUSTOMER_ITEM_XREFS MCIX,
                     MTL_SYSTEM_ITEMS_B MSIB
               --  MTL_PARAMETERS          MP
               WHERE     MCI.CUSTOMER_ID = C.CUSTOMER_ID                 --1814924
                     AND MCI.CUSTOMER_ITEM_ID = MCIX.CUSTOMER_ITEM_ID
                     AND MCIX.INVENTORY_ITEM_ID = MSIB.INVENTORY_ITEM_ID
                     AND MSIB.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID   --869899
                     AND MSIB.ORGANIZATION_ID = MTP.ORGANIZATION_ID --MP.ORGANIZATION_ID
                     AND MTP.ORGANIZATION_CODE = 'BRM'
                     AND MCI.CUSTOMER_ITEM_NUMBER = B.ORDERED_ITEM
                     AND NVL (mci.inactive_flag, 'N') <> 'Y'
                     AND NVL (mcix.inactive_flag, 'N') <> 'Y')
                CUSTOMER_ITEM,
                     XXAB_ITEM_XREFS.GET_GBC_ITEM_NUM (B.ORDERED_ITEM) GBC_ITEM_NUMBER,
             B.ORDERED_QUANTITY,
             B.PRICE_LIST,
             B.UNIT_SELLING_PRICE,
             B.UNIT_LIST_PRICE,
                   TO_NUMBER (B.ATTRIBUTE7) CUST_SENT_PRICE,
             apps.XXAB_CUST_SENT_PRICE_CONV_SO (C.customer_number,
                                                B.ordered_item,
                                                B.header_id,
                                                B.line_number,
                                                B.unit_selling_price,
                                                B.attribute7,
                                                B.pricing_quantity_uom,
                                                B.attribute4)
                CUST_SENT_PRICE_CONVERTED,
             ABS ( (B.UNIT_SELLING_PRICE
                    - apps.XXAB_CUST_SENT_PRICE_CONV_SO (C.customer_number,
                                                         B.ordered_item,
                                                         B.header_id,
                                                         B.line_number,
                                                         B.unit_selling_price,
                                                         B.attribute7,
                                                         B.pricing_quantity_uom,
                                                         B.attribute4)))
                DIFFERENCE,
                      MTP.ORGANIZATION_CODE,
             B.SHIP_TO_LOCATION
        FROM OE_ORDER_HEADERS_V A,
             OE_ORDER_LINES_V B,
             RA_CUSTOMERS C,
             MTL_PARAMETERS MTP,
             MTL_SYSTEM_ITEMS_B MSI
       WHERE     A.HEADER_ID = B.HEADER_ID
             AND A.SOLD_TO_ORG_ID = C.CUSTOMER_ID
             -- Added by Gati on 19-Oct-2012, tkt - INC000000118962
             AND ROUND (TO_NUMBER (apps.XXAB_CUST_SENT_PRICE_CONV_SO (
                                      C.customer_number,
                                      B.ordered_item,
                                      B.header_id,
                                      B.line_number,
                                      B.unit_selling_price,
                                      B.attribute7,
                                      B.pricing_quantity_uom,
                                      B.attribute4)),
                        2) <> B.UNIT_SELLING_PRICE
             --AND ROUND(TO_NUMBER(B.ATTRIBUTE7), 2) <> B.UNIT_SELLING_PRICE
             --AND     a.ship_from_org_id = mtp.organization_id
             AND B.SHIP_FROM_ORG_ID = MTP.ORGANIZATION_ID          -- GRW 20060413
             --AND     a.ship_from_org_id = msi.organization_id
             AND B.SHIP_FROM_ORG_ID = MSI.ORGANIZATION_ID          -- GRW 20060413
             AND B.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID       -- GRW 20060407
             AND A.ORDER_SOURCE_ID = 6
             AND A.ORG_ID = B.ORG_ID
             AND TO_CHAR (A.ordered_date, 'DD-MON-YYYY') between  '01-NOV-2013' and  '03-NOV-2013'
             and mtP.organization_code='BRM'
                      AND A.ORG_ID = (SELECT HOU.ORGANIZATION_ID
                               FROM HR_OPERATING_UNITS HOU
                              WHERE HOU.NAME = '50 ACCO Canada')
             AND B.cancelled_flag <> 'Y'
             AND B.flow_status_code <> 'CANCELLED'
             AND B.ORDERED_ITEM <> 'INVALID_ITEM'
    ORDER BY a.order_number

    Hi,
    Assuming your initialization matches your discoverer login, it is pretty weird that you get no data.
    I am not sure how you got the SQL but i suggest you trace the session to get the exact SQL ran by the discoverer.
    You may find another condition or join that limits your data.
    Also another thing that you should try is to initial the session by using all the parameters (including the security group as you have in your discoverer login):
    begin
      fnd_global.APPS_INITIALIZE(user_id =>, resp_id =>, resp_appl_id =>, security_group_id =>);
    end

  • Help needed for data updation in User Defined Tables

    Hello Experts,
    I am developing one add-on in SAP B1 8.8 to input data in a User Defined Table described as under
    Table Name
    DriverMst UDT Type is No Object
    Description
    Stores the Driver master data which are used to get reference in Sale Delivery Form and Driver data management activity
    User defined fields
    Data Name
    Data source
    Size
    Pane Level
    Description
    Driver Code
    Code
    Alphanumeric
    0
    No object table fixed field
    System Name
    Name
    Alphanumeric
    30
    0
    No object table fixed field
    Full Name
    FullName
    Text
    50
    0
    Father Name
    FatherName
    Text
    50
    0
    Birth Date
    BirthDate
    Date
    0
    Phone Number
    PhoneNo
    Alphanumeric
    50
    0
    Mobile No
    MobileNo
    Alphanumeric
    13
    0
    I have created one form using screen painter displaying text boxes and bind them to the table.
    This form is working absolutely fine when there are some data in table (i.e. Browse using navigation)
    My problem is, when I click add button from tool bar the "OK" button turn to "Add" that means the form is set to Add mode, but when I click "Add" button after entering some data nothing happens and input data is not stored in Table. The same "OK" Button turned to "Update" when I do changes in loaded data, but my changes are not reflected to table after I click "Update".

    Thanks Nagarajan,
    None.
    There is no such query. The table fields is directly linked to Edit Box or Combo Box in form.
    From the examples I learned that I have to do something like this to get my table updated
    Dim oUsrTbl As SAPbobsCOM.UserTable
    Dim Res As Integer
    oUsrTbl = oCompany.UserTables.Item("DRIVERMST")
    oUsrTbl.Code = oBPC.Value 'Item Specific of Driver Code Edit Box
    oUsrTbl.Name = Left(oBPN.Value, 30) 'Item Specific of Name Edit Box
    oUsrTbl.UserFields.Fields.Item("U_FullName").Value = oMFN.Value
    oUsrTbl.UserFields.Fields.Item("U_FatherName").Value = oFTHN.Value
    oUsrTbl.UserFields.Fields.Item("U_BirthDate").Value = oDOB.Value
    oUsrTbl.UserFields.Fields.Item("U_PhoneNo").Value = oPHN.Value
    (Similar For rest ofthe fields)
    Res = oUsrTbl.Add()
    Just let me know that is this necessary to do like above.. To be frank there are few more fields and matrices on the form which I didn't mentioned. I am just trying to get recovered from first step to proceed further.
    Regards

  • How to read and write data to a user defined table?

    I have created a srf with 2 edit box and a ok buttin, I want to insert data to the user defined table i created using sql query while i press OK button..
    Please provide the complete code to insert and select da from the user defined table.

    Hi,
    You can use the code below.
    Dim ret As Long
    d
    Private Sub Add_Table_Click()
        Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
        Set oUserTablesMD = oCompany.GetBusinessObject(oUserTables)
        ' When adding user tables or fields, use a prefix
        ' identifying your partner name space. This will
        ' prevent collisions from different partner add-ons
        ' SAP's name space prefix is "BE_"
        'Set the two mandatory fields
        oUserTablesMD.TableName = "T1"
        oUserTablesMD.TableDescription = "Table1"
        'Add the table (which contains 2 default, mandatory fields, 'Code' and 'Name')
        ret = oUserTablesMD.Add
        If ret <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Table: " & oUserTablesMD.TableName & " was added successfully"
        End If
    End Sub
    Private Sub Add_UDF_Click()
        Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
        Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)
        oUserFieldsMD.TableName = "T1"
        oUserFieldsMD.Name = "AlbUDF"
        oUserFieldsMD.Description = "Albert UDF"
        'Add the field to the table
        lRetCode = oUserFieldsMD.Add
        If lRetCode <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Field: '" & oUserFieldsMD.Name & "' was added successfuly to " & oUserFieldsMD.TableName & " Table"
        End If
    End Sub
    Private Sub Add_Data_Click()
        Dim oUserTable As SAPbobsCOM.UserTable
        Set oUserTable = oCompany.UserTables.Item(1)
        oUserTable.GetByKey ("T1")
        'Set default, mandatory fields
        oUserTable.Code = "A"
        oUserTable.Name = "Albert"
        'Set user field
        oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"
        oUserTable.Add
        If ret <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
        End If
    End Sub
    Regards,
    Noor

  • Get_num_value return no data found with headstart 6.5.2.3

    Hi,
    We are migrating an application based on headstart (capi generator 6.0.2.1). Our migration upgrade headstart to 6.5.2.3 (capi generator 6.5.3.4).
    The capi generator 6.5.3.4 generate the get_row function, but this function doesn't call the find_on_stack function. With the old version of headstart, the get_row call find_on_stack. On another project I did for another company, I see that the capi generator 6.5.2 generate the get_row and this function call the find_on_stack.
    The capi generator change after the version 6.5.2. I search on this forum and I see this "2227746 - ENHANCE RULEFRAME PERFORMANCE BY MINIMIZING CAPI USE OF FIND_ON_STACK" !
    Our application has business rules that call get_num_value, get_char_value, etc... These get_???_value call get_row and get_row call slct function of the tapi.
    Before the migration, these get_???_value functions returned always a row. Because the get_row scans the pl/sql table with the find_on_stack function.
    Now, these get_???_value functions return the error no data found !!!. The function doesn't call the find_on_stack, but call the slct function of the tapi. The slct returns no data found.
    I have this bug (no data found) when a business rule is executed from a delete cascade. The parent row is not there and the br returns no data found. The old version search the parent row with the find_on_stack and returns the row.
    So, I suppose that the "ENHANCE 2227746" drop too much find_on_stack call !
    Do you have a patch for this or I modify the capi generator ?
    Thanks.

    Geert,
    The workaround mentioned above is not sufficient. It makes sure the correct value is returned inside a single transaction, e.g. when a transaction is rolled back, but when a new transaction is opened, it will still return the cached values, even though the database value might have changed between the closing of the first and the opening of the new transaction.
    To make sure the correct value is returned, we should also keep track of the id of the transaction in which the cached values are stored. Only when this ID is the same as the ID of the current transaction, we can be sure the cached value is the correct one. In all other cases the database value must be used.
    The following changes can be implemented as a workaround:
    In the CAPI generator package HSU_CAPF:
    - In procedure create_declarations add declarations of package variables to store transaction id for the cached values g_current_row and g_cached_row.
    - In procedure create_init fill the transaction id when g_current_row is filled.
    - In procedure create_get_row:
    - Enclose if-statement as mentioned above, to make sure correct value is returned after transaction is closed      
    - Add extra restriction to the if-statements to determine whether package variables can be used
    - remove part to use value from CAPI stack      
    - fill transaction id when g_cached_row is filled.
    This solution slows down the retrieval of data via the get_% functions. It only uses cached values when they are cached in the same transaction as they are retrieved in.
    Hope this helps,
    Harold Oortwijn

  • PL/SQL Using SQL%NOTFOUND to raise a user defined exception in a function

    I have written the following function for finding the number of items in stock in the item table.
    CREATE OR REPLACE function getAmount (ItemID IN NUMBER)
    RETURN NUMBER
    AS
    invalid_id EXCEPTION;
    returnedQty number;
    BEGIN
    Select qty
    Into returnedQty
    From item
    Where itemNo = ItemID;
    RETURN (returnedQty);
    IF SQL%NOTFOUND THEN
    RAISE invalid_id;
    END IF;
    COMMIT;
    Exception
    WHEN invalid_id THEN
    DBMS_OUTPUT.PUT_LINE('Invalid ID entered');
    END getAmount;
    The function compiles successfully, although there is a problem that Oracle is not handling my user-defined exception invalid_id
    If I use the following for a valid itemID:
    DECLARE
    return_value number;
    BEGIN
    return_value := getAmount(1);
    DBMS_OUTPUT.PUT_LINE (return_value);
    END;
    then the function returns the quantity of items in stock correctly.
    However, if I enter an incorrect itemID, say 20
    DECLARE
    return_value number;
    BEGIN
    return_value := getAmount(20);
    DBMS_OUTPUT.PUT_LINE (return_value);
    END;
    The invalid_id exception is not raised, and the Oracle errors says: no_data_found and the function has not returned a value. If I add a no_data_found exception, this works perfectly, but for this assignment I must write my own user-defined error.
    Any help would be very much appreciated!
    Thank you.

    What you're trying to do, is to use an implicit cursor. Implicit cursors will raise no_data_found and too_many_rows in case of an error. Explicit cursors will not.
    Also, you have a small coding error ... a little rewrite and your code will do as you want to:
    CREATE OR REPLACE function getAmount (ItemID IN NUMBER)
    RETURN NUMBER
    AS
    invalid_id EXCEPTION;
    returnedQty number;
    cursor citem is
    Select qty
    From item
    Where itemNo = ItemID;
    fnd boolean;
    BEGIN
    open citem;
    fetch citem Into returnedQty;
    fnd := citem%found;
    close citem;
    if fnd then
    RETURN (returnedQty);
    else
    RAISE invalid_id;
    END IF;
    /* Do not catch your own exception or the calling code will not receive it.
    Exception
    WHEN invalid_id THEN
    DBMS_OUTPUT.PUT_LINE('Invalid ID entered');
    END getAmount;
    Your problem is, you're not using a package. This means, that the calling code has no way of catching this user-defined exeption. The correct way is to define a package, define the userdefined exception in the package and refer to it in your code:
    create or replace package amt
    is
    invalid_id EXCEPTION;
    function getAmount (ItemID IN NUMBER)
    RETURN NUMBER;
    end;
    create or replace package body amt
    is
    function getAmount (ItemID IN NUMBER)
    RETURN NUMBER
    AS
    returnedQty number;
    cursor citem is
    Select qty
    From item
    Where itemNo = ItemID;
    fnd boolean;
    BEGIN
    open citem;
    fetch citem Into returnedQty;
    fnd := citem%found;
    close citem;
    if fnd then
    RETURN (returnedQty);
    else
    RAISE invalid_id;
    END IF;
    end;
    end; -- end package
    To do a simple test, you'll do:
    declare
    a number;
    begin
    a := amt.getAmount(123);
    dbms_output.put_line('The result is '||a);
    exception
    when amt.invalid_id then
    dbms_output.put_line('ID not found');
    end;
    Other ways is to raise the exception in your no_data_found block.
    But I'm REALLY puzzled if there's really someone out there who prefers a user-defined exception instead of the clearly defined NO_DATA_FOUND exception.
    I can't be sure of course, but are you sure what they mean is they don't want ANY exception? That's a pretty common requirement.
    In general - explicit cursors are a bit faster because Oracle does not have to do a second fetch to determine TOO_MANY_ROWS. And it's not too much additional writing. Explicit cursors will never raise exceptions - unless you use dynamic sql and your SQL is invalid.
    Good luck

  • User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_f

    Hi Expert,
    While running the Order Import i am getting the error please help us :
    Order Import Concurrent Program
    Concurrent Program Parameters
    Validate Only: N
    Order Source:
    Order Ref:
    Sold To Org Id:
    Sold To Org:
    Change Sequence:
    Performance Parameter: Y
    Trim Blanks: N
    Operation:
    Number of Instances: 0
    Debug Level: 0
    Request Id: 4471
    Org Id: 2453
    Failed to perform Action Request BOOK_ORDER
    Failed to perform Action Request BOOK_ORDER
    No. of orders found: 1
    No. of orders imported: 0
    No. of orders failed: 1
    Source/Order/Seq/Line Message
    10/1046001534//2 ATP Process resulted in no data
    10/1046001534//2 User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_from_tbl
    10/1046001534//2 User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_from_rec
    End of Order Import Concurrent Program
    Regards,
    Suraj

    And also check
    Order Import error : User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Action_Undemand,User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Action_Reschedule [ID 737031.1]

  • Help in user defined exception handler

    Hi
    Can some one help in solving this error .
    when i run my procedure i get this error which is given below .
    ORA-06510 PL/SQL unhandeled user defined exception at line 7
    Procedure FMG_EXTRACT_MOTORBIKE_NEWBUS (P_NSSC_YN VARCHAR2) IS
    l_start date;
    l_end date;
    cursor motorbike_rec is
    select
    c.id,
    k.id pak_id,
    p.ref,
    i.description,
    i.current_status,
    i.premium,
    i.sum_insured,
    mv.registration_no,
    mv.cc_rating,
    nl.ncl_level,
    nl.percentage_discount,
    dp.full_name main_driver,
    dpd.birth_date,
    e.user_name entered_by,
    ep.full_name emp_name,
    fmg_get_imposed_terms(i.id,'. ',';') imposed_terms
    from
    fmg_clients c,
    fmg_client_paks k,
    fmg_policies p,
    fmg_Policy_items i,
    fmg_mv_usages u,
    fmg_people dp,
    fmg_people_details dpd,
    fmg_employees e,
    fmg_people ep,
    fmg_motor_vehicles mv,
    fmg_ncb_levels nl
    where i.date_created>=l_start
    and i.date_created<l_end
    and i.pol_id=p.id
    and p.ctp_id=k.id
    and k.cli_id=c.id
    and i.id=u.poi_id(+)
    and u.per_id=dp.id(+)
    and dp.id=dpd.per_id(+)
    and i.id=mv.poi_id(+)
    and i.ncl_id=nl.id(+)
    and ( (i.pit_pro_code in ('TFF','FMC','FMT','FMF','FBK','PMC','TPO','MCL'))
    or (i.pit_pro_code = 'CMV' and i.pit_code = 'MCL')
    or (i.pit_pro_code = 'PMS' and i.pit_code = 'MCL')
    or (i.pit_pro_code = 'PMT' and i.pit_code in ('MCT','MCF'))
    and i.user_created=e.user_name
    and ( (e.business_unit='BCC' and P_NSSC_YN='Y') OR (nvl(e.business_unit,'X')<>'BCC' and P_NSSC_YN='N') )
    and e.per_id=ep.id;
    l_file UTL_FILE.FILE_TYPE;
    l_file_name varchar2(100);
    l_data VARCHAR2(4000);
    BEGIN
    if P_NSSC_YN='Y' then
    l_start := trunc(sysdate)-1;
    l_end := trunc(sysdate);
    l_file_name := 'MotorCycle_Daily_'||to_char(l_start)||'.csv';
    l_file := utl_file.fopen( fmg_re_filepath('SSC'), l_file_name, 'W' );
    else
    l_start := to_date('01-' || to_char(sysdate-28,'MM-YYYY'));
    l_end := last_day(to_date('01-' || to_char(sysdate-28,'MM-YYYY')));
    l_file_name := 'MotorCycle_Monthly_'||to_char(l_start)||'_'||to_char(l_end)||'.csv';
    l_file := utl_file.fopen( fmg_re_filepath('GAU'), l_file_name, 'W' );
    end if;
    l_data := '"Client ID","Pak ID","Policy Ref","Item Desc","RegoNo","CC","Item Status","Premium","Sum Insured",' ||
    '"NCB Level","NCB%","Main Driver","Birth Date","Imposed terms","EnteredBy","Employee Name"';
    utl_file.put_line(l_file, l_data );
    for i in motorbike_rec loop
    l_data :=
    to_char(i.id) || ',' ||
    to_char(i.pak_id) || ',' ||
    i.ref || ',' ||
    '"' || i.description || '",' ||
    '"' || i.registration_no || '",' ||
    to_char(i.cc_Rating) || ',' ||
    i.current_status || ',' ||
    to_char(i.premium) || ',' ||
    to_char(i.sum_insured) || ',' ||
    to_char(i.ncl_level) || ',' ||
    to_char(i.percentage_discount) || ',' ||
    '"' || i.main_driver || '",' ||
    to_char(i.birth_date) || ',' ||
    '"' || i.imposed_terms || '",' ||
    i.entered_by || ',' ||
    '"' || i.emp_name || '"' ;
    utl_file.put_line(l_file,l_data);
    end loop;
    utl_file.fclose( l_file );
    exception
    when others then
    if utl_file.is_open(l_file) then
    utl_file.fclose( l_file );
    end if;
    raise;
    END;

    What does fmg_re_filepath('SSC') return? Are their sufficient rights with Oracle user on the location that is returned by this function?
    Which OS are you using?

  • How to handle user defined exception from C#?

    Hi:
    I have some PL/SQL code that will throw a user defined exception if certain conditions are met. How do I handle user defined exceptions if this procedure/function is being called from C#? C# can handle a normal Oracle SQL error (e.g. ORA-XXXX) because they are defined in the proper class, but how do I get it to know about my user defined exception? Does anyone have any links to examples of doing this?
    Thanks.

    Hi Gaff,
    Is there a particular problem you're having doing this? It works as normal for me...
    Cheers
    Greg
    PLSQL
    =========
    create or replace procedure throwsomething as
    begin
    raise_application_error(-20001,'kaboom');
    end;
    ODP
    =====
        class Program
            static void Main(string[] args)
                using (OracleConnection con = new OracleConnection())
                    con.ConnectionString = "user id=scott;password=tiger;data source=orcl";
                    con.Open();
                    using (OracleCommand cmd = new OracleCommand())
                        cmd.CommandText = "begin throwsomething;end;";
                        cmd.Connection = con;
                        try
                            cmd.ExecuteNonQuery();
                        catch (OracleException oe)
                            Console.WriteLine("caught " + oe.Message);
    OUTPUT
    ========
    caught ORA-20001: kaboom
    ORA-06512: at "SCOTT.THROWSOMETHING", line 3
    ORA-06512: at line 1

Maybe you are looking for