Difference Between (MINUS and NOT IN ) conditions

Hi all,
I am using oracle 10gR2 on AIX.
I am running a sql query and getting some strange results from this.
Select dw_cell_id
from cell_sites cs
where cs.valid_flg = 'Y'
and cs.dw_cell_id not in
(select distinct dm.dw_cell_id
from cell_sites_dim dm)
Above query is returning zero records. Note that DW_CELL_ID column is number data type.
When I use MINUS condition instead of NOT IN it return me few records.
select dw_cell_id
from cell_sites cs
where cs.valid_flg = 'Y'
minus
select distinct dm.dw_cell_id
from cell_sites_dim dm
Can any one tell me whats the difference between these two scenarios. Why i am unable to get the results from first statement.
Thanks
Farooq

Hi all,
I am using oracle 10gR2 on AIX.
I am running a sql query and getting some strange
results from this.
Select dw_cell_id
from cell_sites cs
where cs.valid_flg = 'Y'
and cs.dw_cell_id not in
(select distinct dm.dw_cell_id
from cell_sites_dim dm)In this query, check that you are using "AND" operator. This means it will check for tha correctness of both the conditions. This will return only that row which has valid_flg='Y' and its dw_cell_id is not in cell_sites_dim.... ANd there may be no such records matching both the conditions.
When I use MINUS condition instead of NOT IN it
return me few records.
select dw_cell_id
from cell_sites cs
here cs.valid_flg = 'Y'
minus
select distinct dm.dw_cell_id
from cell_sites_dim dm
------------------------------------------------In this,, you are using "Minus". In this firstly first query will fetch records having valid_flag='Y' and fromthose record it will minus the record which are in cell_sites_dim. So there can be records in cell_sites which have valid_flag='Y' but thay are not in cell_sites_dim.
hope you get the point.
There in symentic error in you query nothing else.
regards,
Navneet
>
Can any one tell me whats the difference between
these two scenarios. Why i am unable to get the
results from first statement.
Thanks
FarooqHI

