Exists condition in APEX 4.0

Hi
I've created an application in APEX 3.2 and I've now installed it in an APEX 4.0 environment. I've had a few issues where things have changed, but I've just hit a rather bigger problem to do with the Exisits condition that I'm hoping someone can shed some light on.
On numerous items, regions, lists items etc. I've used the "Exists (SQL query returns at least one row)" condition. In Expression 1 I've included a select statement which ends with a semi-colon. For example,
SELECT 1
FROM   my_table
WHERE  id = :P0_ID
AND    my_col = 'Y';Now in APEX 4.0 I sometimes get an error when running the application which is ORA-00911: invalid character. This happens when viewing a list which has this condition on one of it's items, but doesn't appear to happen on regions with this condition. However, if I update any item, region, list item etc. which has this type of condition when I hit Apply Changes I get the same error. If I remove the semi-colon then the error disappears. For the above example, Expression 1 needs to be changed to:
SELECT 1
FROM   my_table
WHERE  id = :P0_ID
AND    my_col = 'Y'I've checked the Release Notes for 4.0, the Patch Set Notes for 4.0.1 and searched this forum but I've found no reference to this. (Perhaps I'm searching for the wrong thing.)
Is this a planned change? Has anyone else experienced this? Does it only happen in certain places? I don't particularly want to go through all 20 of the APEX repositiory tables that have the Condition Type column to try and identify all the places I've used this and then change all my applications. This will be extremely time consuming, so if I know that it's a change in say only 5 places then I'll just target those places.
Many thanks for any help on this.
Sara

Hi Sara,
in previous versions of APEX we where more tolerant in regards to adding a semi-colon at the end of a SQL statement where it actually doesn't belong to. A semi-colon only has to be entered for PL/SQL commands or SQL statements within a PL/SQL code block, but never for a single SQL statement as in the case of "Exists" or an Interactive Report query. In 4.0 we have now added design time validations of SQL statements and PL/SQL code in conditions as well. Before it was stored unverified. That's why you are now hitting the problem each time you modify such a component.
I don't think that we actually changed the runtime engine to be as restrictive as the Builder validation yet, but going forward that might be the case as well in future versions of APEX. Regarding your specific problem for list entry conditions, I don't see that the code has really changed here. It's using the same function to evaluate the condition as we use for regions and a quick test also proves that list entry conditions still accept the semi-colon.
But I will file a bug for the new "Advisor" feature that it should also flag those components which are using a SQL statement with a semi-colon. That should help to easily identify there components where a change should be made.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf

Similar Messages

  • 'Order By' in Exists / Not Exists condition causing ORA-00907 in Apex4.1.1

    Hi Guys,
    We have just upgraded from apex 3.2.1 to 4.1.1. on Oracle DB V11.2.0.1, while testing the apps in apex, I come across this problem.
    When I have a page process that has a condition defined.
    When Condition Type is Exists (SQL query returns at least one row) or Not Exists (SQL query returns no rows) and the Expression 1 is a query with an 'Order By' clause, e.g.
    SELECT 123 FROM DUAL
    ORDER BY 1
    When the process is triggered, Apex 3.2.1 would evaluate the condition and run the process just fine, however Apex 4.1.1 would throw an error : ORA-00907: missing right parenthesis
    I totally understand that an Order by clause in an Exists or Not Exists condition is unnecessary and agree that they shouldn't be there in the first place.
    But unfortunately I am dealing with other developers codes and these conditions have been coded like these, probably from copy & paste codes.
    Saying that, I also believe that an Apex upgrade should not stop anything that is working in previous releases without warning or provide a workaround, right?
    I don't know if this affects other types of artifacts that can have a condition in apex when upgrading from 3.2.1, e.g Regions/Items/Computations/Validations etc.
    Does anyone else get this behaviour? and is there an easy solution to fix these?
    Ideally I don't want to go through all processes (and whatever other artifacts might be affected too) in all apps in all workspaces to check the condition type and remove the 'Order By' clause manually.
    Thanks for any advises
    Just did some more testing
    'Computation' , 'Validations', 'Processes' and 'Branches' have the same problem, 3.2.1 takes 'Order By' fine in Exists/Not Exists condition, but 4.1.1 throws error.
    'Regions', 'Buttons', 'Items' have consistent behaviour - both 3.2.1 and 4.1.1 throw error ORA-00907: missing right parenthesis, when page is rendered.
    Edited by: Danny on 25/04/2012 20:07

    Hi Danny,
    that's interesting. I just had a look what happens when you use an EXISTS or NOT EXISTS condition type. The following final SQL statement will be generated with your above example. You can also see that if you run your application in debug mode.
    select count(*) from sys.dual where exists (select 123 from dual order by 1)Executing that statement in SQL*Plus will also show the ORA-00907 error. It appears that the SQL parser doesn't allow an order by clause in an EXIST clause.
    I wonder why this should have worked in previous versions, but I can only suspect that in the past we may just have executed
    select 123 from dual order by 1which can be slightly slower because with the new EXISTS statement the SQL engine can stop processing earlier if it finds a record.
    We try to be backward compatible as much as possible, but I doubt that we will change that back to the way it was before because of the performance penalty 99.9% of our customers would face.
    Possible Workaround: You might be able to use the new "Application Search" to scan your application for "order by" and fix it for all hits where the attribute name is "Expression 1".
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Add a new field to an existing Condition table

    How can I add a new field to an existing condition table?
    I have table 971 and I want to add INCOTERMS (INCO1) to this existing table but do not see how to add it.
    Thanks

    Hi Vicky,
        I dont think you can add new fields to the condition table once you have activated the condition table.
    SAP says you can only make limited changes to the condition table, like changing the description, fast entry screen, header and footer fields, but not able to add new fields to the table, and I think that is the correct approch or else for the same table you will have two sets of condition records.
    Please refer to the below link:
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/de/7a8534c960a134e10000009b38f83b/frameset.htm
    What you can do is create a new condition table with additional field and assign this table before the currently used table in the access sequence.
    Hope this helps.
    Regards
    Raj

  • BAPI_PO_CHANGE not updating existing condition type value.

    Hi,
    I am using 'BAPI_PO_CHANGE' to update the existing condition records.
              MOVE-CORRESPONDING wa_pocond_40 TO gt_pocond_40.
              gt_pocond_40-change_id = 'U'.
              gt_pocond_40-cond_value = '20'.
              gt_pocondx_40-itm_number = <fs_pocond_41_new>-itm_number.
              gt_pocondx_40-cond_st_no  = <fs_pocond_41_new>-cond_st_no.
              gt_pocondx_40-itm_numberx = 'X'.
              gt_pocondx_40-cond_st_nox = 'X'.
              gt_pocondx_40-cond_type = 'X'.
              gt_pocondx_40-cond_value = 'X'.
              gt_pocondx_40-currency = 'X'.
              gt_pocondx_40-change_id = 'X'.
              MODIFY gt_pocond_40 INDEX sy-tabix.
              APPEND gt_pocondx_40.
    I am using 'BAPI_TRANSACTION_COMMIT' also.
    Still, the condition value is not changing.
    what and where do u think is the problem?
    Kindly assist.
    Thanks.

    check the following link
    http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm

  • Create condition record with reference to existing condition record

    how to create condition record with reference to existing condition record?

    Hi,
    See this link :
    http://help.sap.com/saphelp_47x200/helpdata/en/de/7a8534c960a134e10000009b38f83b/frameset.htm
    You can create with reference with Tcode : VK14 (or VK34)
    Or in VK12, you can copy condition records with copy rules.
    Regards,
    Lionel

  • Decode for EXISTS and  NOT EXISTS conditions

    Hello all,
    I need to use either EXISTS or NOT EXISTS before the subquery based on the situation. I have written a test query but its erroring out. Please check it.
    select 1 from dual
    where DECODE('A','A',EXISTS ,NOT EXISTS)
    (select ename from EMP
    where ename = 'SCOTT')
    Thank You
    KK

    DECODE will not replace part of the query. Functions don't work that way.
    (It won't work if you put EXISTS and NOT EXISTS in quotes, either.)
    What you want is something like
    WHERE (<condition> AND EXISTS...) OR (<not-condition> AND NOT EXISTS...)You can also do:
    SELECT 1
    FROM dual
    CROSS JOIN (SELECT COUNT(1) AS exists_fg FROM emp WHERE ename = 'SCOTT') ex
    WHERE (<condition> AND exists_flag > 0) OR (<not-condition> AND exists_flag = 0)This way, you don't have to include the entire WHERE EXISTS condition twice.
    -- Don

  • How to add a feild as key combination for existing condition table

    Hi all,
    please any body can inform me about how to add a feild as key combination for existing condition table ex 901 having the key combination of sales organisation and material
    for this cond. table,how  to add a new feild ex:price list
    iam unable to add it in change mode of v/03.(even after removing this 901 table from Acc.seq.)
    Edited by: rajendraprasad vasam on Apr 25, 2008 10:08 AM

    mr.Rajendra
         I you have the access key - you can copy the 901 table and create a new table along with your required field. v/03
    Or
    in the access sequence for the condition type - add 1 more step and add your field.
    ie 10 - 901
    and in 20 - your required field
    regards,
    Reshmi
    Edited by: reshmi bhaskar on Apr 25, 2008 10:21 AM

  • Adding new field in an existing condition table

    Dear friends,
    I have an existing condition table for material exclusion with the combination of Plant and material.
    Is it possible to change this table and add a field of division also?
    Regards,
    Ronnie

    Hi,
    The optimzed solution is to better create a new sequence of fields including the division, so that a new condition table is created based on the key combination or access sequence.
    You can add a new field to an existing condition table using APPEND structure facility in Se11. But once on activating the table, how will this division field get populated in the table.
    But whereas if you create a new key combination, the data for this condition tables will automatically gets filled up while creating master data thro VK11.
    So, its better to go for a new access sequence combination
    as a new table is created for this key combinations.
    Regards,
    JLN

  • Calling existing pages from Apex

    Hi,
    I am working on Apex as a part of my in-house applications upgrade. At present, the intranet is written on javascript and html.
    Is there a way that I can call the existing forms/reports / pages from Apex. I want to achieve that I need not re-write all the logics written, but embed already existing login into Apex screens.
    Any help will be much appreciated.
    Cheers,
    Jas

    So, you effectively want to embed existing (presumably custom-made) reports within the apex environment - sort of like wrapping your existing intranet in an APEX front-end?
    Well, for the relevant page/report, you could create an HTML region and maybe call your existing reports via ajax methods - it would require a bit of custom javascript to achieve though. Namely it would involve invoking your remote HTML page, return the resulting HTML output into your request object, then replacing the relevant elements in the DOM with this output.
    I suppose if your particular reports were too fiendishly complicated to entirely re-implement in APEX, this would be the way to go, but I have a feeling that it will require a bit of work to get going properly, indeed you could also potentially lose out on some of the benefits of using APEX (or at least, you'd be stuck with this halfway house implementation forever).
    Sorry to be quite general and high-level about this, but there isn't enough detail to work with.

  • Copy an existing condition record

    Hi experts!
    Kindly let me know the steps to copy an existing condition type to a new one and assigning the new one to a pricing scheme.
    Thanks
    Vineeta

    Hi,
    transaction vofm.
    menu...conditions/pricing.
    If you overwrite an existing number, the system will automaticly copy it to the new one. You need an object key for this.
    Don´t forget to run report RV80HGEN, after you set it into customizing and want to use it.
    Regards
    Nicole

  • Response time performance for the NOT EXISTS condition

    Hi all,
    In the query below, there is the WHERE NOT EXISTS condition based on a view. And I want to know what is the better choice to take whether to include the DISTINCT keyword in the select script of the view or not , because the view contains duplicated rows :
    select * from table_name table_alias where not exists( select 1 from the_view_name where join_condition);
    Thank you very much indeed

    Sometimes it is, sometimes it isn't, usually it's the same. The optimizer will tend to rewrite the query as a join anyway if it can.
    For some notes on the options available to the optimizer for an EXISTS subquery:
    http://jonathanlewis.wordpress.com/join-ordering-pt2
    Most if not all of those are also possible for an IN subquery (couldn't find a link just now but I have to go to work).

  • Can I have a conditional javascript:apex.confirm when column is null

    Hi All,
    I am relatively new to the product but am picking up things all the time. I was recently asked to create a confirmation on submit dialog which I did quite easily using javascript:apex.confirm. I was then asked to only display the confirmation message if a comment column was empty. The column is optional but it is preferred if something is added. I am using 4.1.1. Is this possible? Any ideas would be appreciated
    Regards
    Chris

    Hello Chris,
    >
    user4023958 wrote:
    I am relatively new to the product but am picking up things all the time. I was recently asked to create a confirmation on submit dialog which I did quite easily using javascript:apex.confirm. I was then asked to only display the confirmation message if a comment column was empty. The column is optional but it is preferred if something is added. I am using 4.1.1. Is this possible? Any ideas would be appreciated.
    >
    How have you implemented the apex.confirm?
    <ul>
    <li>If you have done it in dynamic action on button click then you have to make the dynamic action conditional by using Item/Column value is not null condition with expression as your comment item say P1_COMMENTS</li>
    <li>If you have done it in Button Action as Redirect to URL then simply you can write a javascript function in your page header as :
    <script type="text/javascript">
    function f_showConfirm () {
      if ($x('P1_COMMENTS').value == '') {
        apex.confirm('Do you want to submit this page?', 'SUBMIT');
      } else {
        apex.submit('SUBMIT');
    </script>and call this javascript function in Button Action - Redirect to URL with URL Target set as:
    javascript:f_showConfirm();</li>
    </ul>
    In order to get accurate/appropriate response you should include relevant details from following information with your question:
    <ul>
    <li>Full APEX version</li>
    <li>Full Database version</li>
    <li>APEX Web server architecture (EPG, OHS or APEX listener)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Operating system with version, architecture(32/64)</li>
    <li>Theme</li>
    <li>Template(s)</li>
    <li>Region/item type(s)</li>
    </ul>
    The above information will help the forum members to ascertain the problem context and post most relevant response.
    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.
    Please update your forum profile with a real handle instead of user4023958.
    Hope it helps!
    Regards,
    Kiran

  • Modifying Existing Condition Routine

    Hi All,
    In Customer Return when we create Credit Memo Request wrt invoice the tax amount (CST/ VAT) is copied.The requirement is that if we create a Credit Memo Request  wrt Invoice which is 6 months old from the current date then Tax condition types should not be copied. For this we can create Routine and assign this in the PP in  Requirement field.
    But as we maintained requirement 10(plant is set) for tax condition types, so where to assign this new routine.
    Can we add the logic in the existing routine 10 ?
    Regards
    Debasish

    Hi,
    There is no way we can assign two routines in a requirement. Rather you can have the logic in the existing rouitne.
    Thanks,
    Raja

  • Invalid exists/not exists condition: ORA-00928: missing SELECT keyword

    I am getting errors when I edit the source region and add the sql I want to run in the report. If I run the following query in sqlplus with the schema owner substituted for OWNER it works fine.
    SELECT TK_IN_TIME
    from "#OWNER#"."TIME_KEEPING_T"
    I also run the following code in sqlplus and it works perfect, but from the source region I get a divide by 0 error.
    select dt,to_char(trunc(mod((elaps)*24,24)),'fm00')||':'||
    to_char(trunc(mod((elaps)*24*60,60)),'fm00')||':'||
    to_char(trunc(mod((elaps)*24*60*60,60)),'fm00') ELAPSED
    from
    select trunc (tk_in_time) dt, sum(tk_out_time-tk_in_time) elaps
    from time_keeping_t
    group by trunc(tk_in_time)
    order by dt
    What is so different between the source region and sqlplus. I need to have this query run in my report and unfortunately, it doesn't seem possible. I'm about to give up on APEX and try something different.

    I couldn't paste a screenshot, so I cut and paste. If there is somewhere I could put the screenshot let me know. There is IDENTIFICATION, USER INTERFACE, and SOURCE. I'm putting the sql into the SOURCE region. I've gotten so many errors, that I have it just limited to a simple select of two fields, and I apply changes and then RUN, and get the 00928 error.
    Region Definition Report Attributes Print Attributes
    Region: 2 of 2 Name: Report on TIME_KEEPING_T
    Show All Identification User Interface Source Conditions Cache Header and Footer Authorization Customization Configuration Comments
    Identification
    Page: 3 Report on TIME_KEEPING_T
    Title exclude title from translation
    Type SQL Query SQL Query (PL/SQL function body returning SQL query)
    Static ID
    Region Attributes
    User Interface
    Template No Template Borderless Region Bracketed Region Breadcrumb Region Button Region with Title Button Region without Title Chart Region Form Region Hide and Show Region List Region with Icon (Chart) Navigation Region Navigation Region, Alternative 1 Region without Buttons and Title Region without Title Report Filter - Single Row Report List Reports Region Reports Region 100% Width Reports Region, Alternative 1 Sidebar Region Sidebar Region, Alternative 1 Wizard Region Wizard Region with Icon Sequence
    Display Point After Header Page Template Body (1. items below region content) Page Template Body (2. items below region content) Page Template Body (3. items above region content) Before Footer Page Template Region Position 1 Page Template Region Position 2 Page Template Region Position 3 Page Template Region Position 4 Page Template Region Position 5 Page Template Region Position 6 Page Template Region Position 7 Page Template Region Position 8 Column 1 2 3 4 5 6 7 8 9
    [Body][Pos.1][Pos.2][Pos.3][Pos.4]
    Region HTML table cell attributes
    Source
    Region Source
    SELECT TK_IN_TIME,
    TK_OUT_TIME
    from "DAPDEV"."TIME_KEEPING_T"
    Use Query-Specific Column Names and Validate Query
    Use Generic Column Names (parse query at runtime only)
    Maximum number of generic report columns:

  • How to Install 11i on existing 10g and APEX setup

    Dear All,
    I am planning to install 11i EBS on my XP machine that already has oracle 10g and apex 3.2 installed. I am little worried that my lack on experience with EBS may end up me messing-up my existing database and setup. I am new to EBS but have good experience with Oracle database. I am looking for some pointers that will guide me to safer landing with 11i installation. Can you please advise what steps/precautions I need to consider before installing 11i on existing 10g database?
    Thanks
    Aali

    Hi ali;
    I am planning to install 11i EBS on my XP machine that already has oracle 10g and apex 3.2 installed. I am little worried that my lack on experience with EBS may end up me messing-up my existing database and setup. I am new to EBS but have good experience with Oracle database. I am looking for some pointers that will guide me to safer landing with 11i installation. Can you please advise what steps/precautions I need to consider before installing 11i on existing 10g database?I belive you can make this installation but i wonder your XP machine can run all those in same time? I suggest use Wmware or oracle Wm and make installation on it.
    Regard
    Helios

Maybe you are looking for