Order_by in set_block_property returns ORA-01785

Hello.
We have a problem with using function in set_block_property with order by when using union sentence.
Our code looks like:
set_block_property('block', default_where, 'id = '||:item||'
UNION ALL
SELECT ROWID,column1,column2,column3,... FROM table WHERE
id = '||:item);
set_block_property('block', order_by, 'function(column1), column2');
Form returns error: ORA -01785 : ORDER BY item must be the number of a SELECT-list expression
We know, that with union we should use numbers in order by instead of column names. But it doesn't work.
If we do not use UNION, then order_by with function works.
How can we solve this problem?
Thanks.
Edited by: DejanH on Sep 10, 2008 8:03 AM

Not sure you can ever get Forms to handle that complicated a query using default block processing.
Since it looks like your block is display-only, I would create a record group with the query and order by, populate it, and then step through the record group row-by-row moving the values to the block (which would then be a control-block rather than a base-table block). Of course, if your query selects more than a few hundred rows, this is not a good solution.

Similar Messages

  • ORA-01785: ORDER BY item must be the number of a SELECT-list expression

    I have a dynamic SQL on a page. The SQL is dynamic because there are 3 LOV fields from which the user may make selections, and those field values are used in the WHERE clause. Also, the 2nd LOV field is populated with AJAX based on the 1st LOV's selection. And, the SQL joins to another table. The report has 7 sortable columns. The main table the SQL runs over has about 1,000 rows in it.
    The 2nd table has about 500 rows. (Sorry, I'm not sure what information you might need to help me, so I listed several details.)
    The application, and page, have been working flawlessly for several weeks. Then, yesterday the page was being used and the user received the "ORA-01785: ORDER BY item must be the number of a SELECT-list expression" error. The error just appeared out of the blue, so to speak. After weeks of of usage this is the first time this error has appeared. The application had not been changed, but they had been entering data into the main table and the table joined to in the SQL. The application is in production, so I can't put the application into DEBUG, etc. to see what SQL is being built.
    Anyway, I was trying to debug the page today and was doing selections and seeing what would display, then as suddenly as the page quit working it started working correctly. No code changes made, no server changes made (to my knowledge), and no data changes made.
    I'm new to both Oracle and Apex, and am not a SQL, Oracle or Apex expert. So, I am very perplexed and don't have any idea of what could be happening.
    I don't know if it's an issue with the SQL, AJAX not loading the select fields properly, a corrupted table, a server load issue, or something else all together.
    Any suggestions?
    Also, I'm not familiar with Oracle error messages. Can they be red herrings sometimes? Because, I don't programmaticly code the ORDER BY of the SQL. Apex appends that part. So, how could that aspect quit working. And, then suddenly start working.
    Sorry, but I'm extremely confused. :-) Any suggestions or help will be greatly appreciated.
    Thanks, Tony

    Hi Dan,
    Thanks for the feedback. I'm not going to be dogmatic about possible cause, but it has myself and another Oracle developer (who writes SQL and PL/SQL in his sleep) stumped. He doesn't think it's the SQL. Your suggestion was one of the first things we thought of considering the error message we got, but from Scott's reply that it could be a red herring, and after additional testing we've ruled the SQL out for now.
    I understand what you're saying, but the SQL selects all the columns (about 40 columns are selected) that are sortable columns on the report. I've sorted by all the columns by clicking on them and that aspect works without error.
    The SQL is created dynamically and is quite large. I've included below just for information purposes.
    Thanks, Tony
    = = = = = = =
    DECLARE
    q VARCHAR2 (4000);
    BEGIN
    q := 'select ';
    q := q || 'hd."ID", hd."MODEL", hd."YEAR", hd."HIN", hd."BOAT_STATUS", hd."SPECIAL_ACTIVITY", hd."PARTIAL_KIT_VALUE",
    hd.OPTION_NUMBER || '' - '' || e.DESCRIPTION OPTION_NUMBER,
    hd."OPTIONS_HOURS", hd."OPTIONS_MATERIAL", hd."STATION", hd."ACTIVITY_COMMENT", hd."BI_EQUIV_MATERIAL",
    hd."BI_EQUIV_LABOR", hd."EI_EQUIV_MATERIAL", hd."EI_EQUIV_LABOR", hd."BASE_BOAT", hd."SA_ENGINES",
    hd."SA_OPTIONS", hd."DY_STANDARD_MATERIAL", hd."DY_STANDARD_LABOR", hd."DY_STANDARD_OVERHEAD",
    hd."DY_STANDARD_ENGINE", hd."DY_ENGINE_ENGINEUP", hd."DY_ENGINE_MATERIAL", hd."DY_ENGINE_LABOR",
    hd."DY_ENGINE_OVERHEAD", hd."DY_OPTIONS_MATERIAL", hd."DY_OPTIONS_LABOR", hd."DY_OPTIONS_OVERHEAD", hd."EI_STANDARD_UNITS", hd."EI_STANDARD_MATERIAL", hd."EI_STANDARD_LABOR", hd."EI_STANDARD_OVERHEAD", hd."EI_STANDARD_ENGINE", hd."EI_ENGINE_ENGINEUP", hd."EI_ENGINE_MATERIAL", hd."EI_ENGINE_LABOR", hd."EI_ENGINE_OVERHEAD", hd."EI_OPTIONS_MATERIAL", hd."EI_OPTIONS_LABOR", hd."EI_OPTIONS_OVERHEAD",
    htmldb_item.hidden(50,hd.ID) idalias ';
    q := q || 'from "PLP_HIN_DETAIL" hd , "PLP_ENGINES" e ';
    IF
    :P10_SEARCH_MODEL IS NOT NULL
    AND :P10_SEARCH_MODEL <> '%null%'
    AND :P10_SEARCH_YEAR IS NOT NULL
    AND :P10_SEARCH_YEAR <> '%null%'
    AND :P10_SEARCH_STATUS IS NOT NULL
    AND :P10_SEARCH_STATUS <> '%null%'
    THEN
    q := q || 'WHERE
    (instr(upper(hd.MODEL),upper(nvl(:P10_SEARCH_MODEL,hd.MODEL))) > 0
    AND instr(upper(hd.YEAR),upper(nvl(:P10_SEARCH_YEAR,hd.YEAR))) > 0
    AND instr(upper(hd.BOAT_STATUS),upper(nvl(:P10_SEARCH_STATUS,hd.BOAT_STATUS))) > 0)
    AND e.OPTION_NUMBER (+) = hd.OPTION_NUMBER and e.YEAR (+) = hd.YEAR AND e.MODEL (+) = hd.MODEL AND e.PLP_ID (+) = hd.PLP_ID';
    ELSE
    IF
    :P10_SEARCH_MODEL IS NOT NULL
    OR :P10_SEARCH_YEAR IS NOT NULL
    OR :P10_SEARCH_STATUS IS NOT NULL
    THEN
    q := q || 'WHERE
    (instr(upper(hd.MODEL),upper(nvl(:P10_SEARCH_MODEL,hd.MODEL))) > 0
    AND instr(upper(hd.YEAR),upper(nvl(:P10_SEARCH_YEAR,hd.YEAR))) > 0
    or instr(upper(hd.BOAT_STATUS),upper(nvl(:P10_SEARCH_STATUS,hd.BOAT_STATUS))) > 0)
    AND e.OPTION_NUMBER (+) = hd.OPTION_NUMBER and e.YEAR (+) = hd.YEAR AND e.MODEL (+) = hd.MODEL AND e.PLP_ID (+) = hd.PLP_ID';
    else
    q := q || 'WHERE e.option_number = hd.option_number and e.year = hd.year and e.model = hd.model and e.plp_id = hd.plp_id';
    END IF;
    END IF;
    q := q || ' AND :P0_PLP_ID = hd.PLP_ID';
    return q;
    END;

  • ORA-01785 error when dynamically resetting report source

    When programmatically changing the region source on a 'function body returning SQL query' report, i get the following error:
    ORA-01785: ORDER BY item must be the number of a SELECT-list expression
    if the new SQL statement has fewer columns than the one it is replacing, and the user had previously selected a sort column for a column# higher than the highest column number in the new query
    for instance if the query was SELECT * FROM EMP and the user had clicked the COMM header to sort on COMM (column number 7), then changing the region source to SELECT * FROM DEPT results in the ORA-01785 -- evidently because Apex is submitting SELECT * FROM DEPT ORDER BY 7
    is there a way to programmatically reset Apex's ORDER BY column# setting? clear cache and reset pagination don't seem to do it

    that put me on the right track
    i really didn't want to reset all user preferences, as i am making extensive use of them in this application
    however, i did find HTMLDB_UTIL.REMOVE_SORT_PREFERENCES -- which, unfortunately, removes all sort preferences, not for a specific page or region.
    i was able to find the correct preference in WWV_FLOW_PREFERENCES$, so I can user HTML_DB_UTIL.SET_PREFERENCE to reset it, but the preference_name includes the region#, which changes on import -- so i'll need to extract if at runtime using javascript, or figure out some other runtime technique for finding the correct preference_name
    hey, apex developers, how about enhancing HTMLDB_UTIL.REMOVE_SORT_PREFERENCES to allow setting/removing the sort preference for a specific page (by page number or alias) and region (by position on the page or some other reliable identifier?

  • Error ORA-01785, while viewing Application Express views in Utilities tab.

    Hi,
    I am unable to see data in Application Express Views in Utilities tab. I am using APEX 3.1.2.
    I am getting the following error,
    failed to parse SQL query:
    ORA-01785: ORDER BY item must be the number of a SELECT-list expression.
    There is no sort by in the SQL query. select WORKSPACE, APPLICATION_ID, APPLICATION_NAME
    from APEX_APPLICATION_BC_ENTRIES .
    Can anyone throw some light on this?
    Thanks
    Nimmi

    No, It is not that view I get the same error whenever I am in the Utilities Tab of APEX and trying to query Application Express views.
    Thanks

  • Oracle query on dblinked SQL Server tables returns ORA-00904 error

    Hi,
    I have created a dblink to a SQL Server database from Oracle using Generic Connectivity.
    The following query returns ORA-00904 Invalid Identifier error in the WHERE clause (tblEmp.Empno)
    SELECT "EmpNo","EmpName", "DeptName"
    FROM tblEmp@sqlserver,
    tblDept@sqlserver
    WHERE tblDept.DeptNo = tblEmp.Empno
    I had to enclose the column names in double quotes due to case sensitivitiy of the columns, but I can't do the
    same for the WHERE clause.
    1) So, how do I fix this error ?
    2) Also how do I include Deptno column with table alias in the columns list?
    (Deptno is ambiguous in Emp and Dept tables)
    Regards,
    Sam

    Alex
    Because using the aliases all the time can become annoying and lead to disparate standards when used by multiple developers. For a one-off query I would go with aliases in the query but if the linked tables are going to be interrogated extensively I would prefer to create vanilla views of the underlying tables so that the aliases aren't necessary.
    Just my opinion, it feels a bit cleaner to do it this way - you only do the work once in creating the view and then you don't need to worry about the case sensitivity of the linked database. You can also refer to the source in the name of the view so you don't have to think about different source databases with the same table names.
    Cheers
    Ben

  • ORA-01785

    Hi,
    Can anyone help me with this error - ORA-01785: ORDER BY item must be the number of a SELECT-list expression
    Both queries are running fine individually so i am quite confused.
    select oh.client_id,
           oh.customer_id,
           oh.name,
           to_char(trunc(oh.ship_by_date), 'DD-Mon-YYYY'),
           ol.order_id,
           sum(itl.update_qty) as cases_shipped,
           count(distinct itl.pallet_id) as no_pallets     
    from order_header oh, order_line ol, inventory_transaction itl
    where oh.order_id = ol.order_id
    and ol.line_id = itl.line_id
    and itl.reference_id = ol.order_id
    and itl.sku_id = ol.sku_id
    and oh.client_id = ol.client_id
    and itl.client_id = oh.client_id
    and itl.code = 'Shipment'
    and trunc(oh.ship_by_date) >= '16-FEB-10'
    and trunc(oh.ship_by_date) <= '20-FEB-10'
    and oh.client_id = 'NOM-TELFOR'
    group by oh.client_id, oh.customer_id, oh.name, trunc(oh.ship_by_date), ol.order_id
    UNION ALL
    select oh.client_id,
           oh.customer_id,
           oh.name,
           to_char(trunc(oh.ship_by_date), 'DD-Mon-YYYY'),
           ol.order_id,
           sum(itl.update_qty) as cases_shipped,
           count(distinct itl.pallet_id) as no_pallets   
    from order_header oh, order_line ol, inventory_transaction_archive itl
    where oh.order_id = ol.order_id
    and ol.line_id = itl.line_id
    and itl.reference_id = ol.order_id
    and itl.sku_id = ol.sku_id
    and oh.client_id = ol.client_id
    and itl.client_id = oh.client_id
    and itl.code = 'Shipment'
    and trunc(oh.ship_by_date) >= '16-FEB-10'
    and trunc(oh.ship_by_date) <= '20-FEB-10'
    and oh.client_id = 'NOM-TELFOR'
    group by oh.client_id, oh.customer_id, oh.name, trunc(oh.ship_by_date), ol.order_id
    order by trunc(oh.ship_by_date) asc, oh.client_id, oh.customer_idThanks in advance.
    SM.

    In a UNION you have to order on columns/expressions you're extractiong in the select list.
    And you have to use either the column numbers or the column aliases.
    Since you're trying to order on an expression that is not in the select list you need to do something like:
    select client_id,
           customer_id,
           name,
           to_char(ship_by_date, 'DD-Mon-YYYY'),
           order_id,
           cases_shipped,
           no_pallets  
    from (
    select oh.client_id,
           oh.customer_id,
           oh.name,
           trunc(oh.ship_by_date) ship_by_date,
           ol.order_id,
           sum(itl.update_qty) as cases_shipped,
           count(distinct itl.pallet_id) as no_pallets     
    from order_header oh, order_line ol, inventory_transaction itl
    where oh.order_id = ol.order_id
    and ol.line_id = itl.line_id
    and itl.reference_id = ol.order_id
    and itl.sku_id = ol.sku_id
    and oh.client_id = ol.client_id
    and itl.client_id = oh.client_id
    and itl.code = 'Shipment'
    and trunc(oh.ship_by_date) >= '16-FEB-10'
    and trunc(oh.ship_by_date) <= '20-FEB-10'
    and oh.client_id = 'NOM-TELFOR'
    group by oh.client_id, oh.customer_id, oh.name, trunc(oh.ship_by_date), ol.order_id
    UNION ALL
    select oh.client_id,
           oh.customer_id,
           oh.name,
           trunc(oh.ship_by_date),
           ol.order_id,
           sum(itl.update_qty) as cases_shipped,
           count(distinct itl.pallet_id) as no_pallets   
    from order_header oh, order_line ol, inventory_transaction_archive itl
    where oh.order_id = ol.order_id
    and ol.line_id = itl.line_id
    and itl.reference_id = ol.order_id
    and itl.sku_id = ol.sku_id
    and oh.client_id = ol.client_id
    and itl.client_id = oh.client_id
    and itl.code = 'Shipment'
    and trunc(oh.ship_by_date) >= '16-FEB-10'
    and trunc(oh.ship_by_date) <= '20-FEB-10'
    and oh.client_id = 'NOM-TELFOR'
    group by oh.client_id, oh.customer_id, oh.name, trunc(oh.ship_by_date), ol.order_id
    order by 4,1,2
    )Max
    http://oracleitalia.wordpress.com
    Edited by: Massimo Ruocchio on Mar 2, 2010 5:09 PM

  • Help on ORA-01785: ORDER BY item must be the number of a SELECT-list expres

    Hi
    Please find the SQL below . I am unable to place ORDER bY upper(column) due to error ORA-01785: ORDER BY item must be the number of a SELECT-list expression. Please help
    SELECT engn_cnslt_list.cnslt_hcp_id "hcp_id",
    hcp.first_nm "first_nm", hcp.last_nm "last_nm",
    FROM cnslt_engn, engn_tier_dtl, engn_cnslt_list, hcp
    WHERE cnslt_engn.cnslt_engn_id = engn_cnslt_list.cnslt_engn_id
    AND engn_cnslt_list.cnslt_hcp_id = hcp.hcp_id
    AND engn_tier_dtl.cnslt_engn_id = cnslt_engn.cnslt_engn_id
    AND engn_tier_dtl.engn_tier_dtl_id =
    engn_cnslt_list.engn_tier_dtl_id
    AND cnslt_engn.cnslt_engn_id = 100643
    AND engn_cnslt_list.cnslt_hcp_id NOT IN (
    SELECT hcp_id
    FROM mtg_cnslt_list
    WHERE cnslt_mtg_id IN (SELECT cnslt_mtg_id
    FROM cnslt_mtg
    WHERE cnslt_engn_id = 1000643)
    AND hcp_id IS NOT NULL)
    UNION
    SELECT mtg_cnslt_list.hcp_id "hcp_id", hcp.first_nm "first_nm",
    hcp.last_nm "last_nm",
    FROM cnslt_mtg,
    cnslt_engn,
    mtg_cnslt_list,
    engn_tier_dtl,
    engn_cnslt_list,
    hcp
    WHERE cnslt_engn.cnslt_engn_id = cnslt_mtg.cnslt_engn_id
    AND cnslt_engn.cnslt_engn_id = engn_cnslt_list.cnslt_engn_id
    AND engn_cnslt_list.cnslt_hcp_id = mtg_cnslt_list.hcp_id
    AND engn_cnslt_list.cnslt_hcp_id = hcp.hcp_id
    AND cnslt_mtg.cnslt_mtg_id = mtg_cnslt_list.cnslt_mtg_id
    AND engn_tier_dtl.cnslt_engn_id = cnslt_engn.cnslt_engn_id
    AND mtg_cnslt_list.engn_tier_dtl_id =
    engn_tier_dtl.engn_tier_dtl_id
    AND cnslt_engn.cnslt_engn_id = 1000643
    order by upper(last_nm),upper(first_nm)

    try:
    select * from (SELECT engn_cnslt_list.cnslt_hcp_id "hcp_id",
    hcp.first_nm "first_nm", hcp.last_nm "last_nm",
    FROM cnslt_engn, engn_tier_dtl, engn_cnslt_list, hcp
    WHERE cnslt_engn.cnslt_engn_id = engn_cnslt_list.cnslt_engn_id
    AND engn_cnslt_list.cnslt_hcp_id = hcp.hcp_id
    AND engn_tier_dtl.cnslt_engn_id = cnslt_engn.cnslt_engn_id
    AND engn_tier_dtl.engn_tier_dtl_id =
    engn_cnslt_list.engn_tier_dtl_id
    AND cnslt_engn.cnslt_engn_id = 100643
    AND engn_cnslt_list.cnslt_hcp_id NOT IN (
    SELECT hcp_id
    FROM mtg_cnslt_list
    WHERE cnslt_mtg_id IN (SELECT cnslt_mtg_id
    FROM cnslt_mtg
    WHERE cnslt_engn_id = 1000643)
    AND hcp_id IS NOT NULL)
    UNION
    SELECT mtg_cnslt_list.hcp_id "hcp_id", hcp.first_nm "first_nm",
    hcp.last_nm "last_nm",
    FROM cnslt_mtg,
    cnslt_engn,
    mtg_cnslt_list,
    engn_tier_dtl,
    engn_cnslt_list,
    hcp
    WHERE cnslt_engn.cnslt_engn_id = cnslt_mtg.cnslt_engn_id
    AND cnslt_engn.cnslt_engn_id = engn_cnslt_list.cnslt_engn_id
    AND engn_cnslt_list.cnslt_hcp_id = mtg_cnslt_list.hcp_id
    AND engn_cnslt_list.cnslt_hcp_id = hcp.hcp_id
    AND cnslt_mtg.cnslt_mtg_id = mtg_cnslt_list.cnslt_mtg_id
    AND engn_tier_dtl.cnslt_engn_id = cnslt_engn.cnslt_engn_id
    AND mtg_cnslt_list.engn_tier_dtl_id =
    engn_tier_dtl.engn_tier_dtl_id
    AND cnslt_engn.cnslt_engn_id = 1000643
    order by upper(last_nm),upper(first_nm)

  • A In-line view query works with 8.1.6 but returns ORA-1008 with 8.1.7

    Hello Gurus,
    The following query works fine with 8.1.6 but returns
    ORA-1008: not all variables bound
    with 8.1.7.
    Here is the query:
    SELECT y.node_id , y.parent_node_id
    FROM ( SELECT x.node_id
    ,x.parent_node_id
    FROM ( SELECT a.node_id
    ,a.parent_node_id
    FROM xor_hs_base_details a
    WHERE a.node_id <>
    a.parent_node_id
    AND a.base_id=1
    ) x
    CONNECT BY PRIOR x.node_id =
    x.parent_node_id
    START WITH x.parent_node_id = 1
    ) y
    WHERE y.node_id IN ( SELECT node_id
    FROM xor_hs_transactions
    WHERE hierarchy_id = 1
    AND created_by
    = 'system'
    AND committed_on IS NULL
    Any ideas??
    TIA.
    ...Atul

    After having a closer look at metalink it seems to be obvious, that Forms 6i (8.0.6.) only supports user exits generated with the 8.0.6. precompiler.
    If this is the case new questions follow:
    Is there a way to get a 8.0.6. precompiler?
    Is it possible to connect to a 8.1.5. database with such a user exit? Does anybody have corresponding experiences?
    Our customer uses a 8.1.7. database. What about connecting to that database with the user exit?
    /Ralph

  • Convert DD to DMS using sdo_coord_ops = 101 returns ORA-13199

    Hi,
    I need to convert lat/long DD to DMS.
    There is an operation in sdo_coord_ops (coord_op_id = 101) to do that but returns ORA-13199 when i try sdo_cs.add_preference_for_op
    I know that i can do that conversion with a function (Re: SDO_UTIL.BEARING_TILT_FOR_POINTS in a Select statement - thanks Simon!).
    How i know which operation that exists in sdo_coord_ops are actually implemented or not?
    Thanks!

    Well, if you check the documentation it's quite clear: Coordinate Systems (Spatial Reference Systems)
    Of course you could also run something like this:
    select co.coord_op_id,
           co.coord_op_name,
           com.coord_op_method_name,
           com.is_implemented_forward,
           com.is_implemented_reverse
    from sdo_coord_ops co,
         sdo_coord_op_methods com
    where co.coord_op_id = 101 and
          com.coord_op_method_id = co.coord_op_method_id;
    0 = not implemented, 1 = implemented.

  • OCITransCommit() returns ORA-01013 for correctly committed transaction

    I had the following issue which seems to me a critial bug in Oracle 11g:
    Breaking an oracle transaction asynchronously with OCIBreak() while transaction is being committed with OCITransCommit() did result in a correctly committed transaction on the database server. However OCITransCommit() returned ORA-01013 (user requested cancel of current operation) which is inconsistent. It should never happen that the transaction is correctly committed and OCITransCommit() returns anything other than OCI_SUCCESS.
    My assumption is that the transaction is only committed on the database server if the OCITransCommit() returns OCI_SUCCESS. Or is this assumption not always correct?
    Oracle version 11.2.0.3.0 64bit (Linux)

    As Karthick says, perhaps the Call Interface forum is a better place to ask.
    However, as a guess on my part (I've rarely had a need to go directly into OCI calls) from what I know of the internal workings of transactions on Oracle, the COMMIT operation is an atomic (if that's the right word to use here) operation. When you issue a COMMIT from your code, it doesn't go off to the database, do loads of work committing your data and writing it to the disks etc. before execution is returned to your code, it is a very basic instruction to the database to commit the data, which then goes off and does that in the background, whilst execution is returned immediately to the calling code, and Oracle in the background can take it's time getting the data written, and can present the data to your session and others, as if it is actually on the tables. This is all handled using the SCN and the logs internally and users don't have to worry about it (usually) because it all appears on the front end as though the data exists and is written on the tables.
    So, I'm curious as to how you (or the OCI calls) are managing to issue a "break" to try and break a commit from happening. Without seeing code it's hard to see how you are testing this.
    I've just looked up the documentation for TransCommit...
    http://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci17msc006.htm#LNOCI13112
    and I see you have the option of "Waiting" for the LGWR to write the transaction to the online redo logs, so that's a possible scenario for breaking, though I imagine you'd have to get in quickly with the break from another thread if the one thread is waiting for the commit.
    Intersting part of the docs...
    >
    Under normal circumstances, OCITransCommit() returns with a status indicating that the transaction has either been committed or rolled back. With global transactions, it is possible that the transaction is now in doubt, meaning that it is neither committed nor terminated. In this case, OCITransCommit() attempts to retrieve the status of the transaction from the server. The status is returned.
    >
    Still, it would be interesting to see the test code to reproduce this.... just my morbid curiosity for low level coding.... ;)

  • Bulk table update returning ORA-00001: unique constraint

    I'm trying to update every record in a PROPERTY table that has a CLASS of either 1 or 9 and a STATUS of 'LHLD'. CLASS and STATUS descriptor records are in different tables to the PROPERTY table but reference the PROPERTY records by the PROPERTY tables unid.
    I have wrote the following update command,
    UPDATE RNT_PROPERTY_DESCRIPTOR SET DESCRIPTOR = 'PROP', DESCRIPTOR_VALUE = '1', EFFECT_DATE = '01-APR-04', USER_ID = 'USER'
    WHERE RNT_PROPERTY_DESCRIPTOR.UNID IN (SELECT PROPERTY.UNID FROM PROPERTY, PROPERTY_CLASS_STATUS
    WHERE PROPERTY_CLASS_STATUS.PROP_CLASS = '1'
    OR PROPERTY_CLASS_STATUS .PROP_CLASS = '9'
    AND PROPERTY.UNID IN (SELECT PROPERTY.UNID FROM PROPERTY, PROP_STATUS_HIST
    WHERE PROP_STATUS_HIST.code = 'LHLD'));
    However, after executing for around 10 mins the process update fails and the following error is returned:
    ORA-00001: unique constraint (RNT_PROPERTY_DESCRIPTOR_IDX) violated
    I know that the IDX suffix refers to the table INDEX but I'm not sure why I'm getting a key constraint, none of the colums that I'm trying to update must be unique.
    For info the PROPERTY table has around 250,000 rows.
    Any ideas? Is there an error in my update statement?
    Thanks in advance.

    Gintsp,
    can you explain a little more? I'm not sure what you are suggesting that I try.
    Here is the output of what I have tried
    SQL> UPDATE RNT_PROPERTY_DESCRIPTOR SET DESCRIPTOR = 'PROP', DESCRIPTOR_VALUE = '1', EFFECT_DATE = '01-APR-04', USER_ID = 'USER'
    2 WHERE RNT_PROPERTY_DESCRIPTOR.UNID IN (SELECT PROPERTY.UNID FROM PROPERTY, PROPERTY_CLASS_STATUS
    3 WHERE PROPERTY_CLASS_STATUS.PROP_CLASS = '1'
    4 OR PROPERTY_CLASS_STATUS.PROP_CLASS = '9'
    5 AND PROPERTY.UNID IN (SELECT PROPERTY.UNID FROM PROPERTY, PROP_STATUS_HIST
    6 WHERE PROP_STATUS_HIST.CODE = 'LHLD'));
    UPDATE RNT_PROPERTY_DESCRIPTOR SET DESCRIPTOR = 'PROP', DESCRIPTOR_VALUE = '1', EFFECT_DATE = '
    ERROR at line 1:
    ORA-00001: unique constraint (RNT_PROPERTY_DESCRIPTOR_IDX) violated
    SQL> select owner, constraint_type, table_name, search_condition from user_constraints where constraint_name = 'RNT_PROPERTY_DESCRIPTOR_IDX';
    no rows selected
    The RNT_PROPERTY_DESCRIPTOR table structure is as follows:
    Name Null? Type
    UPRN NOT NULL NUMBER(7)
    DESCRIPTOR NOT NULL VARCHAR2(4)
    DESCRIPTOR_VALUE VARCHAR2(11)
    EFFECT_DATE NOT NULL DATE
    VALUE_DESCRIPTION VARCHAR2(35)
    POINTS NUMBER(2)
    POUNDS NUMBER(5,2)
    SUPERSEDED VARCHAR2(1)
    CURRENT_FLAG VARCHAR2(1)
    FUTURE VARCHAR2(1)
    END_EFFECT_DATE DATE
    USER_ID NOT NULL VARCHAR2(10)
    CREATE_DATE DATE
    -------------------------------------------------------------

  • SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT returns ORA-13199 SRID does not exist

    Hi everyone,
    I'm facing with this error while I was trying to list wrong spatial data (11.0.2.0.3 RAC (AIX))
    Select   *
    From     table
    Where    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT (GEOMETRY,0.001)! ='TRUE'
    It returns :
    ORA-13199: SRID does not exists
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_CS", line 5328
    ORA-06512: at "MDSYS.SDO_GEOM", line 483
    ORA-06512: at "MDSYS.SDO_GEOM", line 560
    ORA-06512: at line 1
    Is there anyone who faced with this kind of issue or any idea ?
    Thanks in advance
    Regards

    There is no such SRID 2000303. However, this one sure looks like it does the same thing. Replace all the SRID values with 2320 and you should be set.
    SQL> select *
      2  from MDSYS.SDO_COORD_REF_SYSTEM
      3  where srid = 2320;
          SRID COORD_REF_SYS_NAME                                                              COORD_REF_SYS_KIND
    COORD_SYS_ID  DATUM_ID GEOG_CRS_DATUM_ID SOURCE_GEOG_SRID PROJECTION_CONV_ID CMPD_HORIZ_SRID CMPD_VERT_SRID
    INFORMATION_SOURCE
    DATA_SOURCE                              IS_LE LEGACY_CODE
    LEGACY_WKTEXT
    LEGACY_CS_BOUNDS(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    IS_VA SUPPO
          2320 ED50 / TM30                                                                      PROJECTED
            4530                        6230            4230              16370
    General Command of Mapping via EuroGeographics; http://crs.ifag.de/
    EPSG                                    FALSE
    TRUE  TRUE

  • Forms application returns "ORA-01403 no data found" exception on Windows 7

    Hi everyone,
    I am currently involved in an application compatibility project for an O/S migration from Windows XP to Windows 7.
    We have a legacy Oracle Dev6i P18 Forms application that has been working perfectly on Windows XP for the last decade or so. When we installed the same application on Windows 7, it returned a pop-up error message with the text: "ORA-01403 no data found" when performing a certain operation (clicking on a Submit button in a specific form). The same operation works successfully on Windows XP displaying the message "Submit has been successful".
    This error is well documented and the solution involves adding an exception handler to the faulting SQL statement(s) in order to handle the ORA-01403 exception. Unfortunately, the application is composed of compiled forms (.FMX) and we no longer have the source code so I can't implement this solution.
    I ran a file comparison utility (WinDiff from the Windows SDK) and confirmed that all the files in the application folder and the Oracle Dev6i P18 folder are identical on both the Windows XP and Windows 7 systems.
    I enabled tracing in SQLNet.ORA by configuring TRACE_LEVEL_CLIENT=SUPPORT (I know, too verbose) and other related settings on both systems and have uploaded the traces to my SkyDrive for public viewing:
    http://sdrv.ms/10BNYtI
    The traces show that the "ORA-01403" exception occurs many times on both Windows XP and Windows 7 systems as a result of various SQL statements being executed, for instance:
    SELECT TASK_ID,TASK_DETAIL_STATUS,ASSIGNED_DATE FROM TASK_DETAILS WHERE TASK_ID = :b1 AND TASK_DETAIL_STATUS = (SELECT ID FROM V_TASK_STATUS WHERE ABBREVIATION = 'PLANNED' ) FOR UPDATE OF TASK_DETAIL_STATUS,ASSIGNED_DATE
    UPDATE TASK_DETAILS SET ASSIGNED_DATE=NTMS_UTIL.GET_SERVER_DATE,TASK_DETAIL_STATUS=(SELECT ID FROM V_TASK_STATUS WHERE ABBREVIATION = 'ASSIGNED' ) WHERE ROWID = :b1
    ORA-01403: no data found.
    So the same error happens on both Windows XP and Windows 7.
    On Windows XP, the error is somehow handled, and does not cause the "Submit" operation to fail.
    On Windows 7, however, the error bubbles to the surface and is displayed to the user, thus halting the "Submit" operation.

    Thank you. I'm well aware that adding an exception handler is the classic solution to the ORA-01403 error. However, like I mentioned in my original post, I don't have the source code. All I have are the compiled .FMX forms so I can't implement such a solution:
    From my original post:
    This error is well documented and the solution involves adding an exception handler to the faulting SQL statement(s) in order to handle the ORA-01403 exception. Unfortunately, the application is composed of compiled forms (.FMX) and we no longer have the source code so I can't implement this solution.

  • PLSQL function body returning an sql report returns ORA-01403 No Data Found

    I am on APEX 3.1.2.00.02 and Oracle 10g.
    I am developing a report with SQL Query (PL/SQL function body returning SQL query) type. But on running the report I am getting
    report error:
    ORA-01403: no data found
    Region Source
    declare
      qry varchar2(32767);
    begin
      --Procedure call
      my_pkg.get_query(qry);
      htp.p(qry);
      return /*select 1 from dual */ qry;
    end;
    Procedure
    PROCEDURE get_query (V_QRY OUT VARCHAR2)
    IS
      qry varchar2(32767);
    begin
      qry := ' select name
         , max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Jan-09"
         , max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Feb-09"
         from MY_TABLE
         group by name ';
      V_QRY := qry;
    end;
    The query will be enhanced later to add more months and year based on user parameters once I am successfull in running report on this.
    I wish to use Query Specific Column names. I have seen this suggestion from Scott in a number of threads to use /*select 1 from dual */ with query but not working in my case.
    Can someone please suggest what can I do to make it working?
    Regards,
    Amir

    Firstly, have you unit tested the procedure (namely, within the SQL Workshop, SQL*Plus, SQL Developer,etc, etc.) to see if it produces the right output in the first place?
    If you have, and the query string generated is valid, try assigning the output to a page item (thus allowing you to view it in the session browser) or even pass the procedure output into the debug window (with the use of the wwv_flow.debug function). This might reveal some state or session change which is causing it not to return.You might find this easier to achieve if you change from a 'procedure and out parameter' combination to a 'function returning string' approach.
    Alternatively, try re-creating the report in a new region - occasionally I've come across weird bugs with report regions which resolved themselves in this manner.

  • Report Builder 6i returns ORA-01483 in after parameter form trigger ?

    Can anybody help me ?
    I've been working on a report with report builder 6.0.8.11.3,
    and whenever i run the report the after parameter form trigger
    returns REP-1401 and following ORA-01483.
    I've been trying to change the values of some user parameters
    from within the trigger code, none of them is a date or a number
    parameter, these are character variables who would be referenced
    lexically to change a table name dynamically when the trigger
    fires. Aditionally I'm using a cursor to obtain data and then
    modify the parameters.
    How can i get this thing to work ?
    Thanks in advance for your reply...

    hello,
    this might be related to the usage of number(1) as type/length
    of your parameter. this is a known problem. it should be solved
    by using e.g. number(2) as the type/length of your parameter.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for