Does RULE hint cause ORA-01555 errors ?

DB Version:9.2.0.5.0
OS:SunOS 5.9
Our DBA is saying that the RULE hint in the below SQL might be causing ORA-01555 error. Is it true? Does RULE hint cause ORA-01555 errors
SELECT /*+ RULE */  COUNT(*)
  FROM ( SELECT /*+ RULE */  DISTINCT CAR_HDR.CAR_NBR AS A1, CAR_HDR.PLT_ID AS A29,
  CAR_HDR.PKT_CTRL_NBR AS A2, CAR_HDR.TOTAL_QTY AS A21, CAR_HDR.STAT_CODE AS A6,
  CAR_HDR.CURR_LOCN_ID AS A12,
  CAR_HDR.CAR_NBR  AS A145,
  CAR_HDR.WN_NBR AS A4, CAR_HDR.PCALL_NBR AS A7, CAR_HDR.CHAIN_CNT AS A119,
  CAR_HDR.SHPMT_NBR AS A35, LPN_HDR.WHSE AS A105, CAR_HDR.MISC_CAR AS A146, ''  AS A138,
  CAR_HDR.CHUTE_ID AS A132, CAR_HDR.MOD_DATE_TIME AS A82, LPN_HDR.LOCN_CLASS AS A106,
  LPN_HDR.AREA AS A107, LPN_HDR.ZONE AS A108, LPN_HDR.AISLE AS A109, LPN_HDR.BAY AS A110,
  LPN_HDR.LVL AS A111, LPN_HDR.POSN AS A112
      FROM INV_MASTER , CAR_DTL , LPN_HDR , CAR_HDR 
       WHERE CAR_HDR.CAR_NBR=CAR_DTL.CAR_NBR(+)
       AND CAR_HDR.CURR_LOCN_ID=LPN_HDR.LOCN_ID(+)
       AND CAR_HDR.WHSE=LPN_HDR.WHSE(+)
       AND CAR_DTL.SKU_ID=INV_MASTER.SKU_ID(+)
       AND CAR_HDR.CT_SEQ = 'ALB10'
       AND INV_MASTER.INV_CODE = 98
       AND INV_MASTER.TRACK_CODE = 'P10' )
      

user636669 wrote:
DB Version:9.2.0.5.0
OS:SunOS 5.9
Our DBA is saying that the RULE hint in the below SQL might be causing ORA-01555 error. Is it true? Does RULE hint cause ORA-01555 errorsThe full statement is causing the ORA-01555 error. Each line of the statement is important therefore each line is reponsible for the error. I personally think the DISTINCT keyword has a bigger influence than the RULE hint.
I suggest to check what you want to do with that count result. maybe there are better ways to get the same result. Maybe you can even ignore the distinct keyword or remove some outer joins. Using the CBO might result in the same plan as using the RBO, so you you will never know if that removing the hint will help or if if you'll get the same problem later again.

