Error Executing a Function

Environment: Oracle 10gR2 on Windows Server 2008 (64-bit)
I have created this Function:
-- ===========================================================================
-- Function: f_delete_gl_account
-- Author: Carol Burrows, dbcSMARTsoftware Inc.
-- Translation: Murray Sobol, dbcSMARTsoftware Inc.
-- Purpose: This is a database Function which deletes a
-- GL_Account_Nbr from all tables.
-- Last Modified: Thursday May 27, 2010
-- Parameter(s): ac_gl_account_nbr varchar2(75) (GL_Acct_Nbr)
-- Return Code(s): SUCCESS 1
-- ERROR -1 -> Cannot get GL_Acct_Nbr
-- -225 -> Cannot delete s1_gl_account_posting records
-- -226 -> Cannot delete s1_gl_account records
-- -99 -> Abnormal termination
-- ===========================================================================
CREATE or replace FUNCTION f_delete_gl_account
(ac_gl_account_nbr IN varchar)
RETURN NUMBER
IS
lc_gl_account_nbr varchar2(75);
c number;
rows_deleted number;
BEGIN
IF (ac_gl_account_nbr IS NULL) THEN
RETURN (-1);
END IF;
lc_gl_account_nbr := ac_gl_account_nbr;
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, 'DELETE FROM br_gl_account WHERE gl_acct_nbr = ' || lc_gl_account_nbr, DBMS_SQL.NATIVE);
rows_deleted := DBMS_SQL.EXECUTE(c);
dbms_output.put_line('The total number of rows deleted are ' || rows_deleted);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('SQLCODE= ' || SQLCODE);
dbms_output.put_line('SQLERRM= ' || SQLERRM);
dbms_output.put_line('No rows deleted');
RETURN(-2);
END;
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, 'UPDATE fin_allocation SET allocate_gl_acct_nbr = NULL WHERE allocate_gl_acct_nbr = ' || lc_gl_account_nbr, DBMS_SQL.NATIVE);
rows_deleted := DBMS_SQL.EXECUTE(c);
dbms_output.put_line('The total number of rows updated are ' || rows_deleted);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('No rows deleted');
RETURN(-3);
END;
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c,'UPDATE fin_allocation ' ||
'SET contra_gl_acct_nbr = NULL ' ||
'WHERE contra_gl_acct_nbr = lc_gl_account_nbr', DBMS_SQL.NATIVE);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('No rows updated');
RETURN(-4);
END;
-- ============================================================
-- All Child data has been deleted, now Delete data from
-- s1_gl_account_posting and s1_gl_account tables
-- ============================================================
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, 'UPDATE s1_gl_account_posting SET gl_acct_nbr = NULL WHERE gl_acct_nbr = lc_gl_account_nbr', DBMS_SQL.NATIVE);
rows_deleted := DBMS_SQL.EXECUTE(c);
dbms_output.put_line('The total number of rows deleted are ' || rows_deleted);
EXCEPTION
WHEN OTHERS THEN
RETURN(-225);
END;
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, 'DELETE FROM s1_gl_account WHERE gl_acct_nbr = lc_gl_account_nbr', DBMS_SQL.NATIVE);
rows_deleted := DBMS_SQL.EXECUTE(c);
dbms_output.put_line('The total number of rows deleted are ' || rows_deleted);
EXCEPTION
WHEN OTHERS THEN
RETURN(-226);
END;
-- ============================================================
-- Process finished with SUCCESS
-- ============================================================
RETURN(1);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('SQLCODE= ' || SQLCODE);
dbms_output.put_line('SQLERRM= ' || SQLERRM);
RETURN(-999);
END;
which compiles OK.
When I test it using this SQL:
set serveroutput on
select f_delete_gl_account('1120000-4000-9999') from dual;
I get this error:
F_DELETE_GL_ACCOUNT('1120000-4000-9999')
-2
1 row selected.
SQLCODE= -14551
SQLERRM= ORA-14551: cannot perform a DML operation inside a query
No rows deleted
I am trying to avoid using dynamic SQL; instead I am using DBMS_SQL.OPEN_CURSOR and DBMS_SQL.PARSE
Any assistance would be appreciated.

Murray Sobol wrote:
I removed the last one.
BTW, the purpose of those statements was to show the Oracle error message and text if the Function should fail.
With those lines removed, I have now lost that capability.
I compiled it and tested it as before, the error is now:
F_DELETE_GL_ACCOUNT('1120000-4000-9999')
-999
1 row selected.Not at all true if you removed ALL the "exception when others".
Please go through the examples below, in the first set i use your "exception catching" method. Notice how you have NO IDEA which line number causes the exception.
Then in the second set, i run things the way they should be run, which do you find more informative?
FIRST (bad) SET
TUBBY_TUBBZ?exec :x := 0;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
begin
  2 
   if :x = 0
   then
      raise no_data_found;
   end if;
   if :x = 1
   then
      raise too_many_rows;
   end if;
exception
   when others then
      dbms_output.put_line('SQLCODE= ' || SQLCODE);
      dbms_output.put_line('SQLERRM= ' || SQLERRM);  
