Using WITH clause in Pro*Cobol

Hi!
I am trying to improve the performance of a query by introducing WITH clause.
The query is in Pro*Cobol Release 9.2.0.6.0 - Production.
I got compilation error
WITH DPTCOST AS (
...............1
PCB-S-00400, Encountered the symbol "DPTCOST" when expecting one of the following:
END-EXEC
....continued
So I wonder if we could use that clause at all with Pro*Cobol
Here is the excerp of the code
EXEC SQL
DECLARE INPUT_ACTUAL CURSOR FOR
WITH DPTCOST AS (
SELECT /*+ rule */
A.CODE_COMBINATION_ID,
A.SEGMENT1, A.SEGMENT2, A.SEGMENT3,
A.SEGMENT6,
D.COSTING, D.PROCESS,
D.MTL_CODE, D.FACTOR
FROM
GL_CODE_COMBINATION A,
ALCGL_DEPARTMENT_COSTINGS D
WHERE
A.TEMPLATE_ID IS NULL
AND A.SUMMARY_FLAG <> 'Y'
AND A.SEGMENT1 = D.PLANT_NUMBER
AND A.SEGMENT3 <> '6999001'
AND A.SEGMENT3 <> '6999002'
AND SUBSTR(A.SEGMENT2,4,3) = D.DEPARTMENT
AND D.ACTUAL_FLAG = 'A'
) ... continued

Materialized views are basically stored query results. They offer advanced functionality like query rewrite, refresh on commit, and more;
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm
Unlike a view, they actually store the results of the query - not just the query;
SQL> create table t (cid number primary key)
Table created.
SQL> insert into t select object_id from dba_objects where object_id is not null
12791 rows created.
SQL> create materialized view mv
   as select * from t
Snapshot created.
SQL> select object_name, object_type from user_objects where object_name ='MV'
OBJECT_NAME                    OBJECT_TYPE       
MV                             TABLE             
MV                             MATERIALIZED VIEW 
2 rows selected.
SQL> select segment_name, bytes from user_segments where segment_name in ('T', 'MV')
SEGMENT_NAME                        BYTES
T                                  196608
MV                                 196608
2 rows selected.Temporary tables are simply tables that are created then dropped. GLOBAL TEMPORARY TABLES have the advantage (or disadvantage) of only existing until commit or the end of the session. They results are visible to the user that inserted the data - but only temporarily;
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#sthref7483

Similar Messages

  • Whats the best blu-ray writer to use with final cut pro x

    Whats the best blu-ray writer to use with final cut pro x

    The Sea Tech Blu Ray Writer works great with my Mac.

  • How do I connect TC to a new ethernet and share a new ethernet DSL with a new PC and use with my macbook Pro? I tried and get no internet on the PC or Macbook Pro?

    how do I connect TC to a new ethernet and share a new ethernet DSL with a new PC and use with my macbook Pro? I tried and get no internet on the PC or Macbook Pro?

    Ok.
    I am connected to wi-fi through TC connected to a specific router and is working perfectly and saving data through TM without any issues.
    The TC version is 7.6.1 and am using OS 10.7.3
    The router mode is on Bridge mode and router is connected to TC through USB cable, I suppose for internet access. My Mac is on wi-fi through TC
    I have another location, much further, which recently have been installed with wi-fi through router that has WPA accessibiulity with password, 100% different than the current one.
    Since, I will be most of my time in this new location, I wish to move my TC to this new location, and configure it in similar fashion like what I am having right now.
    Naturally, I do not wish to lose any saved data on the TC.
    Hope I managed to provide enought info.
    Thanks in advance

  • Do i need to reformat a samsung m3 for using with a macbook pro

    Hello
    Do i need to reformat a new samsung m3 for using with a macbook pro?
    I have an old bipra which i use and i just remember literally plugging it in and going.
    thanks for any info.

    I don't know about your particular configuration but usually Disk Utility not recognizing a drive means the drive/card is history.  My G4 running OSX 10.4.11 will format SD cards.
    I don't know your model computer. Is this one with a SD slot built in?  If it is, do you have an external reader, or can you try another card in this slot to see if it is a slot problem?

  • '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

  • Construct a Sql block using With Clause to improve the performance

    I have got four diff parametrized cursor in my Pl/Sql Procedure. As the performance of the Procedure is very pathetic,so i have been asked to tune the Select statements used in those cursors.
    So I am trying to use the With Clause in order to club all those four Select Statements.
    I would appreciate if anybody can help me to construct the Sql Block using With Clause.
    My DB version is..
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    Four Diff cursors are defined below.
    CURSOR all_iss (
          b_batch_end_date   IN   TIMESTAMP,
       IS
          SELECT isb.*
                FROM IMPLMN_STEP_BREKPN  isb
               , ISSUE iss
          WHERE isb.issue_id = iss.issue_id
           AND iss.issue_status_id  =  50738
           AND ewo_no IN
          (SELECT TO_CHAR(wo_no)
            FROM MGO_PLANT_AUDIT
           WHERE dml_status = 'U' OR dml_status = 'I')
          UNION ALL
          SELECT isb.*
           FROM IMPLMN_STEP_BREKPN  isb
            , ISSUE iss
           WHERE isb.issue_id = iss.issue_id
           AND iss.issue_status_id  =  50738
           AND CAST (isb.last_updt_timstm AS TIMESTAMP) >=
                                                                  b_batch_end_date;
          CURSOR ewo_plant  ( p_ewo_no IN  IMPLMN_STEP_BREKPN.ewo_no%TYPE)
          IS
          SELECT DISTINCT wo_no ,
          plant_code
          FROM MGO_PLANT
          WHERE TO_CHAR(wo_no) = p_ewo_no;
          CURSOR iss_ewo_plnt (
          p_issue_id IN IMPLMN_STEP_BREKPN.issue_id%TYPE ,
          p_ewo_no IN IMPLMN_STEP_BREKPN.EWO_NO%TYPE,
          p_plnt_code IN IMPLMN_STEP_BREKPN.PLT_FACLTY_ID%TYPE)
          IS
          SELECT *
          FROM IMPLMN_STEP_BREKPN
          WHERE issue_id = p_issue_id
          AND ewo_no = p_ewo_no
          AND
          (plt_faclty_id = p_plnt_code
          OR
          plt_faclty_id IS NULL);
          CURSOR iss_ewo_plnt_count (
          p_issue_id IN IMPLMN_STEP_BREKPN.issue_id%TYPE ,
          p_ewo_no IN IMPLMN_STEP_BREKPN.EWO_NO%TYPE,
          p_plnt_code IN IMPLMN_STEP_BREKPN.PLT_FACLTY_ID%TYPE)
          IS
          SELECT COUNT(*)
          FROM IMPLMN_STEP_BREKPN
          WHERE issue_id = p_issue_id
          AND ewo_no = p_ewo_no
          AND
          (plt_faclty_id = p_plnt_code
          OR
          plt_faclty_id IS NULL);

    Not tested. Some thing like below. i just made the queries as tables and given name as a,b,c and substituted columns for the parameters used in the 2nd cursor and third cursor. Try like this.
    CURSOR all_iss (
    b_batch_end_date IN TIMESTAMP,
    IS
    select a.*,b.*,c.* from
    ( SELECT isb.*
    FROM IMPLMN_STEP_BREKPN isb
    , ISSUE iss
    WHERE isb.issue_id = iss.issue_id
    AND iss.issue_status_id = 50738
    AND ewo_no IN
    (SELECT TO_CHAR(wo_no)
    FROM MGO_PLANT_AUDIT
    WHERE dml_status = 'U' OR dml_status = 'I')
    UNION ALL
    SELECT isb.*
    FROM IMPLMN_STEP_BREKPN isb
    , ISSUE iss
    WHERE isb.issue_id = iss.issue_id
    AND iss.issue_status_id = 50738
    AND CAST (isb.last_updt_timstm AS TIMESTAMP) >=
    b_batch_end_date) a,
    ( SELECT DISTINCT wo_no ,
    plant_code
    FROM MGO_PLANT
    WHERE TO_CHAR(wo_no) = p_ewo_no) b,
    ( SELECT *
    FROM IMPLMN_STEP_BREKPN
    WHERE issue_id = p_issue_id
    AND ewo_no = p_ewo_no
    plt_faclty_id IS NULL) c
    where b.wo_no = c.ewo_no and
    c.issue_id = a.issue_id ;
    vinodh
    Edited by: Vinodh2 on Jul 11, 2010 12:03 PM

  • Need help using WITH clause

    I have an update statement that is using the same suquery twice.
    I am not usre if WITh clause be used in update statements?
    Is there a way the below statement can be modified to use WITH clause?
    UPDATE EMP_TRACKING_LIST L
    SET ACTIVE_FLAG = DECODE((SELECT COUNT(*)
    FROM EMP_TRACKING_LIST L2
    WHERE L.NAME = L2.NAME AND
    L.EMP_CODE = L2.EMP_CODE AND
    L2.EMP_FLAG = 'Y'), 0, 'N', 'Y')
    WHERE ACTIVE_FLAG != DECODE((SELECT COUNT(*)
    FROM EMP_TRACKING_LIST L2
    WHERE L.NAME = L2.NAME AND
    L.EMP_CODE = L2.EMP_CODE AND
    L2.EMP_ACTIVE_FLAG = 'Y'), 0, 'N', 'Y')
    OR EMP_ACTIVE_FLAG IS NULL;
    I would really appreciate your input
    Edited by: user10937534 on Sep 2, 2009 4:47 PM

    Hi,
    WITH comes immediately before SELECT, not before UPDATE.
    To use WITH in an UPDATE statement, you would say something like:
    UPDATE  EMP_TRACKING_LIST  L
    SET     ACTIVE_FLAG =
            WITH  sub_q  AS
                SELECT  ...
            SELECT  ...
            FROM    sub_q  ...
    ;I don't think there's any way to use values from the sub-query in the WHERE clause of the UPDATE statement itself; MERGE is a much better bet for eliminating redundancy there.
    Sorry, I'm not at a database now, so I can test anything.

  • What is a decent sound card to use with DJ Mixer Pro?

    I'm having trouble finding a compatible external sound card to use with my Mac Mini. Specifically, I need one that supports surround sound to use with DJ Mixer Pro. I am currently unable to use the "Preview" function of the program during my sets to ensure proper blending from one track into another. I've gotten pretty good at working around it, but with the proper sound card I should be able to preview a track in the "rear" of the surround sound without disturbing the "front", which plays live to the crowd. Most information I can find on sound cards pertains to home theatre application, which I have no interest in. I also don't need anything too sophisticated as I use the program for local club performances instead of professional production. I would prefer something that connects through firewire to prevent any kind of delay, but most of these seem to be discontinued or expensive overkill, so I hope a USB 2.0 will suffice. Any help would be greatly appreciated!

    http://www.digitaldjtips.com/2010/11/6-budget-dj-sound-cards/
    Found this page, helped a lot

  • Is there a special inverter to use with my MacBook Pro when traveling in Europe?

    Is there a special inverter to use with my MacBook Pro when traveling in Europe?

    No, it will handle the voltages there:
    From http://www.apple.com/macbookpro/specs.html
    Electrical and operating requirements:
    Line voltage: 100V to 240V AC
    Frequency: 50Hz to 60Hz
    You might need a plug adapter to change the pin shape in some countries.

  • HT5219 How many Thunderbolt displays can I use with my MacBook Pro using Windows 7 and  Parrallels?

    How many Thunderbolt displays can I use with my MacBook Pro using Windows 7 and Parallels

    Two. You can daisy-chain two ATD together. Doesn't matter what you're running.
    Clinton

  • Can a shell for mac pro 13" be used with a mac pro Retina ?

    Can a shell for mac pro 13" be used with a mac pro Retina ?
    Thank you.

    No.
    The entire enclosure is tuned for both external jack placement, EMI-RFI radiation, airflow, and for cooling. You need exactly the correct shell and fans for the electronics you wish to install in it.

  • What is the best voice recognition software to use with my macbook pro

    What is the best voice recognition software to use with my macbook pro?

    This a popular one that I have read good things about>
    http://www.amazon.com/s/?ie=UTF8&keywords=dragon+mac&tag=googhydr-20&index=softw are&hvadid=34356472549&hvpos=1t2&hvexid=&hvnetw=g&hvrand=18148534541911339040&hv pone=&hvptwo=&hvqmt=b&hvdev=c&ref=pd_sl_95u976ozly_b
    Hope this helps

  • What is the best external battery to use with a macbook pro retina?

    Looking for the best option here. What is the best external battery to use with a macbook pro retina?

    You should check your date of purchase against the manufacturer's warranty
    or guaranty since some of those better brands have some recourse should
    they fail within a specified time period. A good reason to save dated receipts.
    Since solid-state USB drives probably don't (all) use a wear-leveling software
    to equally utilize their recordable space evenly, it is possible that some of these
    may exhibit a failure in some sector areas due to excessive over-writing. If the
    ones you use do not have such a technology or an undercounted total capacity
    with a means to automatically write in other sections, you may have to consider
    manually using a disk utility to zero-overwrite and reformat them occasionally.
    Even so, that may only help a marginal flash or thumb drive work a little longer.
    Should a camera memory card fail you still may be able to attempt with margin of
    success, to +recover image files+ from it. re: http://www.cgsecurity.org/wiki/PhotoRec
    The standard default format they ship with works well for most file types; so if
    you aren't moving OS X or Mac app specific files around on a USB flash drive,
    the original format should be fine. Oh, you can use Disk Utility to attempt to do
    a repair; but in some cases you may have to reformat them, etc.
    {Some of the flash drive warranties or guarantees may vary from between regions;
    so if you have one with a '5 Year' guarantee in the US, other rules may apply in EU,
    or when you seek to replace an item under warranty outside of where it was bought.}
    Good luck & happy computing!

  • What external web cam can i use with my macbook pro?

    I want to get an external web cam to use with my macbook pro.  which ones will work?  i tried a logitech and my laptop wouldn't consistently recognize it, despite trying with multiple browsers. 

    Apple Compatible Mac Webcams
    iChatUSBCam.  The manufacturer’s website also has a *free* demo of its product & a complete list of USB webcams compatible w/macs & its product.
    For more suggestions, check out EZJim’s website which can be found HERE. <--Clicky click

  • Monitor HP w2448hc needs a driver to be used with my Macbook Pro, but HP only offers download to Microsoftprograms,... My screen behave unstable, waves, and I need to do something. Waht do I do?

    Monitor HP w2448hc needs a driver to be used with my Macbook Pro, but HP only offers download to Microsoftprograms,... My screen behave unstable, waves, and I need to do something. Waht do I do?

    Monitor HP w2448hc needs a driver to be used with my Macbook Pro...
    Highly doubtful (see next response.)
    ...but HP only offers download to Microsoftprograms,...
    The software is likely for the built-in webcam.  The monitor/screen portion of the w244hc would NOT need drivers unless it had some funky non-standard amount of pixels.  But the monitor is a standard 1920x1200 which the Mac should detect if you're using the HDMI or DVI connector.
    ...My screen behave unstable, waves, and I need to do something. Waht do I do?
    Are you using the VGA connector?  VGA, being an analog signal is more likely to cause the symptoms you describe (compared to the digital signals DVI or HDMI.)  Often reseating the VGA connector can help.  (IOW, push the VGA connector in harder...on BOTH ends of the cable.)  But VGA would also be more susceptable to signal degradation with anything greater than 1600 pixels.  So if you are using the VGA connector, get the appropriate DVI adapter for your Macbook Pro as soon as you can.

Maybe you are looking for

  • Error messages when I log on to Firefox.

    I get these same two error messages ( below) when I use my FIREFOX. What is the problem? How canI fix it? Thank you. ERORR MESSAGES: 1. --stanticate interface component! 2. Message TypeError_EMBARQ_INST_.DTFox is defined

  • FSB only 100 on Satellite 2410-304S

    Why ist the FSB for memory only 100MHz instaed of 133MHz? The chipset i845 can handle 133. Is there any possibility to change it?

  • Maintenance Order through Measuring Point

    Dear all, I want to know whether it is possible to create the maintenance order on the basis measuring point . I know how to create the order on the basis of measuring counter. Is there any procedure to create the maintenance Order through measuring

  • Safari 8 not responding

    When I start Safari 8.0 on Yosemite, it uses 100% CPU.  If I try to load any web page, Safari stops responding (spinning wheel of death) before anything is rendered.  This includes pure HTML pages (no javascript, flash, etc.). Immediately after launc

  • How do I make Firefox not dial up by itself?

    I have dial up service. Sometimes I hang up Firefox, but leave a webpage visible so that I can make a telephone call based on a telephone number on the webpage. If a webpage is visible, Firefox repeatedly tries to re-establish connection. I'm constan