Similar Messages

  • ORA-01555 error ?

    I found one ora-01555 error in alert log at 14:37PM.But when i run the following query
    select ssolderrcnt from v$undostat where to_char(begin_time,'hh:mi:ss')='14:00:00' and to_char(end_time,'hh:mi:ss')='15:00:00'
    no rows selected is getting
    It has to show 1 as ora-01555 occured at 14:37pm.
    Whats wrong.?

    g, the reference material really does not apply to the question of this thread which is finding the v$undostat information for the time period when an ORA-015555 error occurred.
    Try this:
    select * from v$undostat
    where ssolderrcnt <> 0
    or nospaceerrcnt <> 0
    This should find all v$undostat periods where a 1555 occurred along with periods where you ran short of undo tablespace.
    Also v$undostat is only populated where undo management is in effect. There should be 404 rows in this view if undo management is in effect otherwise this view is not useable for this purpose.
    HTH -- Mark D Powell --

  • When will ora-01555 error not be recorded in alert file?

    Application side repeatably gets ora-01555 error, but from alert log, there is no such error recorded. I recalled normally this error will be recorded, so under which condition we can't find this error in alert file?

    You would get ORA-0155 on a LOB if
    a) the LOB storage has been defined with PCTVERSION which is low (Oracle doesn't use Undo Segments but uses space in the LOB Segment itself and if this is inadequate for multiple updates, an ORA-0155 is raised, which is not really related to Undo Segments but the space in the LOB segment)
    b) the LOB storage has been defined with RETENTION which is low
    (Even if you increase undo_retention, you'd have to modify the LOB segment to PCTVERSION and then back to RETENTION for it to use the new undo_retention value).
    See MetaLink Notes 162345.1, 66431.1 and 563470.1
    Since the ORA-01555 error doesn't really relate to Undo segments, I believe that it would not be reported in the alert.log file -- but I haven't verified this.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • ORA-01555 error when assigning values based on geometry

    Hello,
    I have a table with 220,000+ records with street information, and I am trying to assign a municipal area (stored in another table) based on the geometry of the road line and the geometry of the municipal boundary.
    CREATE TABLE TEMP AS SELECT A.ID, B.AREA FROM ROADS A, PLACES B WHERE B.TYPE IN (33,35,36,37) AND mdsys.sdo_relate (a.geometry,b.geometry,'
    mask=inside querytype = window')='TRUE';
    This took a long time to run and it came back with a series of errors, one of which was ORA--01555 'snapshot too old'. I was running other queries on the table (in a separate SQL window) because I'm under a deadline, so i figured that doing multiple things at one time while the spatial query was running was causing the problem. I didn't have time to run it again (it was the end of the day when the error came up, conveniently) so I am trying to work out a solution to this issue.
    Would it be better if I: a) ran the statement again on the whole dataset and did nothing else while it is running, even though it will still take a while, or
    b) broke it up into groups of 50,000 records and run the statement on one group at a time and hope for the best.
    Thanks in advance!

    Assuming you have less municipal areas than roads, the query should perform better by specifying the join order:
    CREATE TABLE TEMP AS (
         SELECT /*+ ORDERED */ A.ID, B.AREA
         FROM PLACES B, ROADS A
         WHERE B.TYPE IN (33,35,36,37)
         AND mdsys.sdo_relate (a.geometry, b.geometry,'mask=inside querytype = window') = 'TRUE');Also, are you sure 'inside' is the right mask to use here? What if a road intersects the edge of the municipality? In that case it wouldn't be returned by this query.

  • Help to produce an ora-01555 error.

    Hello all,
    I've been gotten wind of about UNDO management, but I'm not able to reproduce an ora-01555. I tried one way that I found in some metalink notes but I didn't succeed. I know that using some PL/SQL statements I get there, but how can I achieve it?
    I appreciate your help.
    Thanks in advance,
    Regards,
    Emerson

    Easy to reproduce. Just use flashback query to an SCN that has aged out of undo.
    E.g
    SQL> select object_id from test as of scn 5936742 where object_id = 20;
    select object_id from test as of scn 5936742 where object_id = 20
    ERROR at line 1:
    ORA-01555: snapshot too old: rollback segment number 6 with name
    "_SYSSMU6_2443381498$" too smallAnother option is to reduce undo retention, shrink the undo tablespace and turn off autoextend. Then in one session run a long select, and in another session run a loop with an update and a commit.
    E.g
    begin
    for i in 1..10000 loop
    update test set object_id = object_id where object_id = 20;
    commit;
    end loop;
    end;
    /

  • ORA-01555 error, snapshot too old

    I am getting this error message trying to run a report:
    ORA-01555 snapshot too old: rollback segment number 4 with name "R03" too small.
    No report generated.
    Any help to correct the problem would be much appreciated.
    null

    You need to contact your DBA and ask him to tune the rollback segments or tune up your query. You need a larger rollback segment to run your report query.
    null

  • Append Hint causing ORA-00603: ORACLE server session terminated by fatal er

    Hi All,
    I am facing Service Terminated by Fatal Error when using APPEND hint in my Insert statement.
    We are executing the below commands in Oracle 9ir2.
    This is the scenario which I am facing.
    SQL> insert into VALIDTRANSACTIONLINE select * from TRANSACTIONONLINE;
    1910534 rows created. --works fine
    SQL> rollback;
    Rollback complete.
    SQL> insert /*+ append */ into VALIDTRANSACTIONLINE select * from TRANSACTIONONLINE;
    ERROR at line 1:
    ORA-00603: ORACLE server session terminated by fatal error
    FYI: The table is having LOGGING-NO and the tablespace for this table is having more than 5GB of free space and undotablespace is also around 650 MB and the total size of insertion will be less than 50MB records.
    Has anyone faced this kind of issue.
    Appreciate your response.
    Thanks,
    Madhu K.

    Hi,
    FYI:
    I can see the undotablespace is having 0MB free space.
    it is a very strage issue.
    With Undotablespace Zero, I was able to insert the data having APPEND Hint but no indexes on the table.
    But when I create an Index on the Table and the Index is also in NOLOGGING mode, the Insertion is again failed with FATAL Error.
    Ex: No Index on the table.
    SQL> INSERT +append
    2 INTO credit
    3 SELECT /*+ driving_site(t1) */ * FROM tru_cmp.credit@EPSARCDV_TO_EPSDEV1.DIRECTV.COM t1 WHERE PERIODSEQ =300;
    1999401 rows created.
    CREATE UNIQUE INDEX TRU_CMP.CREDIT_PK_IND ON TRU_CMP.CREDIT
    (CREDITSEQ)
    NOLOGGING
    TABLESPACE TALLYINDEX
    NOPARALLEL
    INSERT +append
    INTO credit
    SELECT /*+ driving_site(t1) */ * FROM tru_cmp.credit@EPSARCDV_TO_EPSDEV1.DIRECTV.COM t1 WHERE PERIODSEQ =300;
    ERROR at line 3:
    ORA-00603: ORACLE server session terminated by fatal error
    Can you let me is this related to the Data File issue, so that I can ask the DBA to look into this as I dont have access to those alert log files.
    Thanks,
    Madhu K.

  • Unable to deploy a mapping causing ORA, PLS error

    I have a simple mapping, sourec is a table and target is flat file. I have a transformation expression and my expression is as follows :
    ORA-06550: line 799, column 7:
    PLS-00103: Encountered the symbol "|" when expecting one of the following:
    INGRP1.COMPANY_ID ||','||
    INGRP1.ADSI_AGENT_ID ||','||
    INGRP1.DISTRIBUTION_CHANNEL ||','||
    INGRP1.PRODUCT_CODE ||','||
    INGRP1.CONTRACT_ID ||','||
    INGRP1.EVENT_ID ||','||
    INGRP1.COMM_EVENT_CODE ||','||
    TO_CHAR(INGRP1.PRICE_DATE,'MM/DD/RRRR') ||','||
    TO_CHAR(INGRP1.CYCLE_DATE,'MM/DD/RRRR') ||','||
    TO_CHAR(INGRP1.COMM_AMOUNT,'999,999,999.99')||','||
    TO_CHAR(INGRP1.COMM_RATE,'99.9999')||','||
    SUBSTR(INGRP1.EVENT_DESC,1,10) ||','||
    TO_CHAR(INGRP1.STATEMENT_DATE ,'MM/DD/RRRR')||','||
    DECODE(INGRP1.NSCC_IND,'Y','Yes','N','No')
    When I deploy this mapping, I am getting foloowing error:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    If I take out the DECODE function from the Expression builder and then deploy , it works OK. Coudl anyone sugegst me what is the problem here.
    Thanks
    Suhail

    Suhail,
    Just thought about something else that is not ideal, but should work: use the decode as a standalone operation in one attribute, and in the next expression, concatenate the result of two previous expression attributes. This should work also (but I know it is not ideal).
    Thanks,
    Mark.

  • Urgent help please.  Inner Join caused ora-00933 error

    I ran this one , works fine:
    SELECT DISTINCT EXP.EXP_ID,
    EXP.DATU_EXP_WIRE_CENTER_CLLI,
    EXP.DATU_EXP_IP,
    EXP.DATU_EXP_CLLI,
    EXP.DATU_EXP_PORT,
    EXP.DATU_EXP_NAME,
    EXP.DATU_EXP_CITY,
    EXP.DATU_EXP_STATE,
    EXP.DATU_EXP_SW_VERSION,
    DECODE(LAST_ALARM.LAST_ALARM_DATE, NULL, TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS'),
         TO_CHAR(LAST_ALARM.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS STATUS_DATE,
    DECODE(LAST_ALARM.ALARM_NAME, NULL, 'Disconnected', LAST_ALARM.ALARM_NAME) AS DATU_STATUS,
    DECODE(LAST_ALARM.ALARM_CLASS, NULL, 'OTHER', LAST_ALARM.ALARM_CLASS) AS IS_ERROR_STATUS,
         DECODE(LAST_RESOURCE.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_RESOURCE.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS RESOURCE_STATUS_DATE,
         DECODE(LAST_RESOURCE.RESOURCE_CODE_NAME, NULL, '', LAST_RESOURCE.RESOURCE_CODE_NAME) AS RESOURCE_STATUS,
         DECODE(LAST_RESOURCE.RESOURCE_CODE_CLASS, NULL, '', LAST_RESOURCE.RESOURCE_CODE_CLASS) AS IS_RESOURCE_ERROR_STATUS,
         DECODE(LAST_OPER.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_OPER.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS OPER_STATUS_DATE,
         DECODE(LAST_OPER.OPER_CODE_NAME, NULL, '', LAST_OPER.OPER_CODE_NAME) AS OPER_STATUS,
         DECODE(LAST_OPER.OPER_CODE_CLASS, NULL, '', LAST_OPER.OPER_CODE_CLASS) AS IS_OPER_ERROR_STATUS,
    EXP.BEGIN_MAINT_WINDOW, RTU.RTU_NAME
    FROM TT_DATU_EXP_UNIT_INFO EXP
         left outer join
    ( SELECT distinct alarmed_datus.EXP_ID, c.ALARM_NAME, c.ALARM_TYPE, c.ALARM_CLASS, alarmed_datus.LAST_ALARM_DATE
    FROM ( SELECT EXP_ID, MAX(ALARM_TIME) AS LAST_ALARM_DATE FROM TT_DATU_EXP_ALARM_INFO GROUP BY EXP_ID ) alarmed_datus
    inner join TT_DATU_EXP_ALARM_INFO b on b.EXP_ID = alarmed_datus.EXP_ID AND b.ALARM_TIME = alarmed_datus.LAST_ALARM_DATE
    inner join TT_DATU_EXP_ALARM_TYPES c on b.ALARM_TYPE = c.ALARM_TYPE
    ) LAST_ALARM on EXP.EXP_ID = LAST_ALARM.EXP_ID
         left outer join
         ( SELECT distinct a.EXP_ID, c.RESOURCE_CODE_NAME, c.RESOURCE_CODE_TYPE, c.RESOURCE_CODE_CLASS, a.LAST_ALARM_DATE
         FROM ( SELECT EXP_ID, MAX(RESOURCE_CODE_TIME) AS LAST_ALARM_DATE
         FROM TT_DATU_EXP_RESOURCE_CODE_INFO GROUP BY EXP_ID ) a
    inner join TT_DATU_EXP_RESOURCE_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.RESOURCE_CODE_TIME = a.LAST_ALARM_DATE
    inner join TT_DATU_EXP_RESOURCECODE_TYPES c on b.RESOURCE_CODE_TYPE = c.RESOURCE_CODE_TYPE
         ) LAST_RESOURCE on EXP.EXP_ID = LAST_RESOURCE.EXP_ID
         left outer join
         ( SELECT distinct a.EXP_ID, c.OPER_CODE_NAME, c.OPER_CODE_TYPE, c.OPER_CODE_CLASS, a.LAST_ALARM_DATE
         FROM ( SELECT EXP_ID, MAX(OPER_CODE_TIME) AS LAST_ALARM_DATE
         FROM TT_DATU_EXP_OPER_CODE_INFO GROUP BY EXP_ID ) a
    inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
    inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID
    inner join TT_DATU_LRN_MAP LRNS on EXP.EXP_ID = LRNS.EXP_ID AND TRIM(LRNS.LRN) LIKE p_LRN
    inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
    WHERE NOT EXISTS (SELECT SATELLITE_EXP_ID FROM TT_HOST_SATELLITE WHERE EXP.EXP_ID = SATELLITE_EXP_ID)
    AND EXP.IS_PRIMARY_ADDRESS LIKE p_isPrimary;
         ELSE
         OPEN v_cursor FOR
    SELECT EXP.EXP_ID,
    EXP.DATU_EXP_WIRE_CENTER_CLLI,
    EXP.DATU_EXP_IP,
    EXP.DATU_EXP_CLLI,
    EXP.DATU_EXP_PORT,
    EXP.DATU_EXP_NAME,
    EXP.DATU_EXP_CITY,
    EXP.DATU_EXP_STATE,
    EXP.DATU_EXP_SW_VERSION,
    DECODE(LAST_ALARM.LAST_ALARM_DATE, NULL, TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS'), TO_CHAR(LAST_ALARM.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS STATUS_DATE,
    DECODE(LAST_ALARM.ALARM_NAME, NULL, 'Disconnected', LAST_ALARM.ALARM_NAME) AS DATU_STATUS,
    DECODE(LAST_ALARM.ALARM_CLASS, NULL, 'OTHER', LAST_ALARM.ALARM_CLASS) AS IS_ERROR_STATUS,
         DECODE(LAST_RESOURCE.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_RESOURCE.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS RESOURCE_STATUS_DATE,
         DECODE(LAST_RESOURCE.RESOURCE_CODE_NAME, NULL, '', LAST_RESOURCE.RESOURCE_CODE_NAME) AS RESOURCE_STATUS,
         DECODE(LAST_RESOURCE.RESOURCE_CODE_CLASS, NULL, '', LAST_RESOURCE.RESOURCE_CODE_CLASS) AS IS_RESOURCE_ERROR_STATUS,
         DECODE(LAST_OPER.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_OPER.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS OPER_STATUS_DATE,
         DECODE(LAST_OPER.OPER_CODE_NAME, NULL, '', LAST_OPER.OPER_CODE_NAME) AS OPER_STATUS,
         DECODE(LAST_OPER.OPER_CODE_CLASS, NULL, '', LAST_OPER.OPER_CODE_CLASS) AS IS_OPER_ERROR_STATUS,
    EXP.BEGIN_MAINT_WINDOW, RTU.RTU_NAME
    FROM TT_DATU_EXP_UNIT_INFO EXP
         left outer join (
    SELECT distinct alarmed_datus.EXP_ID, c.ALARM_NAME, c.ALARM_TYPE, c.ALARM_CLASS, alarmed_datus.LAST_ALARM_DATE
    FROM (SELECT EXP_ID, MAX(ALARM_TIME) AS LAST_ALARM_DATE FROM TT_DATU_EXP_ALARM_INFO GROUP BY EXP_ID ) alarmed_datus
         inner join TT_DATU_EXP_ALARM_INFO b on b.EXP_ID = alarmed_datus.EXP_ID AND b.ALARM_TIME = alarmed_datus.LAST_ALARM_DATE
         inner join TT_DATU_EXP_ALARM_TYPES c on b.ALARM_TYPE = c.ALARM_TYPE )
         LAST_ALARM on EXP.EXP_ID = LAST_ALARM.EXP_ID
         left outer join
              ( SELECT distinct a.EXP_ID, c.RESOURCE_CODE_NAME, c.RESOURCE_CODE_TYPE, c.RESOURCE_CODE_CLASS, a.LAST_ALARM_DATE
              FROM ( SELECT EXP_ID, MAX(RESOURCE_CODE_TIME) AS LAST_ALARM_DATE
              FROM TT_DATU_EXP_RESOURCE_CODE_INFO GROUP BY EXP_ID ) a
         inner join TT_DATU_EXP_RESOURCE_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.RESOURCE_CODE_TIME = a.LAST_ALARM_DATE
         inner join TT_DATU_EXP_RESOURCECODE_TYPES c on b.RESOURCE_CODE_TYPE = c.RESOURCE_CODE_TYPE) LAST_RESOURCE on EXP.EXP_ID = LAST_RESOURCE.EXP_ID
         left outer join
              ( SELECT distinct a.EXP_ID, c.OPER_CODE_NAME, c.OPER_CODE_TYPE, c.OPER_CODE_CLASS, a.LAST_ALARM_DATE
              FROM ( SELECT EXP_ID, MAX(OPER_CODE_TIME) AS LAST_ALARM_DATE
              FROM TT_DATU_EXP_OPER_CODE_INFO GROUP BY EXP_ID ) a
         inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
         inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
              ) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID ORDER BY EXP.DATU_EXP_CLLI
         inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
    WHERE NOT EXISTS (SELECT SATELLITE_EXP_ID FROM TT_HOST_SATELLITE WHERE EXP.EXP_ID = SATELLITE_EXP_ID) AND EXP.IS_PRIMARY_ADDRESS like
    p_isPrimary;
    However this one:
    SELECT EXP.EXP_ID,
    EXP.DATU_EXP_WIRE_CENTER_CLLI,
    EXP.DATU_EXP_IP,
    EXP.DATU_EXP_CLLI,
    EXP.DATU_EXP_PORT,
    EXP.DATU_EXP_NAME,
    EXP.DATU_EXP_CITY,
    EXP.DATU_EXP_STATE,
    EXP.DATU_EXP_SW_VERSION,
    DECODE(LAST_ALARM.LAST_ALARM_DATE, NULL, TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS'),
         TO_CHAR(LAST_ALARM.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS STATUS_DATE,
    DECODE(LAST_ALARM.ALARM_NAME, NULL, 'Disconnected', LAST_ALARM.ALARM_NAME) AS DATU_STATUS,
    DECODE(LAST_ALARM.ALARM_CLASS, NULL, 'OTHER', LAST_ALARM.ALARM_CLASS) AS IS_ERROR_STATUS,
         DECODE(LAST_RESOURCE.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_RESOURCE.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS RESOURCE_STATUS_DATE,
         DECODE(LAST_RESOURCE.RESOURCE_CODE_NAME, NULL, '', LAST_RESOURCE.RESOURCE_CODE_NAME) AS RESOURCE_STATUS,
         DECODE(LAST_RESOURCE.RESOURCE_CODE_CLASS, NULL, '', LAST_RESOURCE.RESOURCE_CODE_CLASS) AS IS_RESOURCE_ERROR_STATUS,
         DECODE(LAST_OPER.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_OPER.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS OPER_STATUS_DATE,
         DECODE(LAST_OPER.OPER_CODE_NAME, NULL, '', LAST_OPER.OPER_CODE_NAME) AS OPER_STATUS,
         DECODE(LAST_OPER.OPER_CODE_CLASS, NULL, '', LAST_OPER.OPER_CODE_CLASS) AS IS_OPER_ERROR_STATUS,
    EXP.BEGIN_MAINT_WINDOW, RTU.RTU_NAME
    FROM TT_DATU_EXP_UNIT_INFO EXP
         left outer join
    SELECT distinct alarmed_datus.EXP_ID, c.ALARM_NAME, c.ALARM_TYPE, c.ALARM_CLASS, alarmed_datus.LAST_ALARM_DATE
    FROM ( SELECT EXP_ID, MAX(ALARM_TIME) AS LAST_ALARM_DATE FROM TT_DATU_EXP_ALARM_INFO GROUP BY EXP_ID) alarmed_datus
         inner join TT_DATU_EXP_ALARM_INFO b on b.EXP_ID = alarmed_datus.EXP_ID AND b.ALARM_TIME = alarmed_datus.LAST_ALARM_DATE
         inner join TT_DATU_EXP_ALARM_TYPES c on b.ALARM_TYPE = c.ALARM_TYPE ) LAST_ALARM on EXP.EXP_ID = LAST_ALARM.EXP_ID
         left outer join
              ( SELECT distinct a.EXP_ID, c.RESOURCE_CODE_NAME, c.RESOURCE_CODE_TYPE, c.RESOURCE_CODE_CLASS, a.LAST_ALARM_DATE
              FROM ( SELECT EXP_ID, MAX(RESOURCE_CODE_TIME) AS LAST_ALARM_DATE
              FROM TT_DATU_EXP_RESOURCE_CODE_INFO GROUP BY EXP_ID ) a
         inner join TT_DATU_EXP_RESOURCE_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.RESOURCE_CODE_TIME = a.LAST_ALARM_DATE
         inner join TT_DATU_EXP_RESOURCECODE_TYPES c on b.RESOURCE_CODE_TYPE = c.RESOURCE_CODE_TYPE) LAST_RESOURCE on EXP.EXP_ID = LAST_RESOURCE.EXP_ID
         left outer join
              ( SELECT distinct a.EXP_ID, c.OPER_CODE_NAME, c.OPER_CODE_TYPE, c.OPER_CODE_CLASS, a.LAST_ALARM_DATE
              FROM ( SELECT EXP_ID, MAX(OPER_CODE_TIME) AS LAST_ALARM_DATE
              FROM TT_DATU_EXP_OPER_CODE_INFO GROUP BY EXP_ID ) a
         inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
         inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
              ) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID ORDER BY EXP.DATU_EXP_CLLI
    inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
    WHERE EXP.IS_PRIMARY_ADDRESS like p_isPrimary;
    this one not work kept giving me errors:
    [ ORA-00933: SQL command not properly ended
    Any guru can help? I need to have this resolved end of today.
    Thanks in advance.

    Hi,
    Never write, let alone post, unformatted code.
    Indent the code so that it's easy to set the scope of sub-queries, and the majoc clauses (SELECT, FROM, WHERE, ORDER BY, ...) in each.
    When posting any formatted text on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    If you do that to the code you posted, you'll see that it ends like this:... inner join     TT_DATU_EXP_OPER_CODE_INFO     b on b.EXP_ID     = a.EXP_ID
                                       AND      b.OPER_CODE_TIME = a.LAST_ALARM_DATE
         inner join      TT_DATU_EXP_OPER_CODE_TYPES      c on      b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
         ) LAST_OPER          on EXP.EXP_ID = LAST_OPER.EXP_ID
    ORDER BY EXP.DATU_EXP_CLLI
    inner join TT_RTU_TYPES RTU     ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
    WHERE EXP.IS_PRIMARY_ADDRESS      like p_isPrimary
    You can't put an ORDER BY clause  in the middle of the FROM clause.
    The ORDER BY clause always goes after the WHERE clause, like this:... inner join     TT_DATU_EXP_OPER_CODE_INFO     b on b.EXP_ID     = a.EXP_ID
                                       AND      b.OPER_CODE_TIME = a.LAST_ALARM_DATE
         inner join      TT_DATU_EXP_OPER_CODE_TYPES      c on      b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
         ) LAST_OPER          on EXP.EXP_ID = LAST_OPER.EXP_ID
    inner join TT_RTU_TYPES RTU     ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
    WHERE EXP.IS_PRIMARY_ADDRESS      like p_isPrimary
    ORDER BY EXP.DATU_EXP_CLLI

  • Query Builder - sort order causing ORA-00979 error

    Hello,
    I'm having an issue with the "sort order" clause in the query builder tool when using a function on the same column.
    I've build a simple query in the gui and the following statement is displayed in the SQL Window
    select     "DEMO_ORDER_ITEMS"."ORDER_ID" as "ORDER_ID",
         sum(DEMO_ORDER_ITEMS.QUANTITY) as "QUANTITY"
    from     "DEMO_ORDER_ITEMS" "DEMO_ORDER_ITEMS"
    group by DEMO_ORDER_ITEMS.ORDER_ID
    and if I add a sort order of "1" on the quantity field, the following query is changed to
    select     "DEMO_ORDER_ITEMS"."ORDER_ID" as "ORDER_ID",
         sum(DEMO_ORDER_ITEMS.QUANTITY) as "QUANTITY"
    from     "DEMO_ORDER_ITEMS" "DEMO_ORDER_ITEMS"
    group by DEMO_ORDER_ITEMS.ORDER_ID
    order by DEMO_ORDER_ITEMS.QUANTITY DESC
    When running this query I get an error
    failed to parse SQL query:
    ORA-00979: not a GROUP BY expression
    It is quite obvious what is wrong with the query but I don't know how to get the query builder tool to generate the correct statement. The order by clause should be order by sum(DEMO_ORDER_ITEMS.QUANTITY) DESC.
    I've tried to do some searching and haven't found much documentation on this issue. Any assistance is appreciated.
    Thanks,
    Tony

    While this statement is generally certainly true and should also be remembered, it is not really helpful for the specific case.
    I think the behaviour described is a bug. However this might be one a little difficult to solve. The user unfortunatly can't influence much of the query builder results directly.
    Either put 1 into the order by clause or use the column alias name without table alias name ("QUANTITY" only).
    My personal solution would be NOT TO use any sort criteia in the query builder. This makes sense in so far as the generated SQL is often basis for some report. If that is an interactive report you won't add a sort order anyway. This is a layout thing and layout will be handled by the end user itself. he can choose whatever sorting he wants.
    Edited by: Sven W. on Jul 22, 2009 11:43 AM

  • Creating a view using With causes ORA-00600 Error

    Hello Ladies and Gents,
    I've been trying to deploy a recursive query as a view in Oracle XE and Standard Edition, neither to much success.
    The query is located in this question here: http://stackoverflow.com/questions/17358109/how-to-retrieve-all-recursive-children-of-parent-row-in-oracle-sq
    with recursion_view(base, parent_id, child_id, qty) as (
       -- first step, get rows to start with
       select
      parent_id base,
      parent_id,
      child_id,
      qty
      from
      md_boms
      union all
      -- subsequent steps
      select
       -- retain base value from previous level
      previous_level.base,
       -- get information from current level
      current_level.parent_id,
      current_level.child_id,
       -- accumulate sum
       (previous_level.qty + current_level.qty) as qty
      from
      recursion_view previous_level,
      md_boms current_level
      where
      current_level.parent_id = previous_level.child_id
    select
      base, parent_id, child_id, qty
    from
      recursion_view
    order by
      base, parent_id, child_id
    The query itself works and returns results. However, when I try to create a view with that query, I receive errors.
    I've posted two screenshots: http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/ViewError.jpg and http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/InternalError.jpg The first one with the ! and * is when I am using JDeveloper 11g, using the Database Navigator, right-click on View and select "New View". I receive the error when I click OK. I can indeed create the view through a sql script, but when I attempt to view the data, I receive the ORA_00600 error.
    I've tried this on both my local machine for XE (version 11.2.0.2.0) and on 11g Standard Edition (11.2.0.2.v6) via Amazon Web Services. The result is the same.
    Does anyone know how to get around this?

    Not 5 minutes after I post this, I decide not to use JDev's graphical editor, and simply write
    SELECT * FROM BOMS_VIEW;
    And it works like a charm.  I just can't use data tab to view the records in the editor.  Wish I had known that 5 hours ago.

  • How do you avoid the ORA-01555 error in oracle 8i?

    please give me examples.

    i have to disagree with gopalora
    Increasing rollback segments will make large updates/inserts not to fail.
    Do frequent Logical Commits will make large updates/inserts not to fail (besides the performance issues).
    What you have is a long query failing from frequent updated table,
    In any point while the query is running, some rows get updated, making the resultset inconsistent.
    Action
    Old Snapshot >>>>>>>>>>>>>>>>>>>>>>>>>> |
    Query. ----------------------------------------------------------------x--------------------------------------------->
    Update >>>>>>>>>>>>>>>> U
    Commit >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ^
    If that's the case then this should help.
    Workaround:
    Try splitting the data you are retrieving. ( by Date for instance).
    If you are retrieving a whole year get it month by month instead.
    I hope this helps.

  • ORA-01555 caused by SQL statement below - Kindly assist

    Hi,
    Version 9.2.0.7
    I have been getting lots of ORA-01555 error logged into my alert log since 10 hours ago, happening every second till now.
    The ORA-01555 is strange compared to those that have occured in my database before. From the error logged into the alert log, the statement is reflected as "table_4_200_c432_0_0_0". Any experts can advise what's exactly happening? The duration stated below seems really long.
    ORA-01555 caused by SQL statement below (Query Duration=1225798260 sec, SCN: 0x077a.e8ab9ae8):
    Tue Nov 4 19:31:00 2008
    table_4_200_c432_0_0_0
    thanks

    That event trace is helpful only when you are getting ORA-01555 in trace files without a query.
    Of course, you cannot get the diagnostic information for something that occurred in past (when diagnostics were not in place); so you have to wait till the next occurrence (if any) of ORA-01555 under similar conditions.

  • UNdo error (ora-01555) - Snapshot too old error

    Hi,
    If undo get filled and if we get a snapshot too old error then what is the solution for this error, plz give step by step solution for this.

    You prevent ORA-01555 errors by
    1) Setting UNDO_RETENTION equal to or greater than the length of the longest running query/ serializable transaction in the system
    2) Ensuring the UNDO tablespace is large enough to accomodate the amount of UNDO generated over that period of time.
    You would need to determine things like the length of your longest running query, the amount of UNDO getting generated, etc. and adjust your UNDO_RETENTION and UNDO tablespace accordingly.
    Justin

  • ORA-01555 when performing refresh of materialized views via DBMS_JOB

    All,
    With this project needing to be finished soon and an issue occuring on the local database, I am hopefuly one of you will have the answer or resolution so that I may complete this project soon....
    Here is the setup..
    10g database (remote)
    9i database (local
    DB Link from local to remote database
    103 materialized views in local database that are refreshed by pulling data from dblink to remote database.
    A PL/SQL procedure has been created which sets the v_failures variable = 0 and then performs a check to see if the current job has a failure and if so, inserts that value into the v_failures variable. When that reaches "1", then the procedure does nothing and closes out. If the failures are equal to "0" then it performs a DBMS_MVIEW.REFRESH procedure for each materialized view.
    This worked the first time but its continually failing now with the ORA-01555 error (snapshot too old). From what I can tell, the dbms_job duration is 4 seconds and the Last_Exec is 2m 7s after it starts (8:30 PM). With that said, our DBAs working o nthe project have increased the Undo_Retention settings and assure us that shouldn't be the problem. Odd thing is, this never happened in the dev environment when we were developing/testing - only in the production environment once it got migrated.
    I am looking for possible causes and possible solutions to the ORA-01555 error. A sample of the code in my procedure is below:
    CREATE OR REPLACE PROCEDURE Ar_Mviews IS
    V_FAILURES NUMBER := 0;
    BEGIN
    BEGIN
              SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
              IF V_FAILURES = 1 THEN NULL;
              ELSE
    DBMS_MVIEW.REFRESH ('AR_BATCH_RECEIPTS_V', 'C');
              DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
    END;
    BEGIN
         SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
              IF V_FAILURES = 1 THEN NULL;
              ELSE
    DBMS_MVIEW.REFRESH ('AR_BATCHES_ALL_V', 'C');
              DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
    END;
    END Ar_Mviews;
    ---------------------------------------------------------------------------------------------------------------

    We are doing complete refreshes and doing it that way for consistency in the data presented. Because some materialized views are dependent upon data in other materialized views, we have them ordered in a procedure so that when one finishes, the next starts and they are also in a specific order as to ensure accurate data.
    The condition for v_failures is done so that the job doesn't get, lets say, 90% finished and hit an error and start over again. We do the IF statement which results in NULL (do nothing) so that the job doesn't repeat itself over and over again. If one MV fails, we have to consider the job a failure and do nothing else because the one MV that failed may have been a dependency of another MV down the line. (i.e. MV7 calls MV3 and MV3 fails, so the whole job fails because MV7 can't be accurate without the most current data from MV3).
    As well, this is being performed in off-business hours after backup to tape, etc. and prior to start of business so that no one is using the system when we run this job. That won't always be the case when we move to high availability with this system for varying time-zone end-users.
    I hope I have answered your question and look forward to continued feedback.
    Thanks!

Maybe you are looking for