end;
SQLCODE= 100
SQLERRM= ORA-01403: no data found
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.15
TUBBY_TUBBZ?TUBBY_TUBBZ?   exec :x := 1;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
begin
  2 
   if :x = 0
   then
      raise no_data_found;
   end if;
   if :x = 1
   then
      raise too_many_rows;
   end if;
exception
   when others then
      dbms_output.put_line('SQLCODE= ' || SQLCODE);
      dbms_output.put_line('SQLERRM= ' || SQLERRM);  
end;
SQLCODE= -1422
SQLERRM= ORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00SECOND (gooder) set
TUBBY_TUBBZ?TUBBY_TUBBZ?   exec :x := 0;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
begin
  2 
   if :x = 0
   then
      raise no_data_found;
   end if;
   if :x = 1
   then
      raise too_many_rows;
   end if;
end;
begin
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 5
Elapsed: 00:00:00.01
TUBBY_TUBBZ?TUBBY_TUBBZ?   exec :x := 1;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
begin
  2 
   if :x = 0
   then
      raise no_data_found;
   end if;
   if :x = 1
   then
      raise too_many_rows;
   end if;
end;
begin
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 10
Elapsed: 00:00:00.01
TUBBY_TUBBZ?TUBBY_TUBBZ?   Please keep in mind this is trivial for tiny blocks like i'm demonstrating with, but imagine a procedure making many nested procedure calls, each procedure being 100's of lines long.

