General algorithm for cartesian product

i am looking for an algorithm to get the cartesian product from a set of sets like {{1,2,3,4},{a,b,c},{x,y,z,7,15}...} - this means in most general form.
google yields no results :-(. i think implementing it by myself is not a good idea.

dermoritz wrote:
prometheuzz is your algorithm better than n*mi n: number of sets mi: cardinality of the set i ?
can you short explain the algorithm?You can't do any better than that because for n sets: S(0), S(1), S(2) ... S(n-1) there are prod(i in [0, n), |S(i)|) elements of the caresian product. Prometeuzz algorithm generates
one at ever pass of the loop executing n steps per element. If you're afraid that the product number will be too large you can also fiddle with the indexes themselves:
// scard[i] == |S(i)|
// prod[i] == element of S(i) in product
int[] next(int[] scard, int[] prod) {
   for (int i= prod.lerngth; i-- > 0; prod= 0)
if (++prod[i] < scard[i]) return prod; // return indexes of next product
return null; // no next product anymore
}kind regards,
Jos                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to force Cartesian Product for unlineked (DBF) tables

    Hello
    We have been using CR8.5 for many years and we are just about to perform major upgrade to CR2011. I have, howverm found one strange behavior.
    Many of our reports are implemented in following way:
    MainTable.DBF (contains reported rows)
    ParamTable.DBF (contains one row with some general parameters)
    There is no data "link" between these tables but t makes sense to expect that every record from main table will see record from param table.
    in CR 8.5 Cartesian product of MainTable X ParamTable was ALWAYS available ad therefore we were able to (for example) hide the details & show only group totals, or display some header information (this can be also done by sub-report).
    in CR2011, however, this seems not to be the case anymore. Namely:
    any old report that I open in CR2011 has param line available only for the very first record and I was not able to find a way how to change it
    if I recreate the report from the scratch, sometimes Cartesian product is "provided" and sometimes not - I really do not know the reason for the decision.
    [I have one very ugly workaround: link these two tables with != (not equal operation) between two unrelated fields that can never be the same]
    Is there any "solution" to this cause as it blocks us from upgrading to the latest version?
    Kind Regards,
    Martin Fontan

    Hi Martin,
    Long story so here's the short one. As of CR 9 we completely redeveloped our database drivers and query engine. We removed all of the "hack" work arounds in our code for DB clients did not follow the rules, this forces the DB makers to fix the client engine and follow ANSII 92 standards. You also can no longer edit the SQL statement.
    We have also never supported unlinked tables, CR is a Relational database reporting tool. Us a subreport if you must use an unlinked table, or as you have discovered using a != type.
    Other work around is to use a Command, it' sin the Database wizard, write your own SQL, we simply pass it to the client. There is no option directly to set location from a Table to a SQL Command but search here, Brian Dong found a way around this limitation using a CR Wizard.
    Thanks
    Don

  • General Reports for Production planning

    Dear all,
    Can you please explain me what are the reports generally important for production planning module.
    How to generate a reports?
    If possible,please explain with an example by showing some screen shots.
    Regards
    Rajasekaran

    Hi Raja,
    Did you search in Forum? Please search.
    COOIS -Order Information System is the important report for PP module. In COOIS Under List there are different option to see order details, operation details, confirmation details, Error details, component details and Object Overview where you can see order, operation and component details.
    CO24 -Missing Parts
    MB24 -Reservation List
    SAP Standard PP Reports
    Thanks & Regards,
    Ramagiri

  • Unable to display the pricing conditions for a product.

    Hi All,
        I have created a product with help of function modules.The problem is that i am able to populate the pricing conditions data into internal table,but the pricing conditions  is not being displayed in the Masterdata->Products-> Maintain Products screen. Can anyone suggest me in this regards.Is there any function module to be used? or any other procedure to be followed for the pricing conditions to be dispalyed? If any sample code also please provide me.Please respond soon it is an Urgent Requirement. Points will be awarded for useful answers.
    Thanks in Advance,
    Shwetha.

    Hi,
    The pricing in SD and MM is a separate module like thing and is maintained for different products based on the Condition records.
    The basic Pricing Procedure consists of Condition  Types, Condition Records, Accesss Sequences and condition tables.
    Generally with respect to all sales and purchase documents the pricing is maintained in KONV  and KONP tables based on the different condition types.
    reward points if useful
    regards,
    ANJI

  • The trial period for this product has expired or Secure Store Shared Service is not supported for this SKU - SharePoint Foundation 2013

    After sucessfulling installing the SharePoint Foundation 2013, when i try to access the Secure Stored Service Application i get the below error
    11/16/2012 18:13:02.84  w3wp.exe (0x1774)                        0x15E8 Secure Store Service         
     Secure Store                   g0n6 High     The trial period for this product has expired or this feature is not supported in this SKU. b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84  w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     General                        8nca Medium   Application error when access /_admin/sssvc/ManageSSSvcApplication.aspx, Error=The
    trial period for this product has expired or Secure Store Shared Service is not supported for this SKU.   at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.Execute[T](String operationName, Boolean validateCanary, ExecuteDelegate`1
    operation)     at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.IsMasterSecretKeyPopulated()     at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.SSSAdminHelper.EnsurePrerequisite(SecureStoreServiceApplicationProxy
    proxy, String& errorMessage)     at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.ManageSSSvcApplication.InitializeGridView()     at Microsoft.Office.SharePoi... b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84* w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     General                        8nca Medium   ...nt.ClientExtensions.SecureStoreAdministration.ManageSSSvcApplication.OnLoad(EventArgs
    e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84  w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     Runtime                        tkau Unexpected Microsoft.Office.Server.ProductExpiredException: The trial period for this product
    has expired or Secure Store Shared Service is not supported for this SKU.    at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.Execute[T](String operationName, Boolean validateCanary, ExecuteDelegate`1 operation)    
    at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.IsMasterSecretKeyPopulated()     at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.SSSAdminHelper.EnsurePrerequisite(SecureStoreServiceApplicationProxy
    proxy, String& errorMessage)     at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.ManageSSSvcApplication.InitializeGridView()     at Microsoft.Office.SharePoint.ClientExtensions.SecureSto... b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84* w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     Runtime                        tkau Unexpected ...reAdministration.ManageSSSvcApplication.OnLoad(EventArgs e)    
    at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84  w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     General                        ajlz0 High     Getting Error Message for Exception System.Web.HttpUnhandledException
    (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.Office.Server.ProductExpiredException: The trial period for this product has expired or Secure Store Shared Service is not supported for this SKU.    
    at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.Execute[T](String operationName, Boolean validateCanary, ExecuteDelegate`1 operation)     at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.IsMasterSecretKeyPopulated()    
    at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.SSSAdminHelper.EnsurePrerequisite(SecureStoreServiceApplicationProxy proxy, String& errorMessage)     at Microsoft.Office.Sha... b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84* w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     General                        ajlz0 High     ...rePoint.ClientExtensions.SecureStoreAdministration.ManageSSSvcApplication.InitializeGridView()    
    at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.ManageSSSvcApplication.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
    Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)    
    at System.Web.Htt... b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.84* w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     General                        ajlz0 High     ...pApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) b3b6e19b-7de2-e016-ad32-0fc975829ef0
    11/16/2012 18:13:02.86  w3wp.exe (0x1774)                        0x15E8 SharePoint Foundation        
     General                        aat87 Monitorable   b3b6e19b-7de2-e016-ad32-0fc975829ef0
    Is it a bug or any issue in configuration?
    Raghavendra Shanbhag | Blog: http://moss-solutions.blogspot.com
    Please click "Propose As Answer " if a post solves your problem or "Vote As Helpful" if a post has been useful to you.
    Disclaimer: This posting is provided "AS IS" with no warranties.

    Hello
    something should be related wuith this service, take a llok at my visual studio output whne I try to deplay and autohosted sharepoint app: (anyone can help)
    1>------ Build started: Project: MySharePointAppWeb, Configuration: Debug Any CPU ------
    1>  MySharePointAppWeb -> C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\bin\MySharePointAppWeb.dll
    2>------ Build started: Project: MySharePointApp, Configuration: Debug Any CPU ------
    2>C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\Web.Debug.config(34,4): warning : No element in the source document matches '/configuration/connectionStrings'
    2>  Transformed Web.config using C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config.
    2>  Auto ConnectionString Transformed obj\Debug\TransformWebConfig\transformed\Web.config into obj\Debug\CSAutoParameterize\transformed\Web.config.
    2>  Copying all files to temporary location below for package/publish:
    2>  obj\Debug\Package\PackageTmp.
    2>  Packaging into C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointApp\obj\WebDeploy\MySharePointApp.Web.zip.
    2>  Adding sitemanifest (sitemanifest).
    2>  Adding IIS Application (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp)
    2>  Creating application (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp)
    2>  Adding virtual path (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp)
    2>  Adding directory (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp).
    2>  Adding directory (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin).
    2>  Adding directory (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\en).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\en\Microsoft.IdentityModel.resources.dll).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\Microsoft.IdentityModel.dll).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\Microsoft.IdentityModel.Extensions.dll).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\Microsoft.SharePoint.Client.dll).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\Microsoft.SharePoint.Client.Runtime.dll).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\MySharePointAppWeb.dll).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\bin\MySharePointAppWeb.pdb).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\packages.config).
    2>  Adding directory (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Pages).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Pages\Default.aspx).
    2>  Adding directory (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Scripts).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Scripts\jquery-1.7.1.js).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Scripts\jquery-1.7.1.min.js).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Scripts\_references.js).
    2>  Adding file (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp\Web.config).
    2>  Adding ACL's for path (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp)
    2>  Adding ACL's for path (C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointAppWeb\obj\Debug\Package\PackageTmp)
    2>  Adding declared parameter 'IIS Web Application Name'.
    2>  Package "MySharePointApp.Web.zip" is successfully created as single file at the following location:
    2>  file:///C:/_works/visual%20studio%202012/Projects/MySharePointApp/MySharePointApp/obj/WebDeploy
    2>  To get the instructions on how to deploy the web package please visit the following link:
    2>  http://go.microsoft.com/fwlink/?LinkId=124618
    2>  Sample script for deploying this package is generated at the following location:
    2>  C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointApp\obj\WebDeploy\MySharePointApp.Web.deploy.cmd
    2>  For this sample script, you can change the deploy parameters by changing the following file:
    2>  C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointApp\obj\WebDeploy\MySharePointApp.Web.SetParameters.xml
    2>  Successfully created package at: C:\_works\visual studio 2012\Projects\MySharePointApp\MySharePointApp\bin\Debug\app.publish\1.0.0.0\MySharePointApp.app
    3>------ Deploy started: Project: MySharePointApp, Configuration: Debug Any CPU ------
    3>Active Deployment Configuration: Deploy App for SharePoint
    3>Uninstall app for SharePoint:
    3>  Skipping the uninstall step because the app for SharePoint is not installed on the server.
    3>Install app for SharePoint:
    3>  Uploading the app for SharePoint...
    3>  Creating a trusted root authority in SharePoint for IIS Express.
    3>  Installation is in progress (00:00:00)
    3>  Installation is in progress (00:00:01)
    3>  Installation is in progress (00:00:02)
    3>  Installation is in progress (00:00:03)
    3>  Installation is in progress (00:00:05)
    3>  Installation is in progress (00:00:06)
    3>  App failed to install, cleaning up...
    3>  App installation cleanup failed due to errors.  Please see the app on the SharePoint site’s “Site Contents” page for details.
    3>  App installation encountered the following errors:
    3> 
    3>  @"Error 1
    3>        CorrelationId: ceeeafab-3834-40ea-b360-c29d103e2248
    3>        ErrorDetail: The remote hosting service is not configured.
    3>        ErrorType: Configuration
    3>        ErrorTypeName: Configuration
    3>        ExceptionMessage: The trial period for this product has expired or Secure Store Shared Service is not supported for this SKU.
    3>        Source: RemoteWebSite
    3>        SourceName: Remote Web Site Deployment
    3> 
    3>  @"Error 2
    3>        CorrelationId: ceeeafab-3834-40ea-b360-c29d103e2248
    3>        ErrorDetail: The remote hosting service is not configured.
    3>        ErrorType: Configuration
    3>        ErrorTypeName: Configuration
    3>        ExceptionMessage: The trial period for this product has expired or Secure Store Shared Service is not supported for this SKU.
    3>        Source: RemoteWebSite
    3>        SourceName: Remote Web Site Deployment
    3>Error occurred in deployment step 'Install app for SharePoint': Failed to install app for SharePoint. Please see the output window for details.
    ========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

  • Urgent plz help me out about cartesian product

    plz...its urgent,can anyone help in the following query where iam getting cartesian product,so how to get result without cartesian product
    this is the query
    SELECT DISTINCT MIS.segment1 "ITEM CODE",
    MIS.DESCRIPTION "DESCRIP"
    ,MIS.Primary_uom_code "UOM",
    MTL.LOT_NUMBER "LOT NUMBER"
    ,A.PARTY_NUMBER "CUSTOMER NUMBER",
    A.PARTY_NAME "CUSTOMER NAME",
    (A.ADDRESS1||A.ADDRESS2||A.ADDRESS3||A.ADDRESS4) "SHIP TO",
    B.DELIVERY_DETAIL_ID "DO NO",B.SHIPPED_QUANTITY "SHIPPED QUANTITY"
    ,C.ULTIMATE_DROPOFF_DATE "ISSUED DATE"
    ,D.ORDER_NUMBER "SALES ORDER NUMBER"
    ,E.LINE_NUMBER "SALES ORDER LINE"
    FROM MTL_SYSTEM_ITEMS MIS
    ,MTL_TRANSACTION_LOT_NUMBERS MTL
    ,HZ_PARTIES A,
    WSH_DELIVERY_DETAILS B,
    WSH_NEW_DELIVERIES C,
    OE_ORDER_HEADERS_ALL D,
    OE_ORDER_LINES_ALL E
    WHERE MIS.INVENTORY_ITEM_ID=MTL.INVENTORY_ITEM_ID
    AND B.INVENTORY_ITEM_ID=MIS.INVENTORY_ITEM_ID
    AND A.PARTY_ID=B.CUSTOMER_ID
    AND B.DELIVERY_DETAIL_ID=C.DELIVERY_ID
    AND MIS.INVENTORY_ITEM_ID=E.INVENTORY_ITEM_ID
    AND D.HEADER_ID=E.HEADER_ID

    A lot of times when I get duplicate results, I'll do a select * and see why. Often one of those tables will have a sequenced value that could repeat several times for a combination of values.
    If thats the case, you may need to add something like:
    ...and a.id = (select min(id)
                     from b
                    where a.col = b.col)

  • My serial number is "not valid for subscription products", but of course it should be. how do I fix that?

    my serial number is "not valid for subscription products", but of course it should be. how do I fix that?

    Hello,
    general informations you will find there: https://www.adobe.com/account.html and this brandnew website:  Serial number and activation support.
    In case you bought your program from these firms like Amazon this "serial number" obtained from them is not a serial number, only a code with which you can request a serial number from Adobe.
    The following part, so I just see at least ceased to exist on my Adobe website, everything plays out in the link from above. I let it there as an info:
    Here you have to go through your "Adobe Store", and look for the button "Serial Number Request". Fill in the form and, after a while you will get a "real" serial number.
    Hans-Günter

  • Query having cartesian product

    hi
    i have the following query
    select f.item_number, case when f.item_number='1020101002' then f.calc_cement_sk else f.calc_amount end act
                from XXNP_OPN_JOBLOG_EST_002 F WHERE f.OPN_JOBLOG_001_ID ='6369'
    output
    ITEM_NUMBER     ACT
    1020101001     NULL
    1020111001     NULL
    1020112001     NULL
    1020113004     NULL
    1020101002     494
    1020102007     232
    1020103004     37
    1020104004     557
    1020106002     20896
    1020111001     5
    1020112005     16253
    1020112008     46
    1020113004     40
    1020222010     1393
    ie 14 rows
    another query
    SELECT J.ITEM_NUMBER,j.opn_value  FROM XXNP_OPN_JOBLOG_RES_005 J  WHERE  J.OPN_JOBLOG_001_ID ='6369' 
    output
    ITEM_NUMBER     OPN_VALUE
    1010101003     1
    1010101004     3
    1010101005     2
    1010104016     1
    1010103001     76
    1010103002     228
    1010106001     2
    1010106006     147
    1010107010     1
    1010109009     1
    1010107015     866
    1010107014     799
    1010107016     1631
    ie 13 rows
    when i do
    select f.item_number, case when f.item_number='1020101002' then f.calc_cement_sk else f.calc_amount end act ,j.opn_value
           from XXNP_OPN_JOBLOG_EST_002 F ,XXNP_OPN_JOBLOG_RES_005 J   where   f.OPN_JOBLOG_001_ID = J.OPN_JOBLOG_001_ID and f.OPN_JOBLOG_001_ID ='6369'
    i get 182 rows :( i know its due to cartesian product
    is there any way i can get 27 rows  only ,can i get the output in the format given below
    ITEM_NUMBER     ACT                  opn_value
    1020101001     NULL
    1020111001     NULL
    1020112001     NULL
    1020113004     NULL
    1020101002     494
    1020102007     232
    1020103004     37
    1020104004     557
    1020106002     20896
    1020111001     5
    1020112005     16253
    1020112008     46
    1020113004     40
    1020222010     1393
    1010101003                                                                     1                                                    
    1010101004                                                                     3                                                              
    1010101005                                                                      2
    1010104016                                                                      1
    1010103001                                                                     76
    1010103002                                                                      228
    1010106001                                                                      2
    1010106006                                                                     147
    1010107010                                                                      1
    1010109009                                                                        1
    1010107015                                                                      866
    1010107014                                                                      791
    1010107016                                                                    1631kindly guide
    thanking in advance
    Edited by: makdutakdu on Mar 31, 2011 8:03 AM

    hi
    script for XXNP_OPN_JOBLOG_RES_005
    CREATE TABLE XXNP_OPN_JOBLOG_RES_005
      OPN_JOBLOG_005_ID  NUMBER,
      OPN_JOBLOG_001_ID  NUMBER,
      WIP_ENTITY_ID      NUMBER,
      WIP_ENTITY_NAME    VARCHAR2(240 BYTE),
      OPN_RESOURCE_CODE  VARCHAR2(30 BYTE),
      OPN_UOM_CODE       VARCHAR2(30 BYTE),
      OPN_VALUE          NUMBER,
      OPN_MOV_DATE       DATE,
      ORG_ID             NUMBER(15),
      CREATION_DATE      DATE,
      CREATED_BY         NUMBER(15),
      LAST_UPDATE_DATE   DATE,
      LAST_UPDATED_BY    NUMBER(15),
      LAST_UPDATE_LOGIN  NUMBER(15),
      OPN_RESOURCE_DESC  VARCHAR2(500 BYTE),
      ITEM_PRICE         NUMBER,
      ITEM_NUMBER        NUMBER(10),
      DIS_PER            NUMBER(3),
      EST_VALUE          NUMBER(15,3),
      VAL_ESTAB          NUMBER(15,3)
    script for XXNP_OPN_JOBLOG_EST_002
    CREATE TABLE XXNP_OPN_JOBLOG_EST_002
      OPN_JOBLOG_002_ID   NUMBER,
      OPN_JOBLOG_007_ID   NUMBER,
      INVENTORY_ITEM_ID   NUMBER,
      ITEM_NUMBER         VARCHAR2(20 BYTE),
      ITEM_NAME           VARCHAR2(40 BYTE),
      ITEM_UOM            VARCHAR2(30 BYTE),
      ITEM_VALUE          NUMBER,
      ITEM_PERCENT        NUMBER,
      OPN_AMOUNT          NUMBER,
      ITEM_CEMENT_SK      NUMBER,
      ORG_ID              NUMBER(15),
      CREATION_DATE       DATE,
      CREATED_BY          NUMBER(15),
      LAST_UPDATE_DATE    DATE,
      LAST_UPDATED_BY     NUMBER(15),
      LAST_UPDATE_LOGIN   NUMBER(15),
      OPN_JOBLOG_001_ID   NUMBER,
      OPN_JOBLOG_006_ID   NUMBER,
      ITEM_REF            NUMBER,
      DESCRIPTION         VARCHAR2(500 BYTE),
      CALC_AMOUNT         NUMBER,
      CALC_CEMENT_SK      NUMBER,
      )

  • Cartesian Product from in-line queries

    I have the following query:
    SELECT AUDIT_MONTH, AUDITS, DEFECTS
    FROM
    select distinct(to_char(AUDIT_DATE,'MM/YY')) as AUDIT_MONTH
    from v_safety_audit_records
    select count(distinct(AUDIT_ID)) AUDITS
    from v_safety_audit_records
    group by to_char(AUDIT_DATE,'MM/YY')
    select count(KEY_ID) DEFECTS
    from v_safety_audit_records
    where SUBAREA_ID NOT LIKE '_98'
    and SUBAREA_ID NOT LIKE '_99'
    group by to_char(AUDIT_DATE,'MM/YY')
    but it keeps giving me a cartesian product. Is there a way to re-write this so that I only get the month, the number of audits, and number of defects on a line rather than number of months x number of months worth of lines? I can't seem to get the join conditions worked out... I can re-write this all using views, but as it is for a single report, I'd rather not bother with more views if I can avoid it.
    Thanks in advance.

    The problem is that the query doesn't return a single row and isn't meant to. I tried:
    SELECT
    select distinct(to_char(AUDIT_DATE,'MM/YY'))
    from v_safety_audit_records
    group by to_char(AUDIT_DATE,'MM/YY')
    ) AUDIT_MONTH,
    select count(distinct(AUDIT_ID))
    from v_safety_audit_records
    group by to_char(AUDIT_DATE,'MM/YY')
    ) AUDITS,
    select count(KEY_ID)
    from v_safety_audit_records
    where SUBAREA_ID NOT LIKE '_98'
    and SUBAREA_ID NOT LIKE '_99'
    group by to_char(AUDIT_DATE,'MM/YY')
    ) DEFECTS
    FROM DUAL;
    and got "ORA-01427: single-row subquery returns more than one row". It would be a good idea if I only needed it for one month, however.

  • Cartesian Product in Select

        Hi all!
    I need help.
    I have this function that launches a Select. My Oracle Grid tells me, when I tune the Select of this function, that there is a Cartesian Product. I understand what a Cartesian Product is, but I fail to find it. Can you help me by pointing out WHERE is the misteke? Thank you!!
    P.s. Oracle EE 10.2.0.4 on windows Server 2003 R2 SP2 64Bit
    [code]
    create or replace
    FUNCTION          "ANA_GETVERBALE"
      v_VerbaleId      IN NUMBER DEFAULT NULL,
      v_Sezione        IN VARCHAR2 DEFAULT NULL,
      v_NumeroVerbale  IN VARCHAR2 DEFAULT NULL,
      v_DataVerbale    IN DATE DEFAULT NULL,
      v_TargaVeicolo   IN VARCHAR2 DEFAULT NULL,
      v_Serie          IN VARCHAR2 DEFAULT NULL,
      v_LoggedUser IN VARCHAR2 DEFAULT NULL
    RETURN SYS_REFCURSOR
    AS
       cv_1 SYS_REFCURSOR;
    BEGIN
      OPEN cv_1 FOR
        SELECT
          ANA_M.VerbaleId,
          ANA_M.Sezione,
          ANA_M.NumeroVerbale,
          ANA_M.DataVerbale,
          ANA_M.TargaVeicolo,
          ANA_M.Serie,
          SCH_C.StatoCartellinoId,
          LOV_StatoCartellino.ListOfValueName StatoCartellino,
          sch_c.cartellinoid
        FROM ANA_Materia_Verbale ANA_M
        INNER JOIN SCH_Cartellini SCH_C ON SCH_C.SoggettoId=ana_m.verbaleid AND SCH_C.TipoSoggettoId = SIS_CONSTANTS_PKG.VB
        INNER JOIN SIC_PROFILO_STATO SIC_PSC ON SIC_PSC.STATOID=SCH_C.STATOCARTELLINOID
        INNER JOIN SIC_PROFILI_USERS SIC_PUC ON SIC_PUC.PROFILOID=SIC_PSC.PROFILOID AND SIC_PUC.PERSONALID=v_LoggedUser
        LEFT JOIN TYP_ListOfValues LOV_StatoCartellino  ON LOV_StatoCartellino.ListOfValueId = SCH_C.StatoCartellinoId
        WHERE ( v_VerbaleId = SIS_CONSTANTS_PKG.AnyBigint OR ANA_M.VerbaleId = v_VerbaleId )
          AND ( v_Sezione = SIS_CONSTANTS_PKG.AnyString OR REGEXP_LIKE(ANA_M.Sezione, '^' || v_Sezione || '$', 'i') )
          AND ( v_serie = SIS_CONSTANTS_PKG.AnyString OR REGEXP_LIKE(ANA_M.Serie, '^' || v_Serie || '$', 'i') )
          AND ( v_NumeroVerbale = SIS_CONSTANTS_PKG.AnyString OR ANA_M.NumeroVerbale = v_NumeroVerbale )
          AND ( v_DataVerbale = SIS_CONSTANTS_PKG.AnyDateTime OR ANA_M.DataVerbale = v_DataVerbale )
          AND ( v_TargaVeicolo = SIS_CONSTANTS_PKG.AnyString OR REGEXP_LIKE(ANA_M.TargaVeicolo,'^' || v_TargaVeicolo || '$', 'i') );
      RETURN cv_1;
    END;
    [/code]

    ....ouch... well that explains a LOT!! The real problem was the Oracle Grid SQL_TUNING that warned me that the SELECT contained a CARTESIAN PRODUCT:
    Ristruttura SQL
    An expensive cartesian product operation was found at line ID 4 of the execution plan.
    Consider removing the disconnected table or view from this statement or add a join condition which refers to it.
    A cartesian product should be avoided whenever possible because it is an expensive operation and might produce a large amount of data.
    with this EXECUTION PLAN:
    Operazione
    ID riga
    Oggetto
    Object type
    Ordine
    Righe
    Dimensione (KB)
    Costo
    Tempo (sec)
    Costo CPU
    Costo I/O
    SELECT STATEMENT
    0
    13
    1
    0,091
    460
    6
    116.852.560
    452
    NESTED LOOPS OUTER
    1
    12
    1
    0,091
    460
    6
    116.852.560
    452
    NESTED LOOPS
    2
    9
    1
    0,079
    459
    6
    116.843.328
    451
    NESTED LOOPS
    3
    7
    2
    0,141
    457
    6
    116.826.984
    449
    MERGE JOIN CARTESIAN
    4
    4
    2
    0,102
    451
    6
    116.781.136
    443
    INDEX FAST FULL SCAN
    5
    DOCARK.PK_SIC_PROFILI_USERS
    INDEX (UNIQUE)
    1
    1
    0,010
    2
    1
    81.903
    2
    BUFFER SORT
    6
    3
    2
    0,082
    449
    6
    116.699.232
    441
    TABLE ACCESS FULL
    7
    DOCARK.ANA_MATERIA_VERBALE
    TABLE
    2
    2
    0,082
    449
    6
    116.699.232
    441
    TABLE ACCESS BY INDEX ROWID
    8
    DOCARK.SCH_CARTELLINI
    TABLE
    6
    1
    0,020
    3
    1
    22.924
    3
    INDEX RANGE SCAN
    9
    DOCARK.IDX_SCH_CARTELLINI_SOG_TIPO
    INDEX
    5
    1
    2
    1
    15.493
    2
    INDEX RANGE SCAN
    10
    DOCARK.PK_SIC_PROFILO_STATO
    INDEX (UNIQUE)
    8
    1
    0,009
    1
    1
    8.171
    1
    TABLE ACCESS BY INDEX ROWID
    11
    DOCARK.TYP_LISTOFVALUES
    TABLE
    11
    1
    0,012
    1
    1
    9.231
    1
    INDEX UNIQUE SCAN
    12
    DOCARK.PK_TYP_LISTOFVALUES
    INDEX (UNIQUE)
    10
    1
    0
    1
    1.900
    0
    So I started trying to REMOVE the Cartesian Product. But first I had to find it! So apparently I shouldn't worry too much...
    The real problem is that I have to work with funtions and DBs created by others, so I am not sure what to expect from most of the Functions. Apparently this execution is correct no matter what that the Tunig Advisor says!
    Thanks!

  • Joining DB VIEW and Command result in cartesian product

    hello,
    My SQL query is joining a DB view and a Command(=ad hoc query).
    Nonetheless from the results it appears that CR didn't join the views correctly, it returns a cartesian product.
    Any idea what the issue could be, I'm using very simple queries.
    Thanks in advance

    #1  make sure you are linking everything together properly in the "Links" tab of the Database Expert
    #2  In my experience, it's just a bad idea to join SQL commands and other tables.  I had poor performance issues in my case.  (It prevents server side filtering and grouping)  My suggestion is to write out the entire thing in the command.  If you are pulling from multiple database, write a separate command for each database and link them.

  • Cartesian product (sum function on 2 tables)

    Dear all,
    I have 2 tables with columns student_no (foreign key), date and amount in both tables.
    now I want to select the sum of the amount for a student for specific date.
    the following query is from stu_fee_payment table.
    select sum(sfp.amount)
    from stu_fee_payment sfp
    where student_no =1
    and sfp.pay_date < TO_DATE('01-AUG-2010','DD-MON-YYYY')
    result: 200
    the following query is from stu_fee_adjustment table.
    select sum(sfa.adj_amount)
    from stu_fee_adjustment sfa
    where student_no =1
    and sfa.adj_date < TO_DATE('01-AUG-2010','DD-MON-YYYY')
    result: 400
    now I have the following query
    select sum(sfp.amount), sum(sfa.adj_amount)
    from stu_fee_payment sfp, stu_fee_adjustment sfa
    where sfp.student_no = sfa.student_no
    and sfp.student_no =1
    and sfp.pay_date < TO_DATE('01-AUG-2010','DD-MON-YYYY')
    and sfa.adj_date < TO_DATE('01-AUG-2010','DD-MON-YYYY')
    result: 400 400
    its some kind of cartesian product because the two tables have no primary foreign key relationship.
    how to solve the problem?
    Regards:
    MN
    Edited by: Muhammad Nadeem on Aug 22, 2010 11:55 PM
    Edited by: Muhammad Nadeem on Aug 23, 2010 12:58 AM

    Hi Nadeem,
    Try this one
    SELECT sfp_sno,sfp_amount,sfa_amount
    FROM
    SELECT sfp.student_no sfp_sno, SUM(sfp.amount) sfp_amount
    FROM stu_fee_payment sfp
    WHERE sfp.pay_date < TO_DATE('01-AUG-2010','DD-MON-YYYY')
    GROUP BY sfp.student_no
    ) x,
    SELECT sfa.student_no sfa_sno, SUM(sfa.adj_amount) sfa_amount
    FROM stu_fee_adjustment sfa
    WHERE sfa.adj_date < TO_DATE('01-AUG-2010','DD-MON-YYYY')
    GROUP BY sfa.student_no
    )y
    WHERE sfp_sno = sfp_no(+) Regards,
    Sreekanth Munagala.

  • About cartesian product

    hello!!
    I write to you in order to ask you some information about the cartesian product of n sets. The all n sets are equivalent; everyone contain matriz nxm.
    Please help me! Can I use array of array or Set?
    How can I do it! Some reference?
    Thanks.. grazie!

    chongo,
    To begin with, it looks like your sets have binary strings as elemens, so (unless your binary strings are ever longer than 16 bits) you can use one integer to represent each element. For instance, the element 01101 is equivalent to 0000000000001101, which is 13 in base two, so it will be a 13 in the set. (All I'm saying is, you don't need to use a string representation.)
    The sets themselves are probably most easily stored as arrays of ints. This gives us a notion of order that might be useful for calculating the cartesian product, and is quick and easy to implement.
    For the product, I would not even bother calculating the whole thing at once unless you need acces to all of its elements more than a few times. If you represent your existing sets by arrays, you have constant-time random access to the elements in a definite order, so you could just write a method that returns specific elements of the Cartesian product. This will effectively give you access to elements in the Cartesian product in O(n) time. For an example of such a method (check this code before using it):
    public static int[] getCartesianElement(int[][] sets, int[] coordinates) {
        if (sets.length != coordinates.length)
            throw new IllegalArgumentException("lengths do not match");
        int[] element = new int[sets.length];
        for (int i = 0; i < sets.length; i++)
            element[i] = sets[i][coordinates];
        return element;
    }or, if you know you're using only one set in the product,
    public static int[] getCartesianElement(int[] set, int[] coordinates) {
        int[] element = new int[coordinates.length];
        for (int i = 0; i < coordintates.length; i++)
            element[i] = set[coordinates];
        return element;
    }I used the name "coordinates" for the int[] specifying which element we want because you can think of the elements of the product as occupying points in n-space, with the coordinates resulting form the handy ordering imposed by the array representation. In the second method, the number of operands is implicit in the length of coordinates.
    If you really want to generate the whole product, the code above could be easily adapted.

  • Using iBooks Bookstore for (free) product catalogues

    Hi all
    Does anyone know if there are any restrictions/exclusions for creating 'brochure/catalogue' books in iBooks Author and submitting to the Bookstore for free download? I have looked through the guidelines and cannot find anything that specifically says no or looks like it would be an issue but would rather not spend to much time with our client creating content for it to be refused!
    Thanks in advance
    Kind regards
    Craig

    vinnyvg wrote:
    However, having produced your file to free distribute as above.. then why not submit it. If Apple have any issues  your choice is deal with them or dump it.  It also depends on your payment terms - if you charge by the hour.. your client could rack up a lot of added expense incurred  by your time  de-snagging file issues and re-submitting.
    The question is where to draw the line. While it's nice of Apple to accept free books, I'm sure they don't see themselves as a general repository for whatever information someone might want to make available, such as product catalogs.
    Somehow, Apple have to make a decision as to what should be accepted into the store what should not. I suspect that things such as product catalogs probably wouldn't make it into the store. Too close to advertising, for one, and probably not of interest to the general public. Basically, if you can see a normal book store putting your publication on the shelf, then you have something that potentially would be appropriate for the iBookstore. If you don't think a paper book store would put the catalog on the shelf, I suspect Apple won't either.
    Michi.

  • When I try to launch my copy of PSE it tells me that licensing for this product has stopped working. Error code 150:30. Restarting does nothing. Thanks!

    When I try to launch my copy of PSE it tells me that licensing for this product has stopped working. Error code 150:30. Restarting does nothing. Any ideas?
    Thanks!

    You haven't said what version of PSE you are using but the general solution to this problem is to re-install the product from your original disks.  Have you got the disks for your product and the related serial number?

Maybe you are looking for

  • Adding column is taking much time. How to avoid?

    ALTER TABLE CONTACT_DETAIL ADD (ISIMDSCONTACT_F NUMBER(1) DEFAULT 0 NOT NULL ,ISREACHCONTACT_F NUMBER(1) DEFAULT 0 NOT NULL Is there any way that to speed up the execution time of the query? It's more than 24 hrs completed after started running the a

  • ERROR in Invoice posting  from XI to SRM in MM-SUS plan driven procurement

    Hi       We are implementing MM-SUS plan driven procurement scenario. MM version is 4.7. we are using Z-Program to trigger Invoice i-doc from MM to XI. its reaching XI but from XI to SRM there is some error. the error is DYNAMIC_CALL_FAILURE Function

  • Need a drop down for a selection screen

    HI all, I need a drop down for a selection screen. say for eg: Field is MARA-MTART   (Material Type). The selection is optional and the dropdown should be using check table: T134 How to get a dropdown? I think a function module is used , but I dont r

  • Can only read RANDOM

    new problem on my pc . unable to switch RANDOM reading to continuoous reading. as soon as i click a loop for alternate reading mode i get a pop-up telling me i'm about to delete such nbr of songs that were previously added to that list. Ipad is ok. i

  • Error synchronizing text index in oracle 10g

    Hi, I am getting errors while trying to synchronize the text index on a xmltype table. SQL> exec ctx_ddl.sync_index('CTX_INDEX'); BEGIN ctx_ddl.sync_index('CTX_INDEX'); END; ERROR at line 1: ORA-20000: Oracle Text error: DRG-50857: oracle error in dr