Similar Messages

  • What is the difference between Never and Not supported

    What is the difference between Never and Not supported?
    Also I want to know what are all the transaction attibutes are supported by MDB and why?

    Never- If the bean is called in an existing trasaction an exception is thrown.
    NotSupported - Methods always execute outside the transaction context. If a transaction is started when this method is called, this method is executed outside the transaction. The initial transaction is continued after the method exits.

  • Difference between messages and notes in Gmail

    Please forgive my ignorance.  I don't know what the difference is.  I am new to Apple but that is hardly an excuse.

    From my understanding when reading it, and mind you I do not use Gmail, that it is similar to the Windows Recycle bin. You are removing the mail from the Inbox, but instead of completely deleting it, it archives it so you can recall it. I suspect that a search at the Gmail support site might yield you more current and accurate information.

  • Difference between invoice and debit note

    Hi,
    what is the difference between invoice and a debit note.
    If I underinvoice a customer, should I raise a additional invoice for the difference or shud i raise a debit note. if  i need to raise debit note, then why not invoice or if i need to raise an invoice, then why not a debit note
    regards
    sachin

    Debit note is generally used to issue an invoice for already sold goods w/o physical goods movement involved.
    If raw material prices increases which are utilized in production of Finished goods. then the business will submit the relevant documents as proof at customer.
                  Once Customer is accepted, then price increase effective date will be finalized , Then business issues debit note request for the required material & its converted into debit note. ( all this will be done, based on agreement with the Customer). Generally this scenario is most widely used in Manufacturing / Automobile industry.
    where as, If invoice is created with less price than actual, you dont need to create debit note, instead you can either Cancel this invoice or create Invoice Correction request.
    hope it adds info

  • What is the difference between != and Logical NOT operator

    kindly,tell me what is the difference between Not Equality operator and logical negation operator.
    Edited by: user13414134 on Dec 3, 2010 8:59 AM

    what is the difference between != and Logical NOT operator The NOT operator is transformed into the inequality operator (<>), as can be seen from the Predicate Information of the explain plan:
    SQL> explain plan for select * from dual where  :x != :y
    Explain complete.
    SQL> select * from table(dbms_xplan.display())
    PLAN_TABLE_OUTPUT                                                              
    Plan hash value: 3752461848                                                    
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |    
    |   0 | SELECT STATEMENT   |      |     1 |     2 |     2   (0)| 00:00:01 |    
    |*  1 |  FILTER            |      |       |       |            |          |    
    |   2 |   TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |    
    Predicate Information (identified by operation id):                            
       1 - filter(:Y<>:X)                                                          
    14 rows selected.
    SQL> explain plan for select * from dual where not :x = :y
    Explain complete.
    SQL> select * from table(dbms_xplan.display())
    PLAN_TABLE_OUTPUT                                                              
    Plan hash value: 3752461848                                                    
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |    
    |   0 | SELECT STATEMENT   |      |     1 |     2 |     2   (0)| 00:00:01 |    
    |*  1 |  FILTER            |      |       |       |            |          |    
    |   2 |   TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |    
    Predicate Information (identified by operation id):                            
       1 - filter(:Y<>:X)                                                          
    14 rows selected.

  • What is the difference between action and workflow? How do I decide that I need an action in a transaction and not a workflow and vice versa?

    Dear Experts,
    I have few doubts and request your expert inputs to clarify my doubts.
    What is the difference between action and workflow? How do I decide that I need an action in a transaction and not a workflow and vice versa?
    Your earliest response is highly appreciated.
    Thanks,
    SMTP

    Hi SMTP,
    First of all, as I mentioned action is nothing but an executable work item which is designed in the workflow itself. In other words, Workflow is like your OOPS class. At run time, workflow instances are created just like objects of classes. Now, the steps designed in the workflow are called TASKS and the instances of tasks are called WORKITEMS. Now, the work items where any user action is required are called executable work items. ANd the work items where no user action is required (for example, sending an email in background) are called non-executable work items.
    Whether to go with development of workflow or not depends upon your business scenario. If your requirement is only to send an email and you find any BAdi or exit where in you can write your logic then there is no need of creating a workflow. If there is a defined business process with defined users and time lines, then you can go with the development of workflows.
    Rest, the below link will help you in understanding basic concepts of workflow :
    Why use SAP Workflow? | Insight Consulting Partners
    Regards,
    Richa

  • Difference between CS3 and CS4 when placing images, percentage not kept

    There is some kind of difference between CS3 and CS4 when placing images. The images I've dealt with right now were vector images but it might apply to all kinds of images.
    When replacing an existing image, the CS4 behaviour is to let the image fill up the frame. In CS3 the percentage was set to 100% as default (the % you see when selecting the image, not the container).
    Also when replacing an impage in CS4, the "inner" image frame is kept, while in C3, the percentage was kept.
    Is there some kind of placement preferences / settings to let CS4 act the same wat as CS3 did, when placing an image?
    -- Andreas

    Yes, the behavior was changed in CS4 (and many users, like me, prefer the new system).
    If you click and drag a loaded image place cursor the entire image will be be scaled to fit the proportionally drawn frame -- a huge timesaver if you mostly place uncropped art. If you want 100% of the image at 100% scale, just click and release -- same as before, or as before you can pre-draw a frame and place into it and your image will come in cropped at 100% (unless you've changed the fitting options for the frame before placing).
    Peter

  • What is difference between modify and update i am using

    hi
    what is difference between mofify and update
    my requiremen is to have three condition checkec while mofifying or updating from a internal table
    the three fields are
    cus no
    status
    date these all are primary key in the database table
    so which sould i use modify or update
    there might be entry already existing in database table or new entry to be created if already existin it should check on the primary keys and updatat if not it should add a record
    pls suggest whihc to use and how to implement the check on teh threee primary key
    like if modify ztable from table it_test
    now where condition ? can be used or not with modify? and if yes how
    if not should i use update will update create a new entry if no entry is there and please give syntex
    regards
    Arora

    Hi Nishant Arora,
    Modify: It works in performing two actions.
    They are: Insert + Update.
    For Example If a record that is exited in database, so you are modifying that record, it updates that particular record.
    Similarly, If the is not existed in the database, you are modifying it, it inserts a new record.
    Update: Update means just it updates the status, I mean it only updates the record. It doesn't inserts any new record if that particular record is not present in the database.
    These are the cases you need to write these statements.
    Syntaxes: :
    Go through this links please.,
    http://help.sap.com/saphelp_nw04/helpdata/en/e7/968aa8b2384dd9835f91e7f8470064/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm
    Reward points if useful
    Cheers,
    Swamy Kunche
    Edited by: Swamy Kunche on Jun 11, 2008 2:41 PM

  • Difference between exists and createIf

    Hi all,
    In Node functions we are having createIf and exists. what is the difference between createIf and exists? Where we have to use createIf and where we have to use exists?
    Thanks
    Sridhar

    Hi Sridhar
    Source Node --- Exists ---target Node ..... this says that the target node will be created if and only if the source node (may be source occurences is 0...1)through which you are mapping exists or not.. If it than target node will be created if not than it wont be created ...
    Source node -
    creatIf---target Node ...... this says that there will be some condition in source side ...if that condition is true than create the target node otherwise do not create
    Regard
    Abhi

  • Which is difference between Pipeline and Consignment..

    Hello  All...
    I need your help... Can you help me to understand the difference between Pipeline and Consignment?
    Many thanks and I appreciate your Help and comments!

    A pipeline material is a material that flows directly into the production process from a pipeline (for example, oil), from a pipe (for example, tap water), or from another similar source (for example, electricity).
    A material from the pipeline is always available; i.e. it can be withdrawn from the pipeline at any time and in any quantity.
    Depending on the system configuration, a material can be withdrawn only from the pipeline or, in addition to the pipeline, normal stocks of the material can also be managed.
    STEPS TO MAINTAIN PIPELINE MATERIAL
    1. You can create a material with PIPE material type or else you can use any material type but that should allow pipeline process.
    2. You should have Inforecord for the material with valid conditions, price will pick only from inforecord.
    3. If requied you can maintains ource list or else you can select during goods issue.
    4. From the Inventory Management menu, choose Goods movement ® Goods issue.
    Maintain the data on the initial screen. Choose Movement type ® Consumption ® To cost center (or To order, To network, All account assignments) ® From pipeline (Movement types : 201 P, 261 P, 281 P, or 291 P)
    5. On the collective entry screen, enter the account assignment. Enter the items.
    You do not have to enter the vendor as this will be found automatically by the system.
    If more than one vendor is possible, a pop-up window appears with a list of pipeline vendors, from which you can select the vendor you require.
    Post the goods movement.
    we can not stock pipeline material. It is readily available. directlly it is avilable at cost center. you need to pay for that consumption

  • Differences between APO and R3 sysytem.

    Hi everybody,
                        Can anyone list out the differences between the APO system and the R3 system.A detailed explanation will be helpful.

    Hi,
    APO
    APO is the supply chain tool from SAP.
    BW is the data layer for APO.
    SAP APO is for Demand Planning and is a component of mySAP SCM. It enables dynamic supply chain management and which in turn includes applications for detailed planning, optimization and scheduling, allowing the supply chain to be accurately and globally monitored even beyond enterprise boundaries.
    SAP BI is a reporting tool in SAP. It provides a complete view of the company. The solution is part of SAP NetWeaver and provides the tools needed to make the right decisions, optimize processes, and measure strategic success: data from all enterprise sources are merged effectively and can be comprehensively analyzed, business-critical factors can be monitored using external and internal benchmarks, the most important KPIs can be passed on to all the relevant forces in a company in real time, strategies can be rapidly adapted to changed market conditions, and the results of analyses can be graphically represented in a wide variety of formats, such as grids, graphs, and maps
    Check this:
    What is APO and how it is related to BW
    SAP Advanced Planner and Optimizer is a component of the mySAP Supply Chain Management solution that you use for planning and optimizing supply chain processes at a strategic, tactical, and operational planning level.
    With APO - Simultaneous Material & Capacity Planning is possible, as against R/3 PP
    APO Planning is capable of taking all the constraints into consideration with Planning for Capacities/Scheduling
    APO Resource (workcenter in R/3) does a Capacity availability check before scheduling an activity, if capacity is not available, it finds the immediate next available slot & schedules the activity there. This is not possible with R/3
    http://www.sap.com/solutions/business-suite/scm/pdf/BWP_APO40.pdf
    http://help.sap.com/saphelp_apo/helpdata/en/7e/63fc37004d0a1ee10000009b38f8cf/frameset.htm
    http://help.sap.com/bp_biv133/documentation/BW/I18_Scen_InstallGuide_EN_DE.doc
    http://help.sap.com/saphelp_scm41/helpdata/en/92/dd013872af2946e10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_apo/helpdata/en/7e/63fc37004d0a1ee10000009b38f8cf/frameset.htm
    R/3 OLTP
    Online Transactional data processing.
    Designed to efficiently process high volumes of transactions, instantly recording business events (such as a sales invoice payment) and reflecting changes as they occur.
    Current data
    Short database transactions
    Online update/insert/delete
    Normalization is promoted
    High volume transactions
    Transaction recovery is necessary
    http://en.wikipedia.org/wiki/OLTP
    Refer for OLTP Vs OLAP
    compare to r/3, what are the benefits available for b/w
    R/3 and BW reports
    http://www.geekinterview.com/question_details/209
    http://blogs.netindonesia.net/kiki/archive/2006/02/28/8822.aspx
    What's the Difference Between OLAP and OLTP?
    Thanks,
    JituK

  • Difference between validation and susbstittution with tcodes

    hi all can any body tell me about difference between validation and susbstittution with tcodes
    regars
    sravya

    Hi,
    Settting up the FI Validations
    You can use additional validation to supplement the existing SAP logic to fit you into your businness needs.
    For e.g. to allow postings from company code 0001 to business area AA only.
    GGB0 - To maintain the validations
    Validation - Enter a validation name e.g. VBUS
    Applicaion Area - SAP module e.g. FI
    Calling Point - Dependent upon the application area that is selected.
    0001 - Document Header - validate enteries at document header, e.g BKPF table
    0002 - Line Items - check line item entris within a document, e.g. BSEG table
    0003 - Complete Document - check settings for the whole documents.
    e.g. Validation step 001
    Allowed company code '0001' to post to business area AA only. 'FI00' checks that line item is from FI.
    If checks failed, the error message number 14 is displayed to stop the transaction.
    Prerequisite
    <BSEG> $BUKRS = '0001' AND
    <BKPF> $GLVOR = 'FI00'
    Check
    <BSEG> $GSBER = 'AA'
    Message
    Type E No. 14 - Business Area not allowed for company 0001
    Output fields 1 - BSEG - GSBER 2 - BSEG - BUKRS
    3 - 4
    OB28 - Define Validations for Posting
    CC CallPnt Validation Description Activtn Level
    0001 2 VBUS Business Area Validation 1
    Activtn Level - 0 - Not Active 1 - Activated 2 - Activated for all except batch input
    GGB4 - Manage the activation of all validations in the SAP system.
    Validations, Substitutions, and Rules
    Purpose
    With the validations and substitutions software, you can validate and/or substitute data at the time of entry in the FI-SL System and other SAP Systems.
    Implementation Considerations
    You do not need to change the standard system to customize your validations and substitutions. For each installation, you can define exactly which validations and substitutions are necessary to ensure the integrity of your data.
    Features
    Validation
    In the SAP System, almost all input values are validated by a program or against tables or master files. Since some types of validations cannot be standardized, you can use FI-SL's validations program to create validations for your system.
    With validations, you can check values and combinations of values as they are being entered in the SAP environment. Validation rules are stored in the Rule Manager; as data is entered, the Integration Manager validates the data against the validation rules stored in the Rule Manager. Because data is validated before it is posted, only valid information enters the FI-SL System.
    You define validation rules using Boolean logic. When you define a validation rule, the system checks the validation rule to ensure that it is syntactically correct.
    You can also define the result of breaking the validation rule. For instance, you can specify that a message is issued but the user can continue processing. You can also force the user to correct the error before processing can continue.
    For more information, see Validation or What Are Validations?. For more information on using validations, see Creating a Validation. For more information on Boolean Logic, see Introduction to Boolean Logic.
    Substitution
    Substitution rules are stored in the Rule Manager. When data is entered in the system, it is substituted by the Integration Manager. The Integration Manager calls the Rule Manager. Substitution occurs before the data is posted to the FI-SL databases.
    You define substitution rules using Boolean logic. When you define a substitution rule, the system checks the substitution rule to ensure that it is syntactically correct.
    For more information, see Substitution or What Are Substitutions?. For more information on using substitutions, see Creating a Substitution. For more information on Boolean Logic, see Introduction to Boolean Logic.
    Rules
    A rule is a Boolean expression that you can use as a condition, as a check, or in another rule. Rules enable you to refer to frequently used Boolean statements simply by specifying the rule name.
    The FI-SL Integration Manager uses Boolean logic. When you use Boolean logic and syntax, you can:
    Validate data
    Substitute data
    Select ledgers for posting
    Transfer substitution data to a rollup ledger
    Select report data
    The Rule Manager stores the Boolean rules used to analyze data. The Integration Manager calls the Rule Manager and determines whether entered data should be used. If a Boolean statement is true, an action is taken; if a statement is false, no action is taken.
    Boolean logic is used in the following FI-SL modules:
    Validation
    Substitution
    Ledger selection
    Report Writer
    Rollups
    To use Boolean Logic in one of the functions listed, you create statements that are used as formulas in the FI-SL System. For more information on using Boolean Logic, see Introduction to Boolean Logic or Boolean Logic Statements and Rules.

  • Difference between VPRS and EK01

    Hi,
    Can someone suggest me the difference between VPRS and EK01.  In which circumstances they should be used.
    Thanks
    Phani.

    Hi,
    EK01 is used to carry out costing in sales document item (item in an inquiry, quotation or an order) to find out the planned costs for this item. This is called sales order costing.
    Sales order costing can be carried out using the following methods:
    1)Product costing-Product costing calculates the cost of the sales order item on the basis of the sales order BOM
    2)Unit costing-Unit costing is used if the system cannot access a sales order BOM.
    You can copy the results of sales order costing to the SD conditions. Copying can be carried out:
    a)as a basis for pricing-If you want to use sales order costing as a basis for pricing in SD, you can use the standard SAP condition type EK01.
    b)at a statistical level-You can copy sales order costing at a statistical level, if you do not wish to determine the price on the basis of this costing, but you wish to use the costs determined to calculate the profit margin in SD. EK02 is the condition type provided for this in the standard system.
    VPRS is used, you may want to compare the prices with costs or even implement contribution margin accounting.
    The condition type VPRS goes into the valuation segment in the material master and determines from this the standard price or average price.
    a)The condition type VPRS is labeled as a statistical condition in the pricing procedure.
    b)Using the condition category G, the condition type VPRS goes into the valuation segment of the material master and determines from here the standard or average price.
    c)The condition category S always accesses the standard price whereas condition category T always accesses the average price.
    d)The profit margin is determined using the calculation formula 11 assigned in the pricing procedure. In this calculation formula the cost price is subtracted from the subtotal of net value 2.
    Regds.........
    Sumit

  • What is the difference between VK11 and VK31?

    What is the difference between VK11 and VK31?
    Thanks in Advance.
    Nazim.

    Hi,
    They are the same really. VK31 came with a later SAP release and some
    people say it is easier to use than VK11. In the end they are both used
    for condition records.
    Actually,the difference between VK11 and VK31 is that VK31,
    VK32 ONLY work for standard SAP delivered Condition Types (ex.
    PR00). If you create any customer specific Condition Type codes
    (ex. ZXXX)you can only create / maintain Condition Records for
    them using VK11, VK12.
    In VK11 you can store condition record for more than one condition
    type. This means you can have same condition record for different condition types.This feature is given to enhance the system’s performance and not to create the duplication of the work for each condition type.
    BOTH transactions allow mass entry and changes.
    Regards,
    Sophia Xavier

  • Whats the difference between ALL and FIRST  in Multi Inserting

    SQL> Drop Table Sales;
    Table dropped.
    SQL> Drop Table Accounts;
    Table dropped.
    SQL> Drop Table Research;
    Table dropped.
    SQL> Create Table Sales As Select * From Emp;
    Table created.
    SQL> Create Table Accounts As Select * From Emp;
    Table created.
    SQL> Create Table Research As Select * From Emp;
    Table created.
    SQL> Truncate Table Sales;
    Table truncated.
    SQL> Truncate Table Accounts;
    Table truncated.
    SQL> Truncate Table Research;
    Table truncated.
    SQL> Select * From Sales;
    no rows selected
    SQL> Select * From Accounts;
    no rows selected
    SQL> Select * From Research;
    no rows selected
    SQL> Insert All
      2  When Deptno=10 Then
      3  Into Sales (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
      4  When Deptno=20 Then
      5  Into Accounts (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
      6  When Deptno=30 Then
      7  Into Research (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
      8  Select * From Emp
      9  .
    SQL> /
    16 rows created.
    SQL> Select * From Sales;
        EMPNO ENAME      JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7782 CLARK      MANAGER        7839 09-JUN-81       100                  10
         7839 KING       PRESIDENT           17-NOV-81       100                  10
         7934 MILLER     CLERK          7782 23-JAN-82       100                  10
         7999 ABCDEFGH   JOB            7839 09-FEB-06       100         0        10
    4 rows selected.
    SQL> Select * From Accounts;
        EMPNO ENAME      JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7901 SMITH      CLERK          7902 17-DEC-80       100                  20
         7566 JONES      MANAGER        7839 02-APR-81       100                  20
         7788 SCOTT      ANALYST        7566 19-APR-87       100                  20
         7876 ADAMS      CLERK          7788 23-MAY-87       100                  20
         7902 FORD       ANALYST        7566 03-DEC-81       100                  20
          123                                                                     20
    6 rows selected.
    SQL> Select * From Research;
        EMPNO ENAME      JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7499 ALLEN      SALESMAN       7698 20-FEB-81       100       300        30
         7521 WARD       SALESMAN       7698 22-FEB-81       100       500        30
         7654 MARTIN     SALESMAN       7698 28-SEP-81       100      1400        30
         7698 BLAKE      MANAGER        7839 01-MAY-81       100                  30
         7844 TURNER     SALESMAN       7698 08-SEP-81       100         0        30
         7900 JAMES      MANAGER        7698 03-DEC-81       100                  30
    6 rows selected.
    SQL> Truncate Table Sales;
    Table truncated.
    SQL> Truncate Table Accounts;
    Table truncated.
    SQL> Truncate Table Research;
    Table truncated.
    SQL> Insert First
      2  When Deptno=10 Then
      3  Into Sales (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
      4  When Deptno=20 Then
      5  Into Accounts (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
      6  When Deptno=30 Then
      7  Into Research (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
      8  Select * From Emp
      9  /
    16 rows created.
    SQL> Select * From Sales;
        EMPNO ENAME      JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7782 CLARK      MANAGER        7839 09-JUN-81       100                  10
         7839 KING       PRESIDENT           17-NOV-81       100                  10
         7934 MILLER     CLERK          7782 23-JAN-82       100                  10
         7999 ABCDEFGH   JOB            7839 09-FEB-06       100         0        10
    4 rows selected.
    SQL> Select * From Accounts;
        EMPNO ENAME      JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7901 SMITH      CLERK          7902 17-DEC-80       100                  20
         7566 JONES      MANAGER        7839 02-APR-81       100                  20
         7788 SCOTT      ANALYST        7566 19-APR-87       100                  20
         7876 ADAMS      CLERK          7788 23-MAY-87       100                  20
         7902 FORD       ANALYST        7566 03-DEC-81       100                  20
          123                                                                     20
    6 rows selected.
    SQL> Select * From Research;
        EMPNO ENAME      JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7499 ALLEN      SALESMAN       7698 20-FEB-81       100       300        30
         7521 WARD       SALESMAN       7698 22-FEB-81       100       500        30
         7654 MARTIN     SALESMAN       7698 28-SEP-81       100      1400        30
         7698 BLAKE      MANAGER        7839 01-MAY-81       100                  30
         7844 TURNER     SALESMAN       7698 08-SEP-81       100         0        30
         7900 JAMES      MANAGER        7698 03-DEC-81       100                  30
    6 rows selected.Both inserting insert the same records then whats the difference between ALL and FIRST clause in multi insert DML
    Khurram Siddiqui
    [email protected]

    Hello
    From the docs:
    ALL
    If you specify ALL, then Oracle evaluates each WHEN clause regardless of the results of the evaluation of any other WHEN clause. For each WHEN clause whose condition evaluates to true, Oracle executes the corresponding INTO clause list.
    FIRST
    If you specify FIRST, then Oracle evaluates each WHEN clause in the order in which it appears in the statement. For the first WHEN clause that evaluates to true, Oracle executes the corresponding INTO clause and skips subsequent WHEN clauses for the given row.
    ELSE clause
    For a given row, if no WHEN clause evaluates to true:
    * If you have specified an ELSE clause, then Oracle executes the INTO clause list associated with the ELSE clause.
    * If you did not specify an else clause, then Oracle takes no action for that row.
    See Also:
    "Multitable Inserts: Examples"
    Restrictions on Multitable Inserts
    * You can perform multitable inserts only on tables, not on views or materialized views.
    * You cannot perform a multitable insert into a remote table.
    * You cannot specify a table collection expression when performing a multitable insert.
    * In a multitable insert, all of the insert_into_clauses cannot combine to specify more than 999 target columns.
    * Multitable inserts are not parallelized in a Real Application Clusters environment, or if any target table is index organized, or if any target table has a bitmap index defined on it.
    * Plan stability is not supported for multitable insert statements.
    * The subquery of the multitable insert statement cannot use a sequence.
    So given this the following example shows the difference:
    SQL> CREATE TABLE dt_test_insert_base as select rownum id from dba_objects where rownum <=20
      2  /
    Table created.
    SQL> CREATE TABLE dt_test_insert_1 (id number)
      2  /
    Table created.
    SQL> CREATE TABLE dt_test_insert_2 (id number)
      2  /
    Table created.
    SQL>
    SQL> INSERT ALL
      2     WHEN rownum <=15 THEN
      3             INTO dt_test_insert_1 (id)
      4     WHEN rownum >=10 THEN
      5             INTO dt_test_insert_2 (id)
      6  SELECT
      7     ID
      8  FROM
      9     dt_test_insert_base
    10  /
    26 rows created.
    SQL>
    SQL> SELECT * from dt_test_insert_1
      2  /
            ID
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
            11
            12
            13
            14
            15
    15 rows selected.
    SQL> SELECT * from dt_test_insert_2
      2  /
            ID
            10
            11
            12
            13
            14
            15
            16
            17
            18
            19
            20
    11 rows selected.
    SQL>
    SQL> TRUNCATE TABLE dt_test_insert_1
      2  /
    Table truncated.
    SQL> TRUNCATE TABLE dt_test_insert_2
      2  /
    Table truncated.
    SQL>
    SQL> INSERT FIRST
      2     WHEN rownum <=15 THEN
      3             INTO dt_test_insert_1 (id)
      4     WHEN rownum >=10 THEN --This condition is ignored until the value of id is > 15
      5             INTO dt_test_insert_2 (id)
      6  SELECT
      7     ID
      8  FROM
      9     dt_test_insert_base
    10  /
    20 rows created.
    SQL> SELECT * from dt_test_insert_1
      2  /
            ID
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
            11
            12
            13
            14
            15
    15 rows selected.
    SQL> SELECT * from dt_test_insert_2
      2  /
            ID
            16
            17
            18
            19
            20HTH
    David

Maybe you are looking for

  • Damaged Hard Drive, Can I Clone?

    I have a damaged hard drive that does everything but boot my MBP, I can use it as an external drive and it works fine.  My question is when i get my new hard drive can i boot damaged hard drive in safe mode and clone it to new hard drive or will it t

  • Item based on a formula in a custom folder

    Hi, actually I'm using Discoverer 4i and I have a problem when I create (with the administrator) an item based on a formula inside a custom folder. The item is based on the following formula : GET_THRESHOLD(Name,'XXI_SZF_SLA_Thresholds_Kormos') -- (1

  • Parameter for Multiple Selection

    Hi Experts, How I have to programming my Parameters, that I can select more than one value? Parameter: user type ..... I want to select User "Test" and User "Mike". Regards, Mike

  • HT4890 how to reload photos in the Icloud to the phone

    does anyone know how to get pics from computer to icloud?

  • SQ01 header showing double lines

    Hi all, I'm using SQ01 to create a report (in basic list). When I'm adding fields to the list, some fields are creating a second header line. How can I make it so that the header is only 1 line? Thanks,