Similar Messages

  • Error executing custom function module

    Hi all,
    am trying to read a function module form my java code as below.
    There is no problem with the function module.
    I think there is some problem with the java code that is written. I am sure the problem lies with the  TABLES IT_PRODUCT_DATA STRUCTURE  ZOG_ITEM_SCREENSTR.
    Function module parameters and signature.
    FUNCTION ZGET_CUST_ORDERGUIDE_ITEMDATA.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IV_ORDER_GUID) TYPE  CRMT_OBJECT_GUID OPTIONAL
    *"     VALUE(IV_CUSTOMER) TYPE  BU_PARTNER
    *"  TABLES
    *"      IT_PRODUCT_DATA STRUCTURE  ZOG_ITEM_SCREENSTR
    Java Code that is Implemented is attached above.
    public ArrayList fetchOrderGuide(String customerNumber) {
              ArrayList itemList = new ArrayList();
                                       ItemSalesDoc itemSalesDoc = new ItemSalesDoc();
              if (log.isDebugEnabled()) {
                   log.debug("inside ZAdminLogin");
              try
              JCoConnection aJCoCon = (JCoConnection) getConnectionFactory().getConnection(com.sap.isa.core.eai.init.InitEaiISA.FACTORY_NAME_JCO,
                                                                                                 com.sap.isa.core.eai.init.InitEaiISA.CON_NAME_ISA_STATEFUL);
                   try
                        try
                             JCO.Function zFetchSalesOrderFunctionModule = aJCoCon.getJCoFunction("ZGET_CUST_ORDERGUIDE_ITEMDATA");
                             // set the import values
                             Table zItemsTable = new Table("ITEMS");
                                       //zPackagesTable.addColumn(Table.TYPE_STRING,"HUI");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JOGITEM");
                             zItemsTable.addColumn(Table.TYPE_INT,"JPRUOM");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JPRSEQ");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JOGDESC");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JLINE");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JOGNR");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JPACK");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JSIZE");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JBRAND");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JWEEKAVG");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JDELFLAG");
                             JCO.ParameterList importParams = zFetchSalesOrderFunctionModule.getImportParameterList();
                             importParams.setValue("BP-104", "IV_CUSTOMER");
                             aJCoCon.execute(zFetchSalesOrderFunctionModule);
                             JCO.Table zRtItems = zFetchSalesOrderFunctionModule.getTableParameterList().getTable("IT_PRODUCT_DATA");
                                            int numberOfPackages = zRtItems.getNumRows();
                                            if (log.isDebugEnabled()) {
                                                 log.debug("number of packages " + numberOfPackages);
                                            if (numberOfPackages > 0)
                                                 for (int j=0; j<numberOfPackages; j++)
                                                      TableRow itemRow = zItemsTable.insertRow();
                                                      //itemRow.setRowKey(new TechKey(zRtItems.getString("EXIDV")));
                                                      //packageRow.getField("HUI").setValue(zGoods.getString("EXIDV"));
                                                      itemRow.getField("JOGITEM").setValue(zRtItems.getString("OGITEM"));
                                                      itemRow.getField("JPRSEQ").setValue(zRtItems.getString("PRSEQ"));
                                                      itemRow.getField("JOGDESC").setValue(zRtItems.getString("OGDESC"));
                                                      itemRow.getField("JLINE").setValue(zRtItems.getString("LINE"));
                                                      itemRow.getField("JOGNR").setValue(zRtItems.getString("OGNR"));
                                                      itemRow.getField("JPACK").setValue(zRtItems.getString("PACK"));
                                                      itemRow.getField("JSIZE").setValue(zRtItems.getString("SIZE"));
                                                      itemRow.getField("JBRAND").setValue(zRtItems.getString("BRAND"));
                                                      itemRow.getField("JWEEKAVG").setValue(zRtItems.getString("WEEKAVG"));
                                                      itemRow.getField("JDELFLAG").setValue(zRtItems.getString("DELFLAG"));
                                                      zRtItems.nextRow();
                        catch(JCO.AbapException abapException)
                             //Exception thrown, user is not valid
                             if(log.isDebugEnabled())
                                  log.debug(  abapException.getKey());
                   catch (Exception ex)
                        if (log.isDebugEnabled()) {
                             log.debug(ex);
                   finally
                        aJCoCon.close();
              catch(BackendException beeEx)
                   if(log.isDebugEnabled())
              return itemList;     
    LOGDETAILS
    ZGET_CUST_ORDERGUIDE_ITEMDATA:: - IN: INPUT * IV_CUSTOMER='BP-104' IV_ORDER_GUID='00000000000000000000000000000000'
    Oct 9, 2008 6:48:41 AM,507 SAPEngine_Application_Thread[impl:3]_7 Error com.sap.isa.core.eai.sp.jco.JCoConnectionStateful Error occcurred in EAI layer "com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet".
    [EXCEPTION]
    com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet
                at com.sap.mw.jco.JCO$Record.checkRowCapacity(JCO.java:12354)
                at com.sap.mw.jco.JCO$Record.getString(JCO.java:12827)
                at com.sap.mw.jco.JCO$Field.getString(JCO.java:11055)
                at com.sap.isa.core.eai.sp.jco.JCoUtil.paramIterator(JCoUtil.java:412)
                at com.sap.isa.core.eai.sp.jco.JCoUtil.logCall(JCoUtil.java:382)
                at com.sap.isa.core.eai.sp.jco.JCoUtil.logCall(JCoUtil.java:236)
                at
    All helpful answers will be rewarded heavily

    hi,
    first of all you do not set the import values for your table correct. You should do something similar like this:
    Function myFunction = connection.getJCoFunction(Z_FM");
    Table myTable = myFunction.getTableParameterList().getTable("Z_TABLE");
    for(int i=0; i<2; i++) {
        myTable.appendRow();
                        myTable.setValue(value1,"VALUE1");
                        myTable.setValue(value2,"vALUE2");
                   connection.execute(myFunction);
    Did you debug your java class? You should check at which point your java class throws the error.
    Regards
    Michael

  • Error while executing the function module BAPI_RE_CN_CREATE

    Dear All
    I was using the the function module BAPI_RE_CN_CREATE.  When I am trying to execute the function module I am getting the error message u201CBusiness transaction RECN doest existu201D. While inputting the parameters for the function module I have given RECN   In the input field TRANS. Requesting you to please kindly suggest.
    Regards.
    Varaprasad

    Hi Varaprasad,
    please try the following.
    1. Create a contract manually in the system
    2. Use BAPI_RE_CN_GET_DETAIL to show how the fields and structures are filled.
    3. Check and change the parameters for BAPI_RE_CN_CREATE accordingly.
    Hope that helps.
    Regards, Franz

  • Error while executing the function

    hi,
    I have a table with the following data.
    T_1          T_2 T_3        T_4
    a.1            1 aa         ff
    a.1            2 ab         ff
    a.2            1 ba         ff
    a.2            2 bb         ff
    a.2            3 bc         ff
    a.2            4 bd         ff
    a.3            1 ca         ff
    a.3            3 cc         ff
    a.4            2 db         ffi want the data in the following way.
    col_1       col_2         col3
    a.1         1,2             aa ,ab
    a.2         1,2 ,3,4       ba,bb,bc,bd
    a.3         1,3             ca,cc
    a.4         2                db         For this , i have written a package as shown below.
    create or replace package t_emp_pkg as
    type typ_emp is record
    tv_t_1 t_Emp.t_1%type,
    tv_t_2 varchar2(20),
    tv_t_3 varchar2(20));
    type typ_emp_tab is table of typ_emp;
    function t_emp_func(pv_value in varchar2) return typ_emp_tab;
    end t_emp_pkg;
    create or replace package body t_emp_pkg as
    function t_emp_func(pv_value in varchar2) return typ_emp_Tab is
    cursor c1(v_value varchar2) is
    select distinct t_1 from t_emp where t_4 = v_value ;
    cursor c2(pv_t_1 varchar2) is
    select t_2,t_3 from t_emp
    where t_1 = pv_t_1;
    typ_emp_table typ_emp_tab := typ_emp_tab();
    t_count number := 0;
    c1_cur_rec c1%rowtype;
    c2_cur_rec c2%rowtype;
    v_temp_value1 varchar2(30);
    v_temp_value2 varchar2(30);
    begin
    open c1(pv_value);
    loop
    fetch c1 into c1_cur_rec;
    exit when c1%notfound;
    v_temp_value1 := null;
    v_temp_value2 := null;
    open c2(c1_cur_rec.t_1);
    loop
    fetch c2 into c2_cur_rec;
    exit when c2%notfound;
    v_temp_value1 := v_temp_value1||','||c2_cur_rec.t_2;
    v_temp_value2 := v_temp_value2||','||c2_cur_rec.t_3;
    end loop;
    --close c2;
    t_count := t_count+1;
    typ_emp_table(t_count).tv_t_1 := c1_cur_rec.t_1;
    typ_emp_table(t_count).tv_t_2 := v_temp_value1;
    typ_emp_table(t_count).tv_t_3 := v_temp_value2;
    --dbms_output.put_line(typ_emp_table(t_count).tv_t_1);
    --dbms_output.put_line(typ_emp_table(t_count).tv_t_2);
    --dbms_output.put_line(typ_emp_table(t_count).tv_t_3);
    end loop;
    close c1;
    return typ_emp_table;
    end;
    end;
    When i executed the function , i got the following error.
    SQL> declare
    2 v t_emp_pkg.typ_emp_tab := t_emp_pkg.typ_emp_tab();
    3 begin
    4 v := t_emp_pkg.t_emp_func('ff');
    5 for i in v.first..v.last loop
    6 dbms_output.put_line(v(i).tv_t_1 ||', '||v(i).tv_t_2||', '||v(i).tv_t_3);
    7 end loop;
    8 end;
    9 /
    declare
    ERROR at line 1:
    ORA-06533: Subscript beyond count
    ORA-06512: at "SCOTT.T_EMP_PKG", line 30
    ORA-06512: at line 4
    but when i am running this queries in anonymous block (i.e) using declare,begin,end , i am getting the data correctly.
      1  declare
      2  pv_value varchar2(5) := 'ff';
      3   cursor c1(v_value varchar2) is
      4  select distinct t_1 from t_emp where t_4 = v_value ;
      5  cursor c2(pv_t_1 varchar2) is
      6  select t_2,t_3 from t_emp
      7  where t_1 = pv_t_1;
      8  --typ_emp_table typ_emp_tab := typ_emp_tab();
      9  t_count number := 0;
    10  c1_cur_rec c1%rowtype;
    11  c2_cur_rec c2%rowtype;
    12  v_temp_value1 varchar2(300);
    13  v_temp_value2 varchar2(300);
    14  begin
    15  open c1(pv_value);
    16  loop
    17  fetch c1 into c1_cur_rec;
    18  exit when c1%notfound;
    19  v_temp_value1 := null;
    20  v_temp_value2 := null;
    21  open c2(c1_cur_rec.t_1);
    22  loop
    23  fetch c2 into c2_cur_rec;
    24  exit when c2%notfound;
    25  v_temp_value1 := v_temp_value1||','||c2_cur_rec.t_2;
    26  v_temp_value2 := v_temp_value2||','||c2_cur_rec.t_3;
    27  end loop;
    28  close c2;
    29  t_count := t_count+1;
    30  --typ_emp_table(t_count).tv_t_1 := c1_cur_rec.t_1;
    31  --typ_emp_table(t_count).tv_t_2 := v_temp_value1;
    32  --typ_emp_table(t_count).tv_t_3 := v_temp_value2;
    33  dbms_output.put_line(c1_cur_rec.t_1);
    34  dbms_output.put_line(v_temp_value1);
    35  dbms_output.put_line(v_temp_value2);
    36  end loop;
    37  close c1;
    38* end;
    39  /
    a.2
    ,1,2,3,4
    ,ba,bb,bc,bd
    a.3
    ,1,3
    ,ca,cc
    a.4
    ,2
    ,db
    a.1
    ,1,2
    ,aa,ab
    PL/SQL procedure successfully completed.So can anybody tell me why it is not executing correctly when executing as a function.
    Thanks in advance.

    hi devmiral,
    I am not sure exactly where i am making the mistake. I have modified the package but still i am getting the error.
    create or replace package body t_emp_pkg as
    function t_emp_func(pv_value in varchar2) return typ_emp_Tab is
    cursor c1(v_value varchar2) is
    select distinct t_1 from t_emp where t_4 = v_value ;
    cursor c2(pv_t_1 varchar2) is
    select t_2,t_3 from t_emp
    where t_1 = pv_t_1;
    typ_emp_table typ_emp_tab ;
    --:= typ_emp_tab();
    t_count number := 0;
    c1_cur_rec c1%rowtype;
    c2_cur_rec c2%rowtype;
    v_temp_value1 varchar2(30);
    v_temp_value2 varchar2(30);
    begin
    open c1(pv_value);
    loop
    fetch c1 into c1_cur_rec;
    exit when c1%notfound;
    v_temp_value1 := null;
    v_temp_value2 := null;
    open c2(c1_cur_rec.t_1);
    loop
    fetch c2 into c2_cur_rec;
    exit when c2%notfound;
    v_temp_value1 := v_temp_value1||','||c2_cur_rec.t_2;
    v_temp_value2 := v_temp_value2||','||c2_cur_rec.t_3;
    end loop;
    --close c2;
    t_count := t_count+1;
    typ_emp_table(t_count).tv_t_1 := c1_cur_rec.t_1;
    typ_emp_table(t_count).tv_t_2 := v_temp_value1;
    typ_emp_table(t_count).tv_t_3 := v_temp_value2;
    typ_emp_table := typ_emp_tab(c1_cur_rec.t_1,v_temp_value1,v_temp_value2);
    typ_emp_table.extend;
    end loop;
    close c1;
    return typ_emp_table;
    end;
    end;
    SQL> @t_emp_pkg_body.sql
    Warning: Package Body created with compilation errors.
    SQL> sho err
    Errors for PACKAGE BODY T_EMP_PKG:
    LINE/COL ERROR
    36/1     PL/SQL: Statement ignored
    36/18    PLS-00306: wrong number or types of arguments in call to
             'TYP_EMP_TAB'
    36/18    PLS-00306: wrong number or types of arguments in call to
             'TYP_EMP_TAB'
    36/18    PLS-00306: wrong number or types of arguments in call to
             'TYP_EMP_TAB'Thanks in advance.

  • Error while executing planning Function

    Hi All,
    I'm getting some error while executing planning function. Below are errors. Please check and provide solution.
    Errors occurred when executing planning function RTFMPF01/RTFMPG01
    Value 08 of chara Region does not correspond to the attrib.val MI of chara Store
    Value 10 of chara Region does not correspond to the attrib.val RM of chara Store
    Value 11 of chara Region does not correspond to the attrib.val NA of chara Store
    Thanks,
    Vamsi

    Hi,
    Value 08 of chara Region does not correspond to the attrib.val MI of chara Store
    Looks like there is a characteristics relationship which derives the attribute store from Region.
    Check the master data for Region for attribute Store and the corresponding values.
    The values that are maintained in the master data will only be allowed to enter in the cube.
    Thanks
    pratyush

  • Macro Error while executing planning functions or saving data

    Dear All,
    I am getting following error in BEx Analyzer while executing planning function or pressing a save button.
    Note: Excel is 2007 version.
    Cannot run the macro "XXXXXX.xlsx". The macro may not be available in this workbook or all macros may be disabled.
    I changed the settings in Macro Settings (Office Button -> Excel Options -> Trust Center -> Trust Center Settings-> Macro Settings) eventhough it is showing that above message.
    selected ->
    Enalble all macros
    Trust access to VBA project object model.
    If anybody faced this issue kindly reply to this.
    Best Regards,
    SG

    Hello everybody,
    i am facing exactlythe same issue! I am currently running GUI Patch Level 14 and BI Add on Patch Level 10.
    I have also adjusted all necessary settings in Excel Options like Activate all Macros and Trust VBA Coding.
    Does anybody have another Solution.
    As mentioned before Gui Patch 13 and BI Add On Patch 10 obviously arent the solutiuon.
    Best regards
    Janos

  • ORA-28112: failed to execute policy function - Error in Application Builder

    Hey all,
    I've added a policy function to one of my tables and now I'm getting this error when I try to update a report region that references that table.
    "Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-28112: failed to execute policy function"
    If I remove the policy then everything works fine. My application also runs fine with the policy in place. I just get these errors in the application builder when updating a report or an LOV that references the secure table.
    The parsing schema is APPL_USER.
    Here is the policy function:
    FUNCTION DOCUMENT_TABLE_POLICY (object_schema IN VARCHAR2 DEFAULT NULL
    ,object_name IN VARCHAR2 DEFAULT NULL)
    RETURN VARCHAR2 IS
    v_nt_seq NUMBER;
    BEGIN
    IF user = 'APPL_USER' OR INSTR(user, 'ITFC_') = 1 THEN
    RETURN NULL;
    END IF;
    IF V('APP_USER') IS NOT NULL THEN
    IF V('F_NT_SEQ') IS NOT NULL THEN
    v_nt_seq := V('F_NT_SEQ');
    ELSE
    SELECT NT_SEQ
    INTO v_nt_seq
    FROM APPL_USERS
    WHERE UPPER(NT_ID) = UPPER(V('APP_USER'));
    END IF;
    RETURN '(DOCUMENT_TYPE, MANAGED_BY_ELEMENT, PROGRAM_CODE, CONTRACT_NUMBER) IN (SELECT DISTINCT R.DOCUMENT_TYPE, USL.ELEMENT, USL.PROGRAM_CODE, USL.CONTRACT_NUMBER FROM IPRACA_USERS_SECURITY_LINK USL, IPRACA_SECURITY_ROLES R WHERE R.SECURITY_ROLE_SEQ = USL.SECURITY_ROLE_SEQ AND USL.NT_SEQ = ' || TO_CHAR(v_nt_seq) || ')';
    END IF;
    --UNAUTHORIZED USERS CAN SEE NO DATA
    RETURN '1=0';
    END;
    This is how I setup the policy:
    BEGIN
    DBMS_RLS.ADD_POLICY(
    object_schema => 'APPL_USER'
    ,object_name => 'APPL_DOCUMENT'
    ,policy_name => 'APPL_DOCUMENT_POLICY'
    ,function_schema => 'APPL_USER'
    ,policy_function=> 'APPL_SECURITY.DOCUMENT_TABLE_POLICY'
    END;
    Any help would be greatly appreciated!
    Thanks,
    Jonathan Hart
    APEX 3.1.1

    Thanks.
    After looking at it again, I think that may be the problem, too. I guess the APP_USER is set when in the application builder and the Builder is running the report query as it is being parsed which is causing the error. I added a Begin - Exception block around that query and everything seems to work now.
    Thanks again!

  • Error executing formula :scalar double argument expected in function [@DIV]

    Hi,
    I'm getting the following error when I try to run this calc. The syntax check says ok, but the calc won't run. I don't understand what the [@DIV] means ... Can someone help? Thanks!
    Error executing formula for [Alloc Factor] (line 0): scalar double argument expected in function [@DIV]
    sts = 1200400 CalcObject = DBadDebt
    Command Failed. Return Status = 1200400
    Fix(&Cscenario,@descendants("Currency"))
    /*Direct allocation for BNA cost center 10471*/
    FIX("Not Applicable Cost Center",CYTDC,"Bosch Power Tools Corded","Bosch Power Tools Cordless","Canada")
         "Alloc Factor"("Bad Debt" =
         "Net_Sales"->Input->&Cscenario /
         ("Net_Sales"->&Cscenario->"Canada"->"Bosch Power Tools"->Input);)
    ENDFIX
    FIX("Canada","Not Applicable Cost Center",CYTDC, "Bad Debt",@CHILDREN("Bosch Power Tools"))
    "Direct Alloc"("Bad Debt"="Alloc Factor"->"Bad Debt"*
    ("Input"->"Other Operating Income and Deductions"->"10471"->"Not Applicable Brand"->"Not Applicable Region"->"Current YTD");)
    ENDFIX
    /*Direct allocation for ACN cost center 10472*/
    FIX("Not Applicable Cost Center",CYTDC,"Bosch Accessories","Skil Accessories","VA Accessories","Canada")
         "Alloc Factor"("Bad Debt" =
         "Net_Sales"->Input->&Cscenario /
         ("Net_Sales"->&Cscenario->"Canada"->"Accessories"->Input);)
    ENDFIX
    FIX("Canada","Not Applicable Cost Center",CYTDC, "Bad Debt",@CHILDREN("Accessories"))
    "Direct Alloc"("Bad Debt"="Alloc Factor"->"Bad Debt"*
    ("Input"->"Other Operating Income and Deductions"->"10472"->"Not Applicable Brand"->"Not Applicable Region"->"Current YTD");)
    ENDFIX
    /*Direct allocation for SNA cost center 10470*/
    FIX("Not Applicable Cost Center",CYTDC,"Skil Power Tools Corded","Skil Power Tools Cordless","Canada")
         "Alloc Factor"("Bad Debt" =
         "Net_Sales"->Input->&Cscenario /
         ("Net_Sales"->&Cscenario->"Canada"->"Skil Power Tools"->Input);)
    ENDFIX
    FIX("Canada","Not Applicable Cost Center",CYTDC, "Bad Debt",@CHILDREN("Skil Power Tools"))
    "Direct Alloc"("Bad Debt"="Alloc Factor"->"Bad Debt"*
    ("Input"->"Other Operating Income and Deductions"->"10470"->"Not Applicable Brand"->"Not Applicable Region"->"Current YTD");)
    ENDFIX
    /*Direct allocation for MT cost center 10473*/
    FIX("Not Applicable Cost Center",CYTDC,"Measuring Tools","Canada")
         "Alloc Factor"("Bad Debt" =
         "Net_Sales"->Input->&Cscenario /
         ("Net_Sales"->&Cscenario->"Canada"->"Measuring Tools"->Input);)
    ENDFIX
    FIX("Canada","Not Applicable Cost Center",CYTDC, "Bad Debt","Measuring Tools")
    "Direct Alloc"("Bad Debt"="Alloc Factor"->"Bad Debt"*
    ("Input"->"Other Operating Income and Deductions"->"10473"->"Not Applicable Brand"->"Not Applicable Region"->"Current YTD");)
    ENDFIX
    /*Direct allocation for Service cost center 10474*/
    FIX("Not Applicable Cost Center",CYTDC,"Measuring Tools","Canada")
         "Alloc Factor"("Bad Debt" =
         "Net_Sales"->Input->&Cscenario /
         ("Net_Sales"->&Cscenario->"Canada"->"Skil Parts Brand","Bosch Parts Brand"->Input);)
    ENDFIX
    FIX("Canada","Not Applicable Cost Center",CYTDC, "Bad Debt","Skil Parts Brand","Bosch Parts Brand")
    "Direct Alloc"("Bad Debt"="Alloc Factor"->"Bad Debt"*
    ("Input"->"Other Operating Income and Deductions"->"10474"->"Not Applicable Brand"->"Not Applicable Region"->"Current YTD");)
    ENDFIX
    endfix

    Hello Stella Jones,<BR><BR>The error message means:<BR><BR>##1200400 Error %s formula for [%s] (line %s): scalar double argument expected in function [%s]<BR><BR>Is the same post of Jstrater above......<BR><BR>

  • I get an error when i try to execute a function that returns a date value

    Hi,
    I'm new in ODP.NET, i'm make a package that contains a function that returns a date i.e.
    Package Body General_pkg is
    Function Get_Day Return Date is
    vd_day date;
    Begin
    select sysdate into vd_day from dual;
    return vd_day;
    end Get_Day;
    End General_pkg;
    i use the next code to execute the function:
    OracleCommand cmdData = new OracleCommand("General_pkg.Get_Day", cnx);
    cmdData.CommandType = Commandtype.StoredProcedure;
    OracleParameter PRM;
    PRM = new OracleParameter();
    PRM.ParameterName = "VDATE";
    PRM.OracleDbType = OracleDbType.Date;
    PRM.Direction = ParameterDirection.ReturnValue;
    cmdData.Parameters.Add(PRM);
    try
    cmdData.ExecuteNonQuery();
    catch(OracleException e);
    When i execute this code, i have and exception, which say "identifier GENERAL_PKG.Get_Day must be declare..."
    Obviously the package is correctly created in ORACLE i tested first in sql plus and it works but in ODP.NET they don't recognize the package or the function i don't know... please help!!!

    OOOOOPSS.... i forgot that i change the user in my conecction string that's why it didn't work...
    i guess i had to much beer last night.;. :)
    thanks.

  • NO Authorization error when accessing Functional module RH_CUT_OBJECT

    Hi,
    I am getting NO AUTHORIZATIOn error when I am executing SE37-->FUNCTIONAL OBJECT-RH_CUT_OBJECT.
    I also checked SU53 screenshot which says AUTHORIZATION CHECK SUCCESSFUL and there are no errors or missing authorizations highlighted in SU53.
    I switched on the TRACE-ST01 then also the error is not captured.
    I would like to know WHY am I getting NO AUTHORIZATION error.
    I am already having access to T-CODE SE37, SE11, SE80, SMARTFORMS and authorization object S_DEVELOP.
    I need to know this ASAP on why I am getting NO AUTHORIZATION error when I am trying to access the FUNCTIONAL MODULE RH_CUT_OBJECT whereas I am having all the required authorization required for ABAP Developer including SE37.
    Is it something I need change at ABAP code level.
    Please advise ASAP.

    The reason is ..You do not have acess to see/acess the data this FM is trying to acess ...Debug the function module keep a breakpoint at The Raise statement see which authorization you do not have ....BTW this is my guess you are trying to demilit certain objects /infotypes using this FM and delimit basically makes that object non-usable in that system  .So it is quite evident that every one will not have authorization for that .Please post in detail that what is it that you are trying to achieve using this function module .....
    Also you can check with debugging  which authority object is being checked before raising the message and can ask security team to get that added to your profile ....
    Thanks,
    Anjaneya

  • Errors executing bulk query when updating a Sharepoint Linked List from Access

    Hi all,
    I have a Sharepoint list that is a Linked List with MS Access. It has just under 5,000 items (4,864), thus meaning it avoids the reduction in functionality lists of greater than 5,000 items have.
    Among the list are five calculated columns. These take the information from another column (different employee numbers), and by using a formula produce a clickable link to my company's Directory page, where that particular employee's info is displayed. I'm
    not sure if these five columns are relevant to my query, but I'm mentioning them in case.
    My problem is this: Frequently when I run any query on the list that updates the list, I get this error: "There were errors executing the bulk query or sending the data to the server. Reconnect the tables to resolve the
    conflicts or discard the pending changes".
    When I review the errors, it says they conflict with errors a previous user made (with that previous user being me). It frequently highlights several columns, despite the info in them being identical, and the calculated columns (with the original showing
    the value they contained and the new showing #VALUE! (as Access can't display the formulas).
    However, if I click Retry All Changes, all the update stick and everything seems fine. Why is this happening? It's proving very annoying and is really stopping the automation of my large number of queries. A list of 5000 items isn't particular big (and they've
    got roughly 100 columns, although I didn't think that was too large either, given Excel's 200+ column limit).
    Is this due to poor query design and SQL? Is this due to connectivity issues (which I doubt, as my line seems perfect)? Is this due to Access tripping over itself and not executing the update on each row in the table, but rather executing them concurrently
    and locking itself up? I'm at wit's end about it and really need to get this sorted.
    Thanks in advance for any suggestions.

    Hi amartin903,
    According to your description, my understanding is that you got an error when you used a linked list from Access.
    The table that you are updating is a linked table that does not have a primary key or a unique index. Or, the query or the form is based on a linked table that does not have a primary key or a unique index. Please add the primary key or a unique index.
    Here is a similar post, please take a look at:
    http://social.technet.microsoft.com/Forums/en-US/545601e9-a703-4a02-8ed9-199f1ce9dac8/updating-sharepoint-list-from-access?forum=sharepointdevelopmentlegacy
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • System_failure error with the function module HTTP_POST

    Hi Friends,
      While executing the function module "HTTP_POST" ,sometime we are getting the error "System_Failure" exception.
    Can anyone tell what could be the reason for this exception,any configurations need to be done on SAP???
    For this FM we are passing the RFC destination"SAPHTTPA" as one of the paratmeter and
    The two import paramters we are passing to this FM are
    URI : 
    http://10.74.40.31:8686/ArchiveBridge/?informaticaArchive&contRep=IA&sumFile=MYTA_SUMMARY_20090820063258.sum
    Destintion : SAPHTTPA
    Thanks all in advance.
    Regards
    Dharmaraju

    Hi,
    Check if any proxy is maitained in the client by going into transaction
    SICF-> Goto-> HTTP Client Proxy -> HTTP LOG TAB.
    If there is anything maintained under Host name and port, if yes you need to specify the IP address while calling FM HTTP_POST
    under PROXY as
    192.168.0.1:8080  where first part is IP address & 2nd part(8080) is port.
    Also test connection for SAPHTTPA under SM59 to see if its properly configured.
    Regards,
    Amit

  • Error message in function module HR_INFOTYPE_OPERATION

    Hi experts,
                I need to update the data in the table pa0762 . I am using the function moudle HR_INFOTYPE_OPERATION to do that. i am passing infty,number,SUBTYPE,OBJECTID,validityend,validitybegin , the data to be inserted in wa_0762 this is of type p0762
              When i execute the function i am getting a error message in return as 'Fill in all required entry fields'.
    Can anyone provide help about this Topic . I would be really greatful to any help .
    Thanks in advance

    It seems that the time constraint defined for the custom infotype requires the existence without gaps.
    change time constraint or create the infotype with ENDDA = 99991231

  • [BIACM0085] Error executing load plan after reverting from LDAP to original security mechanism in BIA 11.1.1.7.1

    We have tried to change authenticaion of BI Apps 11.1.1.7.1 to LDAP, but reverted this due to some other issues. Now we are back with standard authentication, and all functionality seems to work fine, except execution of a load plan.
    When we select (any) plan that was executed earlier, we get an error:
    [BIACM0085] Error executing load plan. Action: Correct the properties selected or entered and retry.
    [BIACM0080] Cause: Application error: MustUnderstand headers:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood Action: Contact your help desk or system administrator.
    According to one of our WLS gurus there is a mismatch between consumer and provider of a web service with a security policy, but we cannot find any difference between a working and this failing environment.
    We already started a trace in WLS, but this does not help us further.
    Any hints on troubleshooting steps or even better resolution are more than welcome, as this is blocking a new full load and further tests.
    Tx,
    Luc

    We have tried to change authenticaion of BI Apps 11.1.1.7.1 to LDAP, but reverted this due to some other issues. Now we are back with standard authentication, and all functionality seems to work fine, except execution of a load plan.
    When we select (any) plan that was executed earlier, we get an error:
    [BIACM0085] Error executing load plan. Action: Correct the properties selected or entered and retry.
    [BIACM0080] Cause: Application error: MustUnderstand headers:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood Action: Contact your help desk or system administrator.
    According to one of our WLS gurus there is a mismatch between consumer and provider of a web service with a security policy, but we cannot find any difference between a working and this failing environment.
    We already started a trace in WLS, but this does not help us further.
    Any hints on troubleshooting steps or even better resolution are more than welcome, as this is blocking a new full load and further tests.
    Tx,
    Luc

  • I am getting this error :The right function requires 2 argument(s).

    declare 
    @startdate datetime,
    @enddate datetime 
    SET @STARTDATE ='01-MAR-2014'
    SET @enddate = '01-MAR-2014'
    Set @StartDate = Convert(datetime, Convert(char(10), @StartDate, 120) + ' 00:00:00', 120)
    set @enddate =convert(datetime,Convert(char(10),@enddate, 120) + ' 23:59:59',120) 
    SELECT 
    [row_date]
    ,[logid]
    ,CONVERT(VARCHAR(6), (ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0))/3600) + 
    ':' + RIGHT('0' + CONVERT(varchar(2),(ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0)) % 3600) / 60), 2)
    + ':' + RIGHT('0' + CONVERT(varchar(2), (ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0)) % 60), 2)AS HoldTime
    FROM [CMSData].[dbo].[hagent2]
    WHERE ([logid] IN (1382, 1493,1382,1493,1444,1466,1301,1074,1655,
    1749,1685,1686,1684,1617,1681,1792,1595,1597,1687,1622))
    AND (row_date BETWEEN  @StartDate AND @EndDate)
    GROUP BY 
    [row_date]
    ,[logid]
    hi friends when I am executing this query I am getting this error please help me I will grateful to you .
    ERROR: The right function requires 2 argument(s).

    you may be better off making date filter as below
    declare
    @startdate datetime,
    @enddate datetime
    SET @STARTDATE ='01-MAR-2014'
    SET @enddate = '02-MAR-2014'
    AND (row_date >= @StartDate AND row_date <@EndDate)
    see
    http://visakhm.blogspot.in/2012/12/different-ways-to-implement-date-range.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Can't manually add an Mp3 to my daughter's 1st gen iPhone using my iTunes

    I want to bring an MP3 file into my daughter's phone, one that can't be purchased on iTunes. I want to do this by managing her iPhone manually on my machine, which of course is set to sync with my iPhone, not hers. I'm running Windows 7. I've tried i

  • ABAP Proxy to SOAP - Logon to Web Application Server Required

    Hello XI Experts, I have set up an ABAP Proxy->SOAP example in my IDES system. Everything is working correctly. However, when I execute the program which makes the call to the method "EXECUTE_SYNCHRONOUS", a popup appears asking me to enter logon det

  • How Can I Run Servlet in tomcat

    Hi My Friends Please can any one tell me how can I Run Servlet in tomcat using my own Virtual Directory � my ask about , what is the structure it must be make it in the hierarchy of the sub folder of Virtual Directory , and in watch folder it must be

  • Profit centerwise Posting of Balance sheet GLs

    Dear Consultants, Client expects the Profit center wise posting of Balance sheet accounts. We have assigned cost centers to individual employee in IT 0027. In case of expense accounts like salary or Er PF, the entry goes to Profit center attached to

  • Custom infotype field data in Rem. Statement

    Hi, I am trying to display a date in the Rem statement from a field in custom infotype.Have given the table and the field and pulled the same into the Remu. statement with conversion being Date formatting.But the date is not reflecting in the slip. R