How do i re-write

Hi !
If i were to re-write this query with joins, how would i do it ? Anyone ?
DELETE
FROM XCM_VO01_VEHOFINT VOIA
WHERE VOIA.COUNTRY_ISO3_C = 'DEU'
AND VOIA.CUST_BRAND_C = 'F'
AND VOIA.CUCON_CNTCT_ST_S > to_date('2005-10-24', 'YYYY-MM-DD')
AND EXISTS
(SELECT *
FROM XCM_CU10_CONTACT CU10
WHERE CU10.COUNTRY_ISO3_C = VOIA.COUNTRY_ISO3_C
AND CU10.CUST_CUSTOMER_R = VOIA.CUST_CUSTOMER_R
AND CU10.CUST_BRAND_C = VOIA.CUST_BRAND_C
AND CU10.CUCON_CNTCT_ST_S = VOIA.CUCON_CNTCT_ST_S
AND CU10.CUCON_CNTCT_R = VOIA.CUCON_CNTCT_R
AND CU10.COUNTRY_ISO3_C = 'DEU'
AND CU10.CUST_BRAND_C = 'F'
AND CU10.CUCON_TREAT_TYP_C = 'TDN'
AND CU10.CUCON_VALUE_TRK_C = 'FDEU900008'
AND CU10.CUCON_CNTCT_ST_S > to_date('2005-10-24', 'YYYY-MM-DD')
AND CU10.CUCON_CNTCT_R <>
(SELECT MIN(CUCON_CNTCT_R) FROM XCM_CU10_CONTACT CU10A
WHERE CU10A.COUNTRY_ISO3_C = CU10.COUNTRY_ISO3_C
AND CU10A.CUST_CUSTOMER_R = CU10.CUST_CUSTOMER_R
AND CU10A.CUST_BRAND_C = CU10.CUST_BRAND_C
AND CU10A.CUCON_CNTCT_ST_S = CU10.CUCON_CNTCT_ST_S
AND CU10A.CUCON_TREAT_TYP_C = 'TDN'
AND CU10A.CUCON_VALUE_TRK_C = 'FDEU900008')
AND
( EXISTS
(SELECT * FROM
XCM_CU10_CONTACT CU10B
WHERE CU10B.COUNTRY_ISO3_C = CU10.COUNTRY_ISO3_C
AND CU10B.CUST_CUSTOMER_R = CU10.CUST_CUSTOMER_R
AND CU10B.CUCON_CNTCT_R != CU10.CUCON_CNTCT_R
AND CU10B.CUST_BRAND_C = CU10.CUST_BRAND_C
AND CU10B.CUCON_CNTCT_ST_S = CU10.CUCON_CNTCT_ST_S
AND CU10B.CUCON_TREAT_TYP_C = 'TDN'
AND CU10B.CUCON_VALUE_TRK_C = 'FDEU900008')));

Eric:
It doesn't really matter what you select, because exists doesn't really return anything. Oracle will use the fastest access path possible to find a record. As soon as it finds a record, it stops and EXISTS becomes true.
SQL> CREATE TABLE t AS
  2  SELECT object_id, owner, object_name
  3  FROM all_objects;
Table created.
SQL> CREATE TABLE t1 AS SELECT * FROM all_objects;
Table created.
SQL> ALTER TABLE t ADD CONSTRAINT t_pk PRIMARY KEY (object_id);
Table altered.
SQL> ANALYZE TABLE t COMPUTE STATISTICS FOR TABLE FOR ALL INDEXES
  2  FOR ALL INDEXED COLUMNS;
Table analyzed.
SQL> set autot trace explain
SQL> SELECT * FROM t1
  2  WHERE EXISTS (SELECT owner FROM t
  3                WHERE t1.object_id = t.object_id);
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=11 Card=14299 Bytes=1887468)
   1    0   NESTED LOOPS (SEMI) (Cost=11 Card=14299 Bytes=1887468)
   2    1     TABLE ACCESS (FULL) OF 'T1' (Cost=10 Card=18444 Bytes=2360832)
   3    1     INDEX (UNIQUE SCAN) OF 'T_PK' (UNIQUE)Even though I am "selecting" owner from t, there is no table access because the existence check can be satisfied by using the PK.
HTH
John

