Policy predicate has error

i'm building my where clause inside the function that gets executed by a policy. the where clause is a string that looks something like this after it is built:
deptid IN ('00000', '00001', '00005'). the problem i'm having is when there are alot (1000+) dept ids to be included in the IN clause. I've tried creating a loop so that there are only 100 dept ids in each IN clause because from what i've read there is a limit of 255 parameters for an IN clause. Doing this, my string that i build looks structurally sound as i'm able to see it using the dbms_output.put_line(). It looks something like this:
deptid IN ('00000', '00001', '00002', ....) or deptid IN ('00006', '00007', '00008', ....)
also, the total number of characters for the string should be fine, as it is around 14,000 when everything is concatenated. so why do i get the error that the policy predicate is bad?? i'm thinking there is some size limitation i'm not aware of.

I tend to believe that you probably run into some misspellings.
Cause what are you doing differently?:
SQL> create or replace function emp_pol_func (
  2     p_schema   in   varchar2,
  3     p_object   in   varchar2
  4  )
  5     return varchar2
  6  as
  7     l_return_value   long;
  8  begin
  9     l_return_value :=
10        'deptno IN (''63701'', ''00135'', ''00136'', ''00201'', ''00202'', ''
00203'', ''00250'', ''00301'', ''00302'', ''00401'', ''00540'', ''00542'', ''006
01'') OR deptno IN (''02704'', ''02705'', ''02706'', ''02707'', ''02708'', ''027
09'', ''02718'', ''02719'', ''02737'', ''02738'', ''02739'', ''02740'', ''10'',
''20'')';
11     dbms_output.put_line ('Length: ' || length (l_return_value));
12     return l_return_value;
13  exception
14     when others
15     then
16        dbms_output.put_line (sqlerrm (sqlcode));
17  end emp_pol_func;
18  /
Funktion wurde erstellt.
SQL> begin
  2     dbms_rls.add_policy (object_schema        => user,
  3                          object_name          => 'EMP',
  4                          policy_name          => 'EMP_POL',
  5                          function_schema      => user,
  6                          policy_function      => 'EMP_POL_FUNC',
  7                          statement_types      => 'SELECT',
  8                          update_check         => false,
  9                          enable               => true
10                         );
11  end;
12  /
PL/SQL-Prozedur erfolgreich abgeschlossen.
SQL>
SQL> select empno, ename from emp
  2  /
     EMPNO ENAME
      7839 KING
      7782 CLARK
      7566 JONES
      7788 SCOTT
      7902 FORD
      7369 SMITH
      7876 ADAMS
      7934 MILLER
8 Zeilen ausgewõhlt.
Length: 261
Length: 261   <-------------------------   length can be longer than 255

