Error in writing WITH CLAUSE

i am writing these SQL Lines in my stored procedure i am using with clause i am getting error when i perform
inner join
With  WardItemsDtl as ( SELECT WardItemDtl_ID,
WardTransID,
wdDtl.ItemID,
SUM(ItemQty) ItemQty,
ReceivedWardID as WardID
FROM LL_WardItems_Details wdDtl
WHERE isposted = 0
GROUP BY wdDtl.ItemID,WardItemDtl_ID,ReceivedWardID,WardTransID
ORDER BY WardItemDtl_ID )
, PartyItemsDtl AS ( SELECT WardItemDtl_ID,
ItemID,
SUM(IssueItemQty) IssueItemQty
FROM LL_PartyItems_Details
GROUP BY WardItemDtl_ID,ItemID
ORDER BY WardItemDtl_ID )
SELECT wdDt.WardTransID,
wdDt.ItemID,
itmt.ItemCode,
itmt.ItemDescription,
wdDt.ItemQty as TotalItemQty,
NVL(pDtl.IssueItemQty, 0) as IssueQtyToParty,
wdDt.WardID,
wdmt.Ward_Name
from WardItemsDtl wdDt,PartyItemsDtl pDtl
inner join LLItemMst itmt
on itmt.ItemID=wdDt.ItemID -----error in this line
inner join ward_mst wdmt -- error in this line
on wdmt.Ward_ID=wdDt.WardID
error
Error report:
SQL Error: ORA-00904: "WDDT"."ITEMID": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:   
*Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

WITH WARDITEMSDTL AS
  (SELECT WARDITEMDTL_ID,
    WARDTRANSID,
    WDDTL.ITEMID,
    SUM(ITEMQTY) ITEMQTY,
    RECEIVEDWARDID AS WARDID
  FROM LL_WARDITEMS_DETAILS WDDTL
  WHERE ISPOSTED = 0
  GROUP BY WDDTL.ITEMID,
    WARDITEMDTL_ID,
    RECEIVEDWARDID,
    WARDTRANSID
  ORDER BY WARDITEMDTL_ID
  PARTYITEMSDTL AS
  (SELECT WARDITEMDTL_ID,
    ITEMID,
    SUM(ISSUEITEMQTY) ISSUEITEMQTY
  FROM LL_PARTYITEMS_DETAILS
  GROUP BY WARDITEMDTL_ID,
    ITEMID
  ORDER BY WARDITEMDTL_ID
SELECT WDDT.WARDTRANSID,
  WDDT.ITEMID,
  ITMT.ITEMCODE,
  ITMT.ITEMDESCRIPTION,
  WDDT.ITEMQTY              AS TOTALITEMQTY,
  NVL(PDTL.ISSUEITEMQTY, 0) AS ISSUEQTYTOPARTY,
  WDDT.WARDID,
  WDMT.WARD_NAME
FROM WARDITEMSDTL WDDT,
  PARTYITEMSDTL PDTL,
LLITEMMST ITMT,
WARD_MST WDMT     
WHERE ITMT.ITEMID=WDDT.ITEMID
AND  WDMT.WARD_ID=WDDT.WARDID ;AND WHERE YOUR JOIN PARTYITEMSDTL PDTL

Similar Messages

  • Error in writing nested  WITH CLAUSE

    i am writing SQL Query by making use of with Clause i have use nested with clause .....
    means with clause inside a with clause
    but i am getting error
    ERROR
    Error(73,3): PL/SQL: ORA-32034: unsupported use of WITH clause
    create or replace
    PROCEDURE usp_PatientIPDSummary1
    v_fromdate in date,
    v_todate in date
    AS
    begin
    insert INTO GTT_PATIENTIPDSUMMARY
    ( PATIENTNAME, VISITNO, VISITDATE, DISCHARGEDATE, FIRST_NAME, AGE,
    LAST_NAME, REGISTRATION_NO, HOSPITALISEDDAYS,
    CONTACTCOUNTRY, GENDER, ADMDOCTOR,
    INSERTEDON, INSERTEDMACNAME, INSERTEDBYUSERID
    SELECT fn_PatientFullName(Patient.PatientId) AS patientName,
    Visit.VisitNo, VisitDate,
    Visit.DischargeDate as DischargeDate,
    Visit.DischargeType, Patient.First_Name,
    Patient.Age, Patient.Last_Name, Patient.Registration_No,
    CAST(Visit.DischargeDate - Visit.VisitDate AS NUMERIC) AS HOSPITALISEDDAYS,
    Patient.ContactCountry, Patient.Gender, fn_DoctorFullName(Visit.AdmDocID) AS admDoctor,
    TO_CHAR(Visit.InsertedON,'DD-MON-YYYY') as InsertedON,
    Visit.InsertedMacName,
    Visit.InsertedByUserID
    FROM Visit INNER JOIN
    Patient ON Visit.PatientID = Patient.PatientId
    WHERE (Visit.TypeOfVisit = 'ipd')
    and
    TO_CHAR( Visit.VisitDate,'DD-MON-YYYY')
    between TO_CHAR(v_fromdate,'DD-MON-YYYY')
    and TO_CHAR(v_todate,'DD-MON-YYYY')
    WITH
    Q4
    as
    select count(*) as TotalBedount from bed_mst where deactive =0
    select GTT_PATIENTIPDSUMMARY.InsertedON as "Date"
    Q6.PrevTotal,Q4.TotalBedount as TotalBedCount,
    (Q2.visitCOUNT/Q4.TotalBedount)* 100 as "Occupancy%"
    from
    GTT_PATIENTIPDSUMMARY,Q4,Q6;
    end;

    i have use nested with clause ..... means with clause inside a with clauseNo you haven't - at least not in what you've posted.
    I've tried formatting your unformatted code (You do that next time, thanks)
    WITH Q4 as (select count(*) as TotalBedount
                from   bed_mst
                where  deactive =0
                select GTT_PATIENTIPDSUMMARY.InsertedON as "Date"
                       Q6.PrevTotal,
                       Q4.TotalBedount as TotalBedCount,
                       (Q2.visitCOUNT/Q4.TotalBedount)* 100 as "Occupancy%"
                from
                    GTT_PATIENTIPDSUMMARY, Q4, Q6;From this, it is impossible to tell what you are trying to do, Q2 nd Q6 are defined nowehere,
    and syntax is invalid (As you already know).
    Something else, you should read up on DATE datatype. A DATE is a DATE is a DATE. Dateformats are used
    when converting a DATE into a string and vice versa. Usually this is one done when displaying dates (TO_CHAR)
    or when getting dates from file- or user input (TO_DATE).
    So, this is probably wrong, my guess is that you are (hopefully) inserting into a DATE column:
           TO_CHAR ( visit.insertedon, 'DD-MON-YYYY') AS insertedon,This is definitely wrong, and will give corect result only for some special date intervals:
           AND TO_CHAR ( visit.visitdate, 'DD-MON-YYYY') BETWEEN TO_CHAR ( v_fromdate, 'DD-MON-YYYY')
                                                             AND TO_CHAR ( v_todate, 'DD-MON-YYYY')This is probably wrong, too. DATE - DATE gives NUMBER, and I'm not sure why you would cast
    it into the PL/SQL datatype, NUMERIC.
           CAST (visit.dischargedate - visit.visitdate AS NUMERIC)     Handle:      user21354
    Status Level:      Newbie
    Registered:      Jan 24, 2011
    Total Posts:      179
    Total Questions:      94 *(77 unresolved)*
    You should be more serious about asking questions in a public forum.
    179 posts in three months, and you have still not read the forum FAQ.
    Maybe that is why you get so few questions answered. Or are you just too lazy to follow up on them, marking them as answered?

  • 'Missing select' error for update statement using WITH clause

    Hi,
    I am getting the below error for update statement using WITH clause
    SQL Error: ORA-00928: missing SELECT keyword
      UPDATE A
      set A.col1 = 'val1'
         where
      A.col2 IN (
      WITH D AS
      SELECT col2 FROM
      (SELECT col2, MIN(datecol) col3 FROM DS
      WHERE <conditions>
        GROUP BY PATIENT) D2
      WHERE
      <conditions on A.col4 and D2.col3>

    Hi,
    The format of a query using WITH is:
    WITH  d  AS
        SELECT  ...  -- sub_query
    SELECT  ...   -- main query
    You don't have a main query.  The keyword FROM has to come immediately after the right ')' that ends the last WITH clause sub-query.
    That explains the problem based on what you posted.  I can't tell if the real problem is in the conditions that you didn't post.
    I hope this answers your question.
    If not, post a complete test script that people can run to re-create the problem and test their ideas.  Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Issue in use of "WITH CLAUSE"

    My DB version is 10.2.0
    One of my query takes long time for execution and here is the Old Query,
    SELECT HD.DATUM DATUM, HA2.GELDEINGAENGE_INSG-NVL(HA3.VERWERTUNGSERLOESE,0)
      GELDEINGANG, HA3.VERWERTUNGSERLOESE
    FROM
    ( SELECT DISTINCT(TO_CHAR(ERFASSDATUM,'YYYY/MM')) DATUM
      FROM TRANS_HIST H1 ,
        (SELECT BUCHUNGSGRUPPE, LFDNR, SICHERHEITBEZUG
        FROM BUCHUNGSSCHL
        WHERE STORNOMM=0) B1
      WHERE H1.ERFASSDATUM >=TO_DATE('01.10'||TO_CHAR(ADD_MONTHS(SYSDATE,-9),'YYYY')||' 00.00.00','DD.MM.YYYY HH24:MI:SS')
      AND H1.BUCHUNGSGRUPPE = B1.BUCHUNGSGRUPPE AND H1.LFDNR = B1.LFDNR
      AND (H1.BUCHUNGSGRUPPE = '8888' OR ( H1.BUCHUNGSGRUPPE > 5999 AND H1.BUCHUNGSGRUPPE < 7100 AND B1.SICHERHEITBEZUG = 1)) ) HD,
      (SELECT TO_CHAR(ERFASSDATUM,'YYYY/MM') DATUM, SUM(BETRAG) GELDEINGAENGE_INSG
      FROM TRANS_HIST H2,
      (SELECT F.GLAEUBIGERNR,F.FORDNR,F.FORDERGNR,A.MAHN_NUM
      FROM FRD_ACCT F,
      (SELECT * FROM ANS_PRCH WHERE RANGMM=1) A
      WHERE F.GLAEUBIGERNR=A.GLAEUBIGERNR (+) AND F.FORDNR=A.FORDNR(+)
      AND F.FORDERGNR=A.FORDERGNR(+) AND NVL(F.INDIVIDUALFLAG,0)=0 ) F1
      WHERE ( (F1.GLAEUBIGERNR= H2.GLAEUBIGERNR AND F1.FORDNR=H2.FORDNR AND F1.FORDERGNR=H2.FORDERGNR) OR
      F1.MAHN_NUM = H2.MAHN_NUM) AND H2.BUCHUNGSGRUPPE = '8888' AND
      H2.ERFASSDATUM >= TO_DATE('01.10'||TO_CHAR(ADD_MONTHS(SYSDATE,-9),'YYYY')||' 00.00.00','DD.MM.YYYY HH24:MI:SS')
      GROUP BY TO_CHAR(ERFASSDATUM,'YYYY/MM') ) HA2,
      (SELECT TO_CHAR(ERFASSDATUM,'YYYY/MM') DATUM, SUM(BETRAG) VERWERTUNGSERLOESE
       FROM TRANS_HIST H3, (SELECT BUCHUNGSGRUPPE, LFDNR,
      SICHERHEITBEZUG, NACHMIETVERTRAGE
      FROM BUCHUNGSSCHL
      WHERE STORNOMM=0) B3,
      (SELECT F.GLAEUBIGERNR,F.FORDNR,F.FORDERGNR,A.MAHN_NUM
      FROM FRD_ACCT F,
      (SELECT * FROM ANS_PRCH WHERE RANGMM=1) A
      WHERE F.GLAEUBIGERNR= A.GLAEUBIGERNR (+) AND F.FORDNR=A.FORDNR(+)
      AND F.FORDERGNR=A.FORDERGNR(+) AND NVL(F.INDIVIDUALFLAG,0)=0 ) F2
      WHERE ( (F2.GLAEUBIGERNR=H3.GLAEUBIGERNR AND F2.FORDNR=H3.FORDNR AND F2.FORDERGNR=H3.FORDERGNR)
      OR F2.MAHN_NUM = H3.MAHN_NUM)
      AND H3.ERFASSDATUM >=TO_DATE('01.10'||TO_CHAR(ADD_MONTHS(SYSDATE,-9),'YYYY')||' 00.00.00','DD.MM.YYYY HH24:MI:SS')
      AND H3.BUCHUNGSGRUPPE = B3.BUCHUNGSGRUPPE AND
      H3.LFDNR = B3.LFDNR AND H3.BUCHUNGSGRUPPE > 5999
      AND H3.BUCHUNGSGRUPPE < 7100 AND (B3.SICHERHEITBEZUG = 1 OR B3.NACHMIETVERTRAGE =1)
      GROUP BY TO_CHAR(ERFASSDATUM,'YYYY/MM') ) HA3
      WHERE HD.DATUM=HA2.DATUM (+)
      AND HD.DATUM=HA3.DATUM (+)
      ORDER BY DATUM ASC
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.22       0.22          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1    469.61    1448.30    2874498    3017355          1           9
    total        3    469.83    1448.53    2874498    3017355          1           9
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 62     (recursive depth: 1)
    Rows     Row Source Operation
          9  SORT ORDER BY (cr=3017355 pr=2874498 pw=0 time=1448309418 us)
          9   HASH JOIN RIGHT OUTER (cr=3017355 pr=2874498 pw=0 time=1448309191 us)
          9    VIEW  (cr=1228085 pr=1175604 pw=0 time=906871801 us)
          9     HASH GROUP BY (cr=1228085 pr=1175604 pw=0 time=906871785 us)
       1559      CONCATENATION  (cr=1228085 pr=1175604 pw=0 time=564453620 us)
        233       HASH JOIN  (cr=614043 pr=589377 pw=0 time=562088377 us)
         94        TABLE ACCESS FULL BUCHUNGSSCHL (cr=29 pr=0 pw=0 time=505 us)
    254136        HASH JOIN  (cr=614014 pr=589377 pw=0 time=509476999 us)
    497464         TABLE ACCESS FULL TRANS_HIST (cr=586339 pr=562603 pw=0 time=65783878 us)
    737515         HASH JOIN RIGHT OUTER (cr=27675 pr=26774 pw=0 time=18577731 us)
    372656          TABLE ACCESS FULL ANS_PRCH (cr=6346 pr=5910 pw=0 time=408778 us)
    737515          TABLE ACCESS FULL FRD_ACCT (cr=21329 pr=20864 pw=0 time=2254657 us)
       1326       HASH JOIN  (cr=614042 pr=586227 pw=0 time=520726941 us)
         94        TABLE ACCESS FULL BUCHUNGSSCHL (cr=29 pr=0 pw=0 time=641 us)
    221360        FILTER  (cr=614013 pr=586227 pw=0 time=372791872 us)
    221360         HASH JOIN OUTER (cr=614013 pr=586227 pw=0 time=372570499 us)
    221360          HASH JOIN  (cr=607668 pr=580286 pw=0 time=368077766 us)
    243053           TABLE ACCESS FULL TRANS_HIST (cr=586339 pr=563978 pw=0 time=1425434011 us)
    737515           TABLE ACCESS FULL FRD_ACCT (cr=21329 pr=16308 pw=0 time=8859226 us)
    372656          TABLE ACCESS FULL ANS_PRCH (cr=6345 pr=5941 pw=0 time=1872464 us)
          9    HASH JOIN OUTER (cr=1789270 pr=1698894 pw=0 time=541436637 us)
          9     VIEW  (cr=586667 pr=562439 pw=0 time=213337882 us)
          9      HASH UNIQUE (cr=586667 pr=562439 pw=0 time=213337873 us)
    748717       HASH JOIN  (cr=586667 pr=562439 pw=0 time=104432018 us)
        830        TABLE ACCESS FULL BUCHUNGSSCHL (cr=29 pr=0 pw=0 time=1042 us)
    1241936        TABLE ACCESS FULL TRANS_HIST (cr=586638 pr=562439 pw=0 time=339666777 us)
          9     VIEW  (cr=1202603 pr=1136455 pw=0 time=328097826 us)
          9      HASH GROUP BY (cr=1202603 pr=1136455 pw=0 time=328097809 us)
    695373       CONCATENATION  (cr=1202603 pr=1136455 pw=0 time=324453471 us)
          0        HASH JOIN  (cr=587003 pr=557994 pw=0 time=167168982 us)
    744472         TABLE ACCESS FULL TRANS_HIST (cr=587003 pr=557994 pw=0 time=30622271 us)
          0         HASH JOIN RIGHT OUTER (cr=0 pr=0 pw=0 time=0 us)
          0          TABLE ACCESS FULL ANS_PRCH (cr=0 pr=0 pw=0 time=0 us)
          0          TABLE ACCESS FULL FRD_ACCT (cr=0 pr=0 pw=0 time=0 us)
    695373        FILTER  (cr=615600 pr=578461 pw=0 time=157284464 us)
    695373         HASH JOIN OUTER (cr=615600 pr=578461 pw=0 time=156589072 us)
    695373          HASH JOIN  (cr=609255 pr=572518 pw=0 time=150571393 us)
    744472           TABLE ACCESS FULL TRANS_HIST (cr=587926 pr=556115 pw=0 time=31820718 us)
    737515           TABLE ACCESS FULL FRD_ACCT (cr=21329 pr=16403 pw=0 time=3696334 us)
    372656          TABLE ACCESS FULL ANS_PRCH (cr=6345 pr=5943 pw=0 time=391928 us)I tried fine tuning the query using "With Clause" but landed up with oracle error, which prevents me from using with clause inside a paranthesis.
    SELECT HD.DATUM DATUM, HA2.GELDEINGAENGE_INSG-NVL(HA3.VERWERTUNGSERLOESE,0)
      GELDEINGANG, HA3.VERWERTUNGSERLOESE
    FROM
    ( WITH HIST_VIEW AS (SELECT GLAEUBIGERNR,FORDNR,FORDERGNR,MAHN_NUM,BUCHUNGSGRUPPE,LFDNR,STORNOMM,ERFASSDATUM,BETRAG
                         FROM TRANS_HIST H
                         WHERE ERFASSDATUM >=TO_DATE('01.10'||TO_CHAR(ADD_MONTHS(SYSDATE,-9),'YYYY')||' 00.00.00','DD.MM.YYYY HH24:MI:SS')
                         AND  (H.BUCHUNGSGRUPPE = '8888' OR ( H.BUCHUNGSGRUPPE > 5999 AND H.BUCHUNGSGRUPPE < 7100))),
           FORD_VIEW AS (SELECT F.GLAEUBIGERNR,F.FORDNR,F.FORDERGNR,A.MAHN_NUM
                         FROM FRD_ACCT F,ANS_PRCH A
                         WHERE F.GLAEUBIGERNR=A.GLAEUBIGERNR(+) AND F.FORDNR=A.FORDNR(+)
                         AND F.FORDERGNR=A.FORDERGNR(+) AND NVL(F.INDIVIDUALFLAG,0)=0 AND  A.RANGMM=1)
    (SELECT DISTINCT(TO_CHAR(ERFASSDATUM,'YYYY/MM')) DATUM
      FROM HIST_VIEW H1 ,BUCHUNGSSCHL B1
      WHERE B1.STORNOMM=0  AND H1.BUCHUNGSGRUPPE = B1.BUCHUNGSGRUPPE AND H1.LFDNR = B1.LFDNR
      AND (H1.BUCHUNGSGRUPPE = '8888' OR (H1.BUCHUNGSGRUPPE > 5999 AND H1.BUCHUNGSGRUPPE < 7100 AND B1.SICHERHEITBEZUG = 1))) HD,
    (SELECT TO_CHAR(ERFASSDATUM,'YYYY/MM') DATUM, SUM(BETRAG) GELDEINGAENGE_INSG
      FROM HIST_VIEW H2,FORD_VIEW F1
      WHERE ((F1.GLAEUBIGERNR= H2.GLAEUBIGERNR AND F1.FORDNR=H2.FORDNR AND F1.FORDERGNR=H2.FORDERGNR) OR
      F1.MAHN_NUM = H2.MAHN_NUM) AND H2.BUCHUNGSGRUPPE = '8888'
      GROUP BY TO_CHAR(ERFASSDATUM,'YYYY/MM') ) HA2,
    (SELECT TO_CHAR(ERFASSDATUM,'YYYY/MM') DATUM, SUM(BETRAG) VERWERTUNGSERLOESE
      FROM HIST_VIEW H3, BUCHUNGSSCHL B3,FORD_VIEW F2
      WHERE ((F2.GLAEUBIGERNR=H3.GLAEUBIGERNR AND F2.FORDNR=H3.FORDNR
      AND F2.FORDERGNR=H3.FORDERGNR) OR F2.MAHN_NUM = H3.MAHN_NUM) AND B3.STORNOMM=0
      AND H3.BUCHUNGSGRUPPE = B3.BUCHUNGSGRUPPE AND
      H3.LFDNR = B3.LFDNR AND H3.BUCHUNGSGRUPPE > 5999
      AND H3.BUCHUNGSGRUPPE < 7100 AND (B3.SICHERHEITBEZUG = 1 OR B3.NACHMIETVERTRAGE =1)
      GROUP BY TO_CHAR(ERFASSDATUM,'YYYY/MM')) HA3
      WHERE HD.DATUM=HA2.DATUM (+)
      AND HD.DATUM=HA3.DATUM (+)
      ORDER BY DATUM ASC )
    ORA-00907: missing right parenthesis

    If you format your code it makes it far easier to spot mistakes...
    WITH HIST_VIEW AS (SELECT GLAEUBIGERNR,FORDNR,FORDERGNR,MAHN_NUM,BUCHUNGSGRUPPE,LFDNR,STORNOMM,ERFASSDATUM,BETRAG
                       FROM   TRANS_HIST H
                       WHERE  ERFASSDATUM >=TO_DATE('01.10'||TO_CHAR(ADD_MONTHS(SYSDATE,-9),'YYYY')||' 00.00.00','DD.MM.YYYY HH24:MI:SS')
                       AND   (  H.BUCHUNGSGRUPPE = '8888'
                            OR (H.BUCHUNGSGRUPPE > 5999 AND H.BUCHUNGSGRUPPE < 7100)
         FORD_VIEW AS (SELECT F.GLAEUBIGERNR,F.FORDNR,F.FORDERGNR,A.MAHN_NUM
                       FROM   FRD_ACCT F,ANS_PRCH A
                       WHERE  F.GLAEUBIGERNR=A.GLAEUBIGERNR(+)
                       AND    F.FORDNR=A.FORDNR(+)
                       AND    F.FORDERGNR=A.FORDERGNR(+)
                       AND    NVL(F.INDIVIDUALFLAG,0)=0
                       AND    A.RANGMM=1
    SELECT HD.DATUM DATUM
          ,HA2.GELDEINGAENGE_INSG-NVL(HA3.VERWERTUNGSERLOESE,0) GELDEINGANG
          ,HA3.VERWERTUNGSERLOESE
    FROM  (SELECT DISTINCT(TO_CHAR(ERFASSDATUM,'YYYY/MM')) DATUM
           FROM   HIST_VIEW H1
                 ,BUCHUNGSSCHL B1
           WHERE  B1.STORNOMM=0
           AND    H1.BUCHUNGSGRUPPE = B1.BUCHUNGSGRUPPE
           AND    H1.LFDNR = B1.LFDNR
           AND   (  H1.BUCHUNGSGRUPPE = '8888'
                OR (H1.BUCHUNGSGRUPPE > 5999 AND H1.BUCHUNGSGRUPPE < 7100 AND B1.SICHERHEITBEZUG = 1)
          ) HD,
          (SELECT TO_CHAR(ERFASSDATUM,'YYYY/MM') DATUM
                 ,SUM(BETRAG) GELDEINGAENGE_INSG
           FROM   HIST_VIEW H2
                 ,FORD_VIEW F1
           WHERE (
                   (    F1.GLAEUBIGERNR= H2.GLAEUBIGERNR
                    AND F1.FORDNR=H2.FORDNR
                    AND F1.FORDERGNR=H2.FORDERGNR
                 OR
                    F1.MAHN_NUM = H2.MAHN_NUM
           AND   H2.BUCHUNGSGRUPPE = '8888'
           GROUP BY TO_CHAR(ERFASSDATUM,'YYYY/MM')
          ) HA2,
          (SELECT TO_CHAR(ERFASSDATUM,'YYYY/MM') DATUM
                 ,SUM(BETRAG) VERWERTUNGSERLOESE
           FROM   HIST_VIEW H3
                 ,BUCHUNGSSCHL B3
                 ,FORD_VIEW F2
           WHERE (
                   (    F2.GLAEUBIGERNR=H3.GLAEUBIGERNR
                    AND F2.FORDNR=H3.FORDNR
                    AND F2.FORDERGNR=H3.FORDERGNR
                 OR
                   F2.MAHN_NUM = H3.MAHN_NUM
           AND B3.STORNOMM=0
           AND H3.BUCHUNGSGRUPPE = B3.BUCHUNGSGRUPPE
           AND H3.LFDNR = B3.LFDNR
           AND H3.BUCHUNGSGRUPPE > 5999
           AND H3.BUCHUNGSGRUPPE < 7100
           AND (B3.SICHERHEITBEZUG = 1 OR B3.NACHMIETVERTRAGE =1)
           GROUP BY TO_CHAR(ERFASSDATUM,'YYYY/MM')
          ) HA3
    WHERE HD.DATUM=HA2.DATUM (+)
    AND   HD.DATUM=HA3.DATUM (+)
    ORDER BY DATUM ASC
    ) <--- What's this doing on the end?Remove that last bracket and you should be ok.
    I took the liberty of putting the subquery factoring at the beginning, so see if that works.

  • OPEN CURSOR using a WITH clause in the select query

    Hi,
    I am using Oracle 9i. I have a requirement where I have a REFCURSOR as an OUT parameter for my procedure. I have declared the TYPE and created the procedure.
    In the procedure, I am using OPEN <cursor_name> FOR <query>;
    Ideally this works in most of the cases that I have tried earlier. However, in the current case I am using a WITH clause in my query to get the results.
    I need help in understanding if the above mentioned syntax would not allow me to use the WITH clause in the query.

    What error do you get , seems to work ok for me on 10g
    SQL> begin
      2  open :cv for 'with x as (select * from emp)  select * from x';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> print :cv
         EMPNO
    ENAME
    JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7521
    WARD
    SALESMAN        7698 22-FEB-81       1250        500         30
          7566
    JONES
    MANAGER         7839 02-APR-81       2975                    20
         EMPNO

  • Adobe Media Encoder (Error compiling movie) Unknown error when writing to Isilon OneFS 6.5.5.18

    Adobe Media Encoder (Error compiling movie) Unknown error when writing to Isilon OneFS 6.5.5.18 while using Adobe Premiere Pro.
    Process:         Adobe Premiere Pro CC 2014
    Path: /Applications/Adobe Premiere Pro CC 2014/Adobe Premiere Pro CC 2014.app/Contents/MacOS/Adobe Premiere Pro CC 2014
    Identifier: com.adobe.AdobePremierePro
    Version:         8.1.0 (8.1.0)
    Code Type: X86-64 (Native)
    Parent Process: launchd [2538]
    Responsible:     Adobe Premiere Pro CC 2014
    Date/Time: 2015-01-06 14:04:23.500 -0700
    OS Version:      Mac OS X 10.9.2 (13C64)
    Report Version:  11
    Crashed Thread: 55  Dispatch queue: com.apple.root.default-priority
    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
    Customer created test export with 777 permissions and set mount parameters to the following:
    mount_nfs -o vers=3,tcp,rdirplus,intr,nolocks,async,rsize=32768,wsize=32768
      -- Original mount options:
         General mount flags: 0x40 async
         NFS parameters: vers=3,tcp,nolocks,rsize=32768,wsize=32768,rdirplus
      -- Current mount parameters:
         General mount flags: 0x4000058 async,nodev,nosuid multilabel
         NFS parameters: vers=3,tcp,port=2049,nomntudp,hard,nointr,noresvport,negnamecache,callumnt,nolocks,quota, rsize=32768,wsize=32768,readahead=16,dsize=32768,rdirplus,nodumbtimr,timeo=10,maxgroups=16 ,acregmin=5,acregmax=60,acdirmin=5,acdirmax=60,nomutejukebox,nonfc,sec=sys
    The pcap shows once the movie is created a lockup call is responded from Isilon with Error: NFS3ERR_NOENT
    478         V3 CREATE Call (Reply In 479), DH: 0xea5f731c/QBRSN-0-0-1.mov Mode: UNCHECKED
    479         V3 CREATE Reply (Call In 478)
    484         V3 LOOKUP Call (Reply In 485), DH: 0xea5f731c/._QBRSN-0-0-1.mov
    485        V3 LOOKUP Reply (Call In 484) Error: NFS3ERR_NOENT
    V3 LOOKUP Reply (Call In ....) Error: NFS3ERR_NOENT  -   This is by design of OneFS, we coalesce files and then flush them out to disk which is why the commit time is accurate but the file is not immediately available. however when an async option is used within the mount options this should be avoided if writing asynchronously to the cluster.  Has anyone else seen this behavior lately? (current workaround is to store locally and transfer to the cluster via Finder)

    That error can happen for many reasons...one of the reasons that I occassionaly get it is because I try exporting a movie to an external drive that has been formated in the old FAT32 instead of the NTSF standard.  FAT32 only allows for file sizes up to 2 gigs.  And as soon as it reaches that...I would get that error.  I don't know if that is why you are getting that error...but it would be easy to check.  1) are you generating a file that is over 2 gigs?  2) is your drive that you are exporting to FAT 32 (just right click the drive in My Computer and select "properties" then just look for what it says next to "file system".

  • Error reading/writing file "com.garageband.cs":`≤Ć». message

    Hey all! Don't know if anyone can help but I keep getting the message...
    " Error reading/writing file "com.garageband.cs":`≤Ć». " with a cancel button.
    If you click on it it does go away, but after a time playback starts skipping and stuff.
    Anyone help please?
    Thanks
    Righini

    first two things to try for “oddball” probs:
    http://www.bulletsandbones.com/GB/GBFAQ.html#oddballprobs
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • Error reading/writing file message when opening garageband and/or files

    I've been recently getting this message when I open garageband and files
    "Error reading/writing file\U201Ccom.apple.garageband.cs\U201D
    I've been in and repaired disk permissions and all that it says it is all fine, reinstall garageband and message still comes up, weird.
    not only is garageband being a nuisance, Mac OS X 10.6.2 is being a pain when shutting down telling me to restart the computer. This only happened since upgrading to 10.6. No one as yet knows this promble so I'm gonna have to ring apple and see what is going on here.
    and also my other problem is that mac doesn't seem as snappy anymore I noticed this before upgrading to 10.6 and made no difference when "cleanly" installing 10.6. I get a colour wheel popping up and i'm having to wait with simple tasks. iMac only 2 years old.

    i give up with this discussion forum no no one knows anything

  • Need help with INSERT and WITH clause

    I wrote sql statement which correctly work, but how i use this statment with INSERT query? NEED HELP. when i wrote insert i see error "ORA 32034: unsupported use of with clause"
    with t1 as(
    select a.budat,a.monat as period,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    c.wrbtr,
    c.matnr,
    c.menge,
    a.monat,
    c.zuonr
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='D'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,t2 as(
    select a.BUKRS,a.BELNR, a.GJAHR,t1.vtweg,t1.budat,t1.monat from t1, ldw_v1.bkpf a
    where t1.zuonr=a.xblnr and a.blart='WL' and bukrs='8431'
    ,tcogs as (
    select t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    sum(bseg.wrbtr) as COGS,bseg.matnr,bseg.kunnr,sum(bseg.menge) as QUANTITY
    from t2, ldw_v1.bseg
    where t2.bukrs=bseg.bukrs and t2.belnr=bseg.BELNR and t2.gjahr=bseg.gjahr and BSEG.KOART='S'
    group by t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    bseg.matnr,bseg.kunnr
    ,t3 as
    select a.budat,a.monat,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    case when c.shkzg='S' then c.wrbtr*(-1)
    else c.wrbtr end as NTS,
    c.matnr,c.kunnr,
    c.menge*(-1) as Quantity
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='S'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,trevenue as (
    select t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,
    sum(t3.NTS) as NTS,t3.matnr,t3.kunnr,sum(t3.QUANTITY) as QUANTITY
    from t3
    group by t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,t3.matnr,t3.kunnr
    select NVL(tr.budat,tc.budat) as budat,
    NVL(tr.monat,tc.monat) as monat,
    NVL(tr.vtweg,tc.vtweg) as vtweg,
    NVL(tr.gjahr, tc.gjahr) as gjahr,
    tr.hkont as NTS_hkont,
    tc.hkont as COGS_hkont,
    NVL(tr.prctr,tc.prctr) as prctr,
    NVL(tr.MATNR, tc.MATNR) as matnr,
    NVL(tr.kunnr, tc.kunnr) as kunnr,
    NVL(tr.Quantity, tc.Quantity) as Quantity,
    tr.NTS as NTS,
    tc.COGS as COGS
    from trevenue TR full outer join tcogs TC
    on TR.BUDAT=TC.BUDAT and TR.MONAT=TC.MONAT and TR.GJAHR=TC.GJAHR
    and TR.MATNR=TC.MATNR and TR.KUNNR=TC.KUNNR and TR.QUANTITY=TC.QUANTITY
    and TR.VTWEG=TC.VTWEG and TR.PRCTR=TC.PRCTR
    Edited by: user13566113 on 25.03.2011 5:26

    Without seeing what you tried it is hard to say what you did wrong, but this is how it would work
    SQL> create table t ( n number );
    Table created.
    SQL> insert into t
      2  with test_data as
      3    (select 1 x from dual union all
      4     select 2 x from dual union all
      5     select 3 x from dual union all
      6     select 4 x from dual)
      7  select x from test_data;
    4 rows created.
    SQL>

  • Error in Writing to File \Winnt\System32\mfcans32.dll

    Error window with msg "Error in Writing to File \Winnt\System32\mfcans32.dll" is being popuped while trying to install 9.0.3 on windows 2000 Advanced Server.
    My System Configuration Details are as follows.
    Compaq Proliant
    Ram : 2GB
    HARD DISK : 80GB
    PROCESSOR : 2.6
    Please help me to install.
    Thanks,
    Srinivas Chowdhary Annamareddy.

    You might want to investigate why it became Read-Only in the first place and are there any other files that should not be Read-Only read only.

  • Error in writing to directory /u01/tmp  in SUSE 10

    Hi all,
    I am trying to install patch for oracle 9.2.0.6,
    right now DB version is Oracle 9.2.0.4
    but when i try to install i am gettng an error
    oracle@icai-oracle:/bkp/patch/Disk1> ./runInstaller -ignoreSysPrereqs
    Starting Oracle Universal Installer...
    Checking installer requirements...
    Checking operating system version: must be SuSE-7, redhat-2.1AS, redhat-2.1, UnitedLinux-1.0, redhat-3 or SuSE-8
                                          Passed
    All installer requirements met.
    Checking Temp space: must be greater than 80 MB.   Actual 10577 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 10244MB    Passed
    Checking monitor: must be configured to display at least 256 colors    Failed <<<<
        >>> Could not execute auto check for display colors using command /usr/X11R6/bin/xdpyinfo. Check if the DISPLAY variable is set.
    Ignoring optional pre-requisite failures. Continuing...
    Preparing to launch Oracle Universal Installer from /u01/tmp/OraInstall2009-07-20_11-31-12AM. Please wait ...
    Error in writing to directory /u01/tmp/OraInstall2009-07-20_11-31-12AM. Please ensure that this directory is writable and has atleast 60 MB of disk space. Installation cannot continue.
    : SuccessI have performed all the steps
    Earlier OUI was using /tmp dir and the permission for /tmp is 777
    and persmission for /u01/tmp/ is also set 777.
    but still i am getting error.....
    pls suggest me how to resolve it...

    user00726 wrote:
    Hi all,
    I am trying to install patch for oracle 9.2.0.6,
    right now DB version is Oracle 9.2.0.4
    but when i try to install i am gettng an error
    oracle@icai-oracle:/bkp/patch/Disk1> ./runInstaller -ignoreSysPrereqs
    Starting Oracle Universal Installer...
    Checking installer requirements...
    Checking operating system version: must be SuSE-7, redhat-2.1AS, redhat-2.1, UnitedLinux-1.0, redhat-3 or SuSE-8
    Passed
    All installer requirements met.
    Checking Temp space: must be greater than 80 MB.   Actual 10577 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 10244MB    Passed
    Checking monitor: must be configured to display at least 256 colors    Failed <<<<
    Could not execute auto check for display colors using command /usr/X11R6/bin/xdpyinfo. Check if the DISPLAY variable is set.
    Ignoring optional pre-requisite failures. Continuing...
    Preparing to launch Oracle Universal Installer from /u01/tmp/OraInstall2009-07-20_11-31-12AM. Please wait ...
    Error in writing to directory /u01/tmp/OraInstall2009-07-20_11-31-12AM. Please ensure that this directory is writable and has atleast 60 MB of disk space. Installation cannot continue.
    : SuccessI have performed all the steps
    Earlier OUI was using /tmp dir and the permission for /tmp is 777
    and persmission for /u01/tmp/ is also set 777.
    but still i am getting error.....
    pls suggest me how to resolve it...What about the rest of the same error message .. "and has atleast 60 MB of disk space.".
    It appears you also have a problem with your DISPLAY variable, that would prevent the GUI portion of OUI from starting ...

  • Error in writing to directory /tmp/OraInstall2009-09-18_09-03-18AM. Please

    Hi all,
    oracle Unbrekable linux 32 bit
    oracle 10.2.0.1
    i got this error while installing oracle universal installer
    [vishal@localhost database]$ ./runInstaller
    Starting Oracle Universal Installer...
    Checking installer requirements...
    Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
    Passed
    All installer requirements met.
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-09-18_09-03-18AM. Please wait ...sh: /home/vishal/Desktop/database/install/unzip: Permission denied
    Error in writing to directory /tmp/OraInstall2009-09-18_09-03-18AM. Please ensure that this directory is writable and has atleast 60 MB of disk space. Installation cannot continue.
    : Success

    Hi,
    you try following steps:--
    (1) create oracle user with oinstall and dba group.
    (2) chown -R oracle:oinstall /install directory(like /diask1/app/oaradata/1020).
    (3)chmod 775 /disk1/app/oradata/1020.
    (4)chown -R oracle:dba /disk1/app/oradata/1020.
    (5)chmod 775 /disk1/app/oradata/1020
    (6) watch carefully the oracle check at the time of initial install.
    If anything is failed due to gcc packeage or because of some other reason then you have to rectify first.
    you also need to configure /etc/sysctl.conf for kernel parameter in which you have to define shmmax size half of the ram.
    you also need to run xhost + from root and then start installation once u r done with the configuration.
    Regards,
    MK

  • Error in writing to directory /tmp/OraInstall2005...

    ./runInstaller
    Starting Oracle Universal Installer...
    Checking installer requirements...
    Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
    Passed
    All installer requirements met.
    Checking Temp space: must be greater than 80 MB. Actual 12195 MB Passed
    Checking swap space: must be greater than 150 MB. Actual 3072 MB Passed
    Checking monitor: must be configured to display at least 256 colors Passed
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2005-07-26_03-48-00PM. Please wait ...
    Error in writing to directory /tmp/OraInstall2005-07-26_03-48-00PM. Please ensure that this directory is writable and has atleast 60 MB of disk space. Installation cannot continue.
    : Success

    Please can help with this problem
    [oracle@server1 oracle]$ /home/as/Disk1/install/runInstaller Starting Oracle Universal Installer...
    Checking installer requirements...
    All installer requirements met.
    Checking Temp space: must be greater than 400 MB. Actual 133573 MB Passed
    Checking swap space: must be greater than 1536 MB. Actual 1990MB Passed
    Checking monitor: must be configured to display at least 256 colors Failed <<<<
    >>> Could not execute auto check for display colors using command /usr/X11R6/bin/xdpyinfo. Check if the DISPLAY variable is set.
    Checking if CPU speed is above 450 MHz. Actual 2793 MHz Passed
    Some optional pre-requisite checks have failed (see above). Continue? (y/n) [n]
    Continue? (y/n) [n] y
    Preparing to launch Oracle Universal Installer from /oratmp/OraInstall2005-12-08_06-51-02PM. Please wait ...
    Error in writing to directory /oratmp/OraInstall2005-12-08_06-51-02PM. Please ensure that this directory is writable and has atleast 60 MB of disk space. Installation cannot continue.
    : Success
    regards
    Abby

  • Error in writing to file - Oracle

    Dear All,
    We have to upgrade Oracle from 10.2.0.2 to 11.2.0.2. For this we are applying patches till 10.2.0.4. OS is AIX 6.1.
    Before proceeding I have stopped SAP, DB, Listerner and emctl also.
    But after starting the patches we found the msg that, Error in writing to file 'oracle/SID/102_64/jdk/bin/libdbgmalloc.a'.
    [/oracle/SID/102_64/jdk/jre/bin/libdbgmalloc.a(Cannot open or remove a file containing a running program.)]
    Click 'Help' for more information.
    Click 'Retry' to try again.
    Click 'Ignore' to ignore this error and go on.
    Click 'Cancel' to stop installation.
    We are in the middle of installation where deinstallation has already passed. Please help us in fixing this issue. We tried ps -ef | grep libdbgmalloc.a to check the running status but didnt find that.
    Thanks,
    Rableen

    Hi Rableen,
    You can go ahead with the solution provided above. There would be no impact on system as we have done the same on our whole landscape and did not encounter any issue after multiple round of testings.
    This happens because semaphore which uses jdk library files at OS level. You would not be able to locate any process related to that.
    Once you rename libzip.a to libzip.a_old and click on retry, another file libzip.a of newer timestamp will be put by upgrade tool.
    hostname:orasid 7> ls -rtl|grep libzip.a
    -rwxr-xr-x    1 orasid   dba          109588 20 Aug 2005  libzip.a_old
    -rwxr-xr-x    1 orasid   dba          109803 21 Apr 2008  libzip.a
    hostname:orasid 7> pwd
    /oracle/SID/102_64/jdk/jre/bin
    hostname:orasid 7>
    Nothing to worry after renaming as upgrade tool will put a new file of new date at the same place.
    Also as you are going to upgrade 11G, directory 102_64 will not be used at all after 11G upgrade. A new directory structure will be created as /oracle/SID/11202.
    Cheers !!!
    Ashish

  • Error in writing to file '$ORACLE_HOME/jdk/jre/bin/java'

    Hi,
    I have installed Forms & Reports Services Standalone (10.1.2.0.2) on RHEL 5 and now I am applying the Oracle Application Server 10g Release 2, Patch Set 3 (10.1.2.3), but OUI gives the following error:
    Error in writing to file '$ORACLE_HOME/jdk/jre/bin/java'.
    [$ORACLE_HOME/jdk/jre/bin/java
    (Text file busy)]
    I can't seem to find anything about this error on metalink or via google. Can anyone help me solve this? Thanks.

    Ok, this time I stopped all processes first with opmnctl stopall and emctl stop iasconsole. I then started OUI again to install the patch. It seemed to go fine - i didnt get that java error this time, but another error almost at the end of the installation:
    Error in invoking target 'proxy_install runm_install server_install cgi_install
    cli_install conv_install qv_install' of makefile
    '/opt/oracle/Forms10gR2/reports/lib/ins_reports.mk'
    According to Metalink ID 564174.1 - "Any installation of Oracle Application Server 10g Release 2 (10.1.2.0.2) on OEL 5.x or RHEL 5.x in which Reports is getting installed will fail with reports relinking errors" and the solution is as follows:
    # rpm -i xorg-x11-libs-compat-6.8.2-1.EL.33.0.1.i386.rpm
    # mv /usr/lib/libXtst.so.6 /usr/lib/libXtst.so.6.ORG
    # ln -s /usr/X11R6/lib/libXtst.so.6 /usr/lib/libXtst.so.6
    I have already done these 3 steps before the base installation (just to avoid this error), yet I am getting this error even when the symbolic link already exists. Do you think I can just ignore this error and continue with the installation, or is there something else I need to check first?

Maybe you are looking for