Similar Messages

  • How to read and write a string into a txt.file

    Hi, I am now using BEA Workshop for Weblogic Platform version10. I am using J2EE is my programming language. The problem I encounter is as the above title; how to read and write a string into a txt.file with a specific root directory? Do you have any sample codes to reference?
    I hope someone can answer my question as soon as possible
    Thank you very much.

    Accessing the file system directly from a web app is a bad idea for several reasons. See http://weblogs.java.net/blog/simongbrown/archive/2003/10/file_access_in.html for a great discussion of the topic.
    On Weblogic there seems to be two ways to access files. First, use a File T3 connector from the console. Second, use java.net.URL with the file: protocol. The T3File object has been deprecated and suggests:
    Deprecated in WebLogic Server 6.1. Use java.net.URL.openConnection() instead.
    Edited by: m0smith on Mar 12, 2008 5:18 PM

  • How to create report writer in sap?

    Hi Anybody,
      I want to create new report writer for finance report for ex: (p & L or balance sheet), i don't know how to create report writer in sap.
    anybody please tell me with example?
    Thanks
    Regards,
    S.Muthu.
    IT Dept.

    https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=createreportwriter&adv=false&sortby=cm_rnd_rankvalue

  • How to read and write a data from extrenal file

    Hi..
    How to read and write a data from extrenal file using Pl/sql?
    Is it possible from Dyanamic Sql or any other way?
    Reagards
    Raju

    utl_file
    Re: How to Create text(dat) file.
    Message was edited by:
    jeneesh

  • How to change the permission of a folder of a website hosted on Microsoft Azure. I would like to know how to enable read write permission for this folder

    How to change the permission of a folder of a website hosted on Microsoft Azure. I would like to know how to enable read write permission for this folder
    Regards,
    John

    Hi,
    Please try to setting Folder Permissions on Web Publish, and then deploy it with Web Deploy, as far as I know, if we do that, Web Deploy will use the SetAcl operation to change permissions. Please have a look at the article below.
    #http://sedodream.com/2011/11/08/settingfolderpermissionsonwebpublish.aspx
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to read and write to file on server

    can any body tell how to read or write to a file on server, like where do i keep the file and what does the path look like......on server
    stand alone i am reading and writing into file but when it comes to server i am confused how it works...i mean the path
    thank you

    The Path needs to be absolute:
    For example in Unix it would look like:
    /usr/paz/Test.txtIn Windows it would look like:
    C:/Paz/Test.txtHope this helps.
    Thanks and regards,
    Pazhanikanthan. P

  • How in Illustrator I write text with transparent background ?

    How in Illustrator I write text with transparent background ?

    that is correct. You open it in AI and you have an option to use area text, you first take the text tool and drag to make a text frame, which wors like it does in a layout program. Or you click the text tool any where on the canvas and just start typing if you want to make another line you either hit the return (enter) key or for  soft return use shift/return (enter).
    The default is a transparent background.
    All art i Illustrator is on a transparent background unless you add an object behind other objects that has a fill color.

  • HOW CAN I DIRECTLY WRITE ON NEXT PAGE OF SAPSCRIPT

    HI,
    HOW CAN I DIRECTLY WRITE ON NEXT PAGE OF SAPSCRIPT.
    I want to  call certain fields on next page only is it possible?
    How?
    Regards
    mave

    Hi
    You can use -
    IF &PAGE& = 2. ENDIF.
    But this will work only when you sapscript triggers two pages. Multiple pages can be triggered by main window if the window is filled up. Otherwise you can define two pages statically in your script .
    Cheers.

  • How to Read and Write .XML datas   (HELP Plz...)

    hai everybody
    how to read and write xml datas... plz give clean and simple example..
    bcoz me want to produce such type of module...
    if any one help me .. thats the only way me laid in software ladder
    plz....
    thank u in advance

    thank u for giving idiot..
    but before posting i search in google also..
    but i cant get what me expect..
    thus i posted...
    then who is ................?
    sorry javacoder01
    // plz help me
    Message was edited by:
    drvijayy2k2

  • How do I "un-write protect" USB flash drives?

    I recently purchased a new computer that has Windows 8.  One of my many flash/thumb drives is now suddenly marked "write-protected" when I did nothing to make it so.  I found a solution listed for Windows 7.  I applied it to my
    own computer, however it did not change the said drive from write-protected to un-write protected.  I simply want to move files to another storage device and re-format the write-protected drive for new files.  How do I un-write-protect my flash/thumb
    drive in the Windows 8 operating system?

    I ran in to the same problem but none of the instructions here helped. doing some more searching i found a different article that supplied the answer for my issue. wanted to share in case other were still having issues.
    If the problem is persistent with the drive and you still can't copy files to it or format it after:-
    1- You tried removing read-only permission from the drive properties
    2- You tried formatting from Windows
    3- You tried formatting from CMD using DISKPART
    4- You tried editing the Registry solution (for WriteProtect word)
    5- You tried the different free online tools like
    HDD LL Format tool and HP Format Tool
    Then your drive is corrupt and needs the internal chipset S/W to be flashed, i.e. repairing the USB software The
    steps below will lead you to get a small program to run on your USB memory-stick which is specific to your MANUFACTURER (make) and PRODUCT (model). If you don't want to go through the headache of the manufacturer's technical support then
    do it yourself as follows (which I source from here):-
    1- Get Chip
    Genius portable application from here which
    you will use to find the VID and PID of the USB stick chip.
    2- Search for the tool to repair your USB stick S/W from FlashBoot
    website . Search using your VID and PID from the previous step.
    3- Search on Google for the name of the application you find in the "UTILS" column in the page from step 2 and the first link on Google Results
    (usually) will take you back to the FlashBoot website to download the utility to get your USB drive repaired.
    It worked for me for my Kingston Data Traveler flash drive. It didn't work with all the common options for fixing the USB drive having "write protected",
    but the above solution I found after hours and hours of searching online and asking my computer-geeks colleagues.
    Hope this helps!  

  • How to record receipt write off for the PO receipt ?

    How to record receipt write off for the PO receipt ?

    You can refer this link
    http://docs.oracle.com/cd/A60725_05/html/comnls/us/po/rcvacc07.htm
    thanks

  • How can I can write Arabic in Adobe Illustrator CS6 ?

    How can I can write Arabic in Adobe Illustrator CS ?
    I use Adobe® Creative Suite® 6 Design & Web Premi
    And I write Arabic in Adobe photshop CS6 but I can't write in  Illustrator and  indesign
    PLZ help me .

    Hi,
    In Photoshop, Middle-east/North-african type (MENA) is enabled in all editions. In Illustrator and InDesign, you need the MENA-enabled editions of the software. Please use these links to download the trial and explore Arabic language support in Illustrator:
    Illustrator: http://www.adobe.com/mena_ar/downloads/download-illustrator.html
    Cheers,
    David

  • How to read and write on ntfs partitions??

    Hello everyone, thanks for viewing my post.  I want to know how to read and write on ntfs partitions under sata hd on my arch64 system.  I'm using kde as my de and dolphin does sees it but can't access it anyway.  I didn't had problem so far on mounting usb drives it just automounts maybe because it is a fat partition not a ntfs?  Please I need your help...Thanks in advance:)

    You will most likely need to rework your fstab.  The one from my desktop is shown below. If you want regular users to be able to access the partition, then you will need to change the gid option as I have done. Although you could create a group just for people you want to have access.
    You will need to know the device that your windows partition is held on of course. In my case it is my first hard disk, first partition, hence /dev/sda1.
    # /etc/fstab: static file system information
    # <file system> <dir> <type> <options> <dump> <pass>
    none /dev/pts devpts defaults 0 0
    none /dev/shm tmpfs defaults 0 0
    /dev/cdrom /media/cdrom auto ro,user,noauto,unhide 0 0
    /dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0
    /dev/mapper/nvidia_fbgfhehd1 /boot ext2 defaults 0 1
    /dev/mapper/nvidia_fbgfhehd2 / reiserfs defaults 0 1
    /dev/mapper/nvidia_fbgfhehd3 /var reiserfs defaults 0 1
    /dev/mapper/nvidia_fbgfhehd5 /opt reiserfs defaults 0 1
    /dev/mapper/nvidia_fbgfhehd6 swap swap defaults 0 0
    /dev/mapper/nvidia_fbgfhehd7 /home reiserfs defaults 0 1
    /dev/sdd1 /mnt/andromeda vfat defaults 0 0
    /dev/sda1 /mnt/windows ntfs-3g defaults,user,gid=users 0 0
    My XP partition is set to mount automatically, as I regularly interchange documents between the OS's.
    Hope that helps.

  • How to read and write data in to a specified range of cells(it include multiple row & columns) in excel

    How to read and write data in to a specified range of cells(it include multiple row & columns) in excel

    CVI Comes with a sample project that explains how to read/write to a Excel file: choose "Explore examples..." in CVI welcome page and navigate to <cviSampleDir>\activex\excel folder where you can load excel2000dem.prj.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to improve the write performance of the database

    Our application is a write intense application, maybe will write 2M/second data to the database, how to improve the performance of the database? We mainly write to 5 tables of the database.
    Currently, the database get no response and the CPU is 100% used.
    How to tuning this? thanks in advance.

    Your post says more by what is not provided than by what is provided. The following is the minimum list of information needed to even begin to help you.
    1. What hardware (server, CPU, RAM, and NIC and HBA cards if any pointing to storage).
    2. Storage solution (DAS, iSCSCI, SAN, NAS). Provide manufacturer and model.
    3. If RAID which implementation of RAID and on how many disks.
    4. If NAS or SAN how is the read-write cache configured.
    5. What version of Oracle software ... all decimal points ... for example 11.1.0.6. If you are not fully patched then patch it and try again before asking for help.
    6. What, in addition to the Oracle database, is running on the server?
    2MB/sec. is very little. That is equivalent to inserting 500 VARCHAR2(4000)s. If I couldn't do 500 inserts per second on my laptop I'd trade it in.
    SQL> create table t (
      2  testcol varchar2(4000));
    Table created.
    SQL> set timing on
    SQL> BEGIN
      2    FOR i IN 1..500 LOOP
      3      INSERT INTO t SELECT RPAD('X', 3999, 'X') FROM dual;
      4    END LOOP;
      5  END;
      6  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.07
    SQL>Now what to do with the remaining 0.93 seconds. <g> And this was on a T61 Lenovo with a slow little 7500RPM drive and 4GB RAM running Oracle Database 11.2.0.1. But I will gladly repeat it using any currently supported version of the product.

  • I want to write record type variable in ult file.How to i can write record type varable without column name.

    I want to write record type variable in ult file.How to i can write record type varable without column name.
    type rec_format_type is record
         format1  VARCHAR(3),
         format2  VARCHAR(3),
    my_record     rec_format_type;
    UTL_FILE.PUT_LINE(file_out, my_record);

    ibney wrote:
    I have below requirement.
    DECLARE
         emp_data UTL_FILE.FILE_TYPE;
    BEGIN
        emp_data := UTL_FILE.FOPEN ('EXDATAPUMP','TEST_BC_NN_PARALLEL.csv','W',32000);
        FOR TEST1 IN (SELECT /*+ PARALLEL(TEST_BC_NN,4) */  * FROM TEST_BC_NN) LOOP
            UTL_FILE.PUT_LINE (emp_data, TEST1);---Here i want to write record in utl file.without knowing the structure of table
        END LOOP;
        UTL_FILE.FCLOSE (emp_data);
    END;
    Why all the ugly upper case? You do realise that NO programming standard, ranging from Java and .Net, to C/C++ and Ada (of which PL/SQL is an implementation of), use upper-case-for-reserved-words as a standard.
    The easiest and simplest way to address your requirement is as follows:
    SQL> create or replace type TStringArray is table of varchar2(4000);
      2  /
    Type created.
    SQL>
    SQL>
    SQL> begin
      2          for c in(
      3                  select
      4                          TStringArray(
      5                                  to_char(empno,'000000'),
      6                                  ename,
      7                                  to_char(hiredate,'yyyy-mm-dd')
      8                          ) as COLS
      9                  from    emp
    10                  order by empno
    11          ) loop
    12                  for i in 1..c.Cols.Count loop
    13                          dbms_output.put( c.Cols(i) );   -- write column
    14                          if i < c.Cols.Count then
    15                                  dbms_output.put( '|' ); -- write column separator
    16                          end if;
    17                  end loop;
    18                  dbms_output.put_line( ' *end*' );               -- write record terminator
    19          end loop;
    20  end;
    21  /
    007369|SMITH|1980-12-17 *end*
    007499|ALLEN|1981-02-20 *end*
    007521|WARD|1981-02-22 *end*
    007566|JONES|1981-04-02 *end*
    007654|MARTIN|1981-09-28 *end*
    007698|BLAKE|1981-05-01 *end*
    007782|CLARK|1981-06-09 *end*
    007788|SCOTT|1987-04-19 *end*
    007839|KING|1981-11-17 *end*
    007844|TURNER|1981-09-08 *end*
    007876|ADAMS|1987-05-23 *end*
    007900|JAMES|1981-12-03 *end*
    007902|FORD|1981-12-03 *end*
    007934|MILLER|1982-01-23 *end*
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • Comments in iWeb Dont show up

    O.K., when people leave a comment on my blog, it will show you the number of comments left. However, when you click on the post and scroll down to said comments, the only thing down there is a yellow box with text that reads: # Exception: TypeError #

  • How can I format a large number to have comma separators?

    I have numbers that are very large, i.e., in the billions. I want to format the display to show comma separators. For example: 8000000000 => 8,000,000,000 Is there an easy way to do this?

  • Transaction Attibutes in EJB

    How can we set the Isolation levels for Transaction in Session Beans. and as well as Entity Beans i.e. CMP

  • Trying to get started with Lr 5 and already in trouble

    I just downloaded LR 5 and when asked if I wanted to use the default for Catelog I choose to brouse and direct it to my Cateloge of Pictures on the harddrive when my pictures are stored.... I did this thinnking that it would link me to the pictures..

  • Match codes variables in Bex

    Hi. I'm working in a system that receives data from several SAP source systems and several company's. This causes an huge amount of master data. If a variable is used to select data and if the user pushes F4, all data is showed without any restrictio