Similar Messages

  • ORA-28113 policy predicate has error when created VO with some tables

    When I created a VO with just SQL statements(no EO), if the sql statements included some special tables or views such as:
    hz_locations
    oe_order_headers_v
    when testing the validation of the sql statement, I encountered the following errors:
    SQL Query Error Message: ORA-28113 policy predicate has error
    and I can't continue to create this VO.
    Does JDeveloper have some special rules to check some tables or views behind the scenes?
    I used the apps/apps to connect and the following sql to create the VO:
    select state from hz_locations
    Can anyone give some help?
    Many thanks in advance!

    Hi prasannaj,
    Thanks for your prompt response.
    I find the solution and would like to share with all.
    As I guessed, this is related to the policy.Execute the following sql:
    select * from dba_policies where object_name ='hz_locations'
    you'll find the point.
    So I run policy manager with oracle database client, and find the policy related to the table 'hz_locations' , and disable this policy.
    At this time, with the original sql:
    select * from hz_locaitons
    created VO and everything goes fine and passed the validation.
    But in fact I wondered if this is the best workaround for this issues.
    If anyone has the same problem, you can refer to my solution.
    If you have better solution, also let me know.
    Thanks!

  • ORA-28113: policy predicate has error

    I am trying to apply a policy predicate to a table to restrict the columns users see when executing a select query. I have created the context and can select from it using DUAL in a SQL session, the package to create the predicate is as follows
    CREATE OR REPLACE PACKAGE BODY XYZ
    AS
    function ABC(D1 varchar2,D2 Varchar2)
    Return Varchar2 IS
    d_predicate varchar2(2000);
    v_value varchar2(1) := 'Y';
    BEGIN
    d_predicate := 'SYS_CONTEXT("MY_CONTEXT","MY_VALUE") = v_value';
    RETURN d_predicate;
    END ABC;
    END XYZ;
    Each time I select from the table I get the error above, can anyone see the problem?
    Thanks in advance
    Tina

    The below example would be helpful how to use it.
    create or replace package security_package as
    function user_data_insert(owner varchar2,objname varchar2) return varchar2;
    function user_data_select(owner varchar2,objname varchar2) return varchar2;
    end security_package;
    Package created.
    SQL> create or replace package body security_package
    is
    function user_data_insert(owner varchar2,objname varchar2)
    return varchar2
    is
    predicate varchar2(2000);
    begin
    predicate:= '1=2';
    if (sys_context('userenv','session_user')='MOHAN1') then
    predicate:=NULL;
    else
    predicate:= 'user_id=sys_context("MOHAN1","USER_ID")';
    end if;
    return predicate;
    end user_data_insert;
    function user_data_select(owner varchar2,objname varchar2) return varchar2
    is
    predicate varchar2(2000);
    begin
    predicate:= '1=2';
    if (sys_context('userenv','session_user')='MOHAN1') then
    predicate:=NULL;
    else
    predicate:= 'user_id=sys_context("MOHAN1","USER_ID")';
    end if;
    return predicate;
    end user_data_select;
    end security_package;
    Thanks,
    Vissu....

  • OLS Policy Predicate Error

    I applied an OLS policy to a table with a predicate but following error is returned. Is it a syntax error??
    Any help is appreciated.
    Here it is:
    SQL> BEGIN
    2 SA_POLICY_ADMIN.APPLY_TABLE_POLICY
    3 (policy_name => 'DBSEC',
    4 schema_name => 'Robert',
    5 table_name => 'Order_Entry',
    6 table_options => 'LABEL_DEFAULT,READ_CONTROL,WRITE_CONTROL',
    7 label_function => NULL,
    8 predicate => 'OR SYS_CONTEXT ('USERENV','SESSION_USER') = Username');
    9 END;
    10 /
    predicate => 'OR SYS_CONTEXT ('USERENV','SESSION_USER') = Username');
    ERROR at line 8:
    ORA-06550: line 8, column 32:
    PLS-00103: Encountered the symbol "USERENV" when expecting one of the
    following:
    ) , * & = - + < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || multiset member SUBMULTISET_

    Thanks for the help. I tried the predicate with 'OR sys_context("userenv","session_user") = Username' ; and it worked.
    37 BEGIN
    38 SA_POLICY_ADMIN.APPLY_TABLE_POLICY
    39 (policy_name => 'DBSEC',
    40 schema_name => 'Robert',
    41 table_name => 'Order_Entry',
    42 table_options => 'READ_CONTROL,WRITE_CONTROL',
    43 predicate => 'OR sys_context("userenv","session_user") = Username');
    44 END;
    45 /
    PL/SQL procedure successfully completed.
    I also added a where clause for predicate. The clause is now Where Dept_No = 40 OR sys_context("userenv","session_user") = Username' ).
    SQL> update Order_Entry set ROW_LBL = CHAR_TO_LABEL('DBSEC','Pub:Sales') where Dpt_No = 40;
    20 rows updated.
    But when I tested it following error is returned.
    SQL> conn Salesman
    Connected.
    SQL> select count(*) from Robert.Order_Entry;
    select count(*) from Robert.Order_Entry
    ERROR at line 1:
    ORA-28113: policy predicate has error

  • Message has error status at outbound side File To Idoc Scenario

    hi ,
    In my File to Idoc scenario , when i go to sxmb_moni , i found that its showing red flag at Outbound Status Tab and showing message "Message has error status at outbound side".
    When i go to IDX5 and and select my idoc and click on Transaction Id it shows "Password logon no longer possible - too many faile" .
    Please suggest what may be the problem ?
    Regards,
    Rohit

    1. First check the RFC destination name used in receiver Idoc adapter communication channel.
    2. As i said earlier, in sm59 transaction in XI gui, u can check same rfc destination under type 3. There check the logon credentials and the username.
    3. Now goto the R3 system GUI and check in su01 that same user is locked or not. If locked unlock it.
    4. And if u change the password of that user, then do the similar change in XI -> sm59 -> rfc destination logon credential
    Regards,
    Prateek

  • Regarding datasource i'e., The OLTp source still has errors

    Hi experts,
    I was getting an error while creating datasource i.e, "The OLTP source still has errors".
    Last 2 days onwards i was getting this error. Previously i have created many datasources.Eventhough i was gettign sam error
    while doing any changes in existing datasource. Kindly help me out in this issue.
    Regards,
    Sree.

    Anil,
    I will explain in detail.
    We want to do enhancement for datasources (transaction or Generic datasources...whatever it is).
    LBWQ or RSA7 question will not come here...ok....
    any time we can do enhancement by adding additional fields to the extract structure(appending..) of trans. or generic or masterdatasource.....
    In my case, If i add some fields to the extract structure(appended str.)in source system(r/3- datasource-2lis_13_vditm) and save it. immediatly we are getting message saying that 'OLTP SOURCE ERROR'...
    Is there any problems in source system/installation.
    Thanks,
    Mahantesh
    similarly, the same problem will come for all the datasources - enhancment.
    how do

  • BPM - Message has error on the outbound side

    I get this error 'Message has error on the outbound side" . I am using IDOC - BPM - JDBC. I checked SXI_CACHE and I see ret code 99 for this Integration Process. I tried to activate it. I see an error saying that ZCUST_NUMBER is not a component object of PAYLOAD. I have this context object defined on the Abstract Message Interface built to store the IDOC.
    Any ideas are helpful

    Michael,
    <i>The program outputs a returncode = 99 during the cache refresh of an integration process (ccBPM), with an error message that says that 'xxxx' is not a component of the 'PAYLOAD' data object.</i>
    If you are getting the above error, check OSS NOte 890760

  • APEX 3.1.2: package body "FLOWS_030100.WWV_FLOW_UTILITIES" has errors

    When installing apex 3.1.2 in Oracle RDBMS 9.2.0.8 Ii got the following errors:
    command:
    SQL> @apexins SYSAUX SYSAUX TEMP /i/
    output:
    APPLICATION 4411 - APEX - System Messages
    Set Credentials...
    Check Compatibility...
    WWV_FLOW_API.FLOWS_API_LAST_EXTENDED20070906
    WWV_FLOW_API.CURRENT_FLOWS_VERSION20070906
    WWV_FLOW_API.IMPORT_COMPATIBLE_WITH_VERSION 20070108
    WWV_FLOW_API.COMPATIBLE
    Set Application ID...
    begin
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "FLOWS_030100.WWV_FLOW_UTILITIES" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at "FLOWS_030100.WWV_FLOW_AUDIT", line 66
    ORA-06512: at line 3
    Checked table all_errors
    output:
    FLOWS_030100     WWV_FLOW_UTILITIES     PACKAGE BODY     1     5928     3     PLS-00201: identifier 'DBMS_LOCK' must be declared
    Any suggestions ?
    Regards,
    Remo

    Hi Penny,
    Your suggested solution worked.
    However i got other errors and so i ran apxremov.sql to cleanup the installation.
    Forgot to mention that there was a previous installation of apex.
    After rerunning apexins.sql installation was completed succesfully.
    Thanks for reply.
    Remo

  • BPM Error: Message has error status on outbd. side

    Hi,
    BPM overview:
    Receive Step -> Transformation Step (1) -> Send Step ASYNC (1) -> Send Step SYNC (1) -> Transformation Step (2) -> Container Operarion Step (1) -> ...
    Error Message in SXMB_MONI: Message has error status on outbd. side
    - <Trace level="1" type="B" name="CL_XMS_PLSRV_CALL_BPE-ENTER_PLSRV">
    <Trace level="1" type="T">--start sender interface action determination</Trace>
    <Trace level="1" type="T">select interface MI_BPM_TRAN_EMP_DETAILS_FILE_OUT_ASYNC*</Trace>
    <Trace level="1" type="T">select interface namespace urn:tranbpm</Trace>
    <Trace level="1" type="T">no interface found</Trace>
    <Trace level="1" type="T">--start receiver interface action determination</Trace>
    <Trace level="1" type="T">Loop 0000000001</Trace>
    <Trace level="1" type="T">select interface AI_BPM_TRAN_EMP_DETAILS_FILE_ASYNC*</Trace>
    <Trace level="1" type="T">select interface namespace urn:tranbpm</Trace>
    <Trace level="1" type="T">no interface found</Trace>
    <Trace level="1" type="T">--no sender or receiver interface definition found</Trace>
    <Trace level="1" type="T">Hence set action to DEL</Trace>
    </Trace>
    I am don't any Interface name MI_BPM_TRAN_EMP_DETAILS_FILE_OUT_ASYNC* in my scenario, the actual interface name is MI_BPM_TRAN_EMP_DETAILS_FILE_OUT_ASYNC does BPM adds a '*' at the end of the interface name.
    In the workflow log it shows that "Transformation Step (2)" has error. I am using multimapping in the transformation step.
    Any help would be greatly appreciated as I ran out ideas to fix this issue.
    Thanks in advance.
    Sarvesh

    The issue was with the step "Transformation Step (2)" and I fixed it in the mapping. 
    When using two send steps "Send step (1)" & "Send step(2)", BPM is executing the second send "Send step(2)" before it completes the first send step "Send step(1)".  The first "Send step(1)" inserts the data into the database table and the second "Send step(2)" retrieves the data inserted in the first send step. 
    If I insert a "Wait step" between the 2 send steps it working.  Can anyone explain how the send step in BPM works. 
    I did post the same question in "Exchange" forum also so that it can be view by more people.
    Thanks,
    Sarvesh

  • BPM Scenario: Message has error status on outbound side

    Hi All,
            I am doing one BPM scenario. In my scenario i am collecting 12 different type of idocs in BPM and bundling these idocs and sending these to the 12 different files.
            If i send 12 idocs from the R/3 then my scenario is working perfectly fine. If i send less than the 12 idocs that time i am getting the error message as "Message has error status on outbound side" with red flag.
               Can you please explain what minght be the problem. I have already checked in SM58,SMQ1 and SMQ2.
    Thanks & Regards,
    Purushotham

    Hi Nutan,
            I hv configured my scenario as follows
    1. Start
    2. Block ( Deadline and Control step for cancell the process)
       3. Fork(Necessary branches 12)
          4. Loop(12 loops)
              Under loop
              a. Receive Step
              b. Container Operation( For count)
              c. Container Operation(For append)
    5. Fork( Necessary branches 12)
        6. Transformation
        7. Send
    8 Stop
    This is my scenario. In the first Fork step i am checking end condition as total  number of idocs is reached then i am sending all the data to the target system. If the idocs are not reaching with in 1 hour then i am cancelling the process.
            Now can you please tell me what is the problem.
    Thanks & Regards,
    Purushotham

  • My itunes was working fine untill i tried to download the most current version of itunes. now it wont boot up and has error messages,error7(windows error 126) and MSVCR80.dll

    my itunes was working fine until i tried downloading the most current version of itunes, now when i try to get on my itunes library, it wont boot up and has error codes, error 7, and( windows error 126). it also says that MSVCR80.dll is missing from my computer,please re install itunes. but when I try to re install it it will not install on my computer.

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Message has Error status on outbound side - in ABAP inbound proxy !!

    Hi All,
    One interesting question for you guys. I have got one of the scenarios like File to ABAP inbound proxy. Message are going properly, no errors in receiving system. But on PI moni I can able in "outbound status" column in red colored flag. No all the messages couple of them with u201CMessage has Error status on outbound side ". Why please?
    Regards
    San

    Hi ,
    Please check whether the  correct data  is coming from sender side .  and check the j2ee engine runtime parameters.
    Cheers,
    Meera
    Edited by: MeeravaliDudekula on Oct 18, 2010 2:36 PM

  • ** BPM Error - Msg has error status on oubound side

    Hi Friends,
    I am doing BPM scenario. (Receive Step --> Transformation Step --> In Block (For each) Synchronous Send Step ). That's all BPM design.
    We have created Server prox (inbound Proxy) in ABAP, it receives PO details and return Sales order no. Coding has been written inside Proxy. If we test Proxy in ABAP, it is working fine.
    The required PO data we pass from JDBC. Receive step receives the whole message (It may contain 1 or more PO). In Transformation step, we split message using multiline checkbox( One message per 1 PO).
    Message is processed successfully upto this step. In the Synchronous send step, it throws an error.
    In SXMB_MONI, 3 messages are generated. In the first message itself, in the outbound status column 'Red Flag' is coming, (but processed successfully).  The error is 'Message has error Status on outbound side'. Inside the message 'PE'  adapter is in grey color.
    So, what could be the problem ..?
    Kindly reply, friends.
    Kind Regards,
    Jegatheeswaran P.

    Hi Jegatheeswaran,
    Take the Message after transformation and try to test your synchronous service with this message,
    if u r using any web service you can use Altova (XML SPY) to test your service with the data after
    transformation.
    If it does not show any problem then try to see you have build your BPM Properly (Press F7 to test For any syntactical error).
    You can also go to SXI_CACHE to see if your Workflow does have status 0 .
    To get Exact error Message . Click on PE ->goto->ThechnicalSetting->select synchronous call->click on content tab->and go on navigating you will find detailed exception.
    Reward Points IF Helpful
    Thanks
    Sunil Singh

  • Message has error status on outbd side

    Hi,
    I am doing File to IDoc scenario, in SXMB_MONI i am getting the following error "Message has error status on outbd side". I am not using BPM and this interface was working fine earlier .
    Any clues!!!!!!!!!!
    Regards
    Swatantra

    Hi Vijay,
    Cross check whether you have done these:-
    SLD-
    1) Create a Product/Software Component
    2) Technical System pointing to R/3 system
    3) Business System for the above technical system
    In the Repository
    1) Import the Software component created in the sld
    2) Create a namespace,
    3) import the idoc and then create sender data type/message type etc and mapping
    4) Mapping Rules is depends on the requirement
    In the Directory
    1) Create a Scenario /import the business system
    2) Create Receiver/Interface determination
    3) Create communication channels for sender and receiver
    4) Sender Agreeement and Receiver Agreement.
    Then the file adapter configuration is depend on the input file format.
    Also you need to have Logical destionation created in the XI , and the IDX1 entry
    In R/3 Port, Partner profiles etc should be created
    Have a look into this document~
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/877c0d53-0801-0010-3bb0-e38d5ecd352c
    While doing an File -> XI -> IDoc scenario, The Points to noted are:
    1. You don’t need a DT, MT or a message interface for the IDOC as it itself acts as the Message Interface.
    2. You import the IDOC and use the same in your mapping.
    3. In this configuration note that you will need a sender agreement for the file.
    4. In this configuration note that you will also need a receiver agreement for the IDOC.
    For any File -> XI -> IDoc scenario ref:
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    Hope this helps.
    Regards.
    Praveen

  • Message has Error Status Outbound Side

    Hi All,
    I have one question.... we procssed one file from ftp it should creates Idocs in R/3 side we developed this scenario using BPM....it processed successfully inbound side but in Outbound side it is showing Red Flag (Error Meaase : Message has Error Status Outbound Side) and its not creating IDOCs in R/3 Side but in Process engine all steps completed Sucessfully and created Idocs in XI....i tried so many ways...like in Queues and Refreshed Cache and checked RFC connection in Both ways and checked passwords in communication channels.... i could't find any this....if any body help me on this....it would be appritiated.
    This was i am testing on Test system i got this type of problem but in Development box it is working successfully we are using the same fuctionality and same code also i don't know why its happening.
    Thanks,
    Sudheer.

    Hi,
    Where are you find the Error and
    > Process engine all steps completed Sucessfully and created Idocs in XI....
      Can you explain in detail
    Regards
    Sangeetha

Maybe you are looking for