How complete a undesirable static dimension made of N Boolean flags

Hi, we want to fill a junk dimension (a table with Boolean fields N - 18, in our case).
Records must contain all possible combinations of all the fields (with 18 fields of integer type whose value can be 0 or 1, the number of possible combinations is 262144).
I'm looking for suggestions on how to do (with a single SQL statement or a cursor in a procedure, they are both very well).

Thank you
Andrea

You can use the Cartesians/joins products to get the result. Here is an example:

SQL> WITH boolean_flags AS
  2  (
  3          SELECT  0 AS FLG FROM DUAL UNION ALL
  4          SELECT  1 AS FLG FROM DUAL
  5  )
  6  SELECT  A.FLG
  7  ,       B.FLG
  8  ,       C.FLG
  9  FROM    BOOLEAN_FLAGS   A
 10  ,       BOOLEAN_FLAGS   B
 11  ,       BOOLEAN_FLAGS   C
 12  /

       FLG        FLG        FLG
---------- ---------- ----------
         0          0          0
         0          0          1
         0          1          0
         0          1          1
         1          0          0
         1          0          1
         1          1          0
         1          1          1

If you need it to be more dynamic, you can generate SQL code dynamically as shown below. This example would work for the number of columns ranging from 1-26 (I have heavy test):

SQL> VAR c REFCURSOR;
SQL>
SQL> DECLARE
  2          numDimensions   NUMBER  := 3;
  3          sqlText         VARCHAR2(4000) :='WITH boolean_flags AS
  4                                          (
  5                                                  SELECT  0 AS FLG FROM DUAL UNION ALL
  6                                                  SELECT  1 AS FLG FROM DUAL
  7                                          )
  8                                          SELECT A.FLG ';
  9          sqlFromText     VARCHAR2(4000) :='FROM BOOLEAN_FLAGS    A';
 10  BEGIN
 11          FOR i IN 2..numDimensions
 12          LOOP
 13                  sqlText := sqlText || ', ' || CHR(64+i) || '.FLG ';
 14
 15                  sqlFromText := sqlFromText || ', BOOLEAN_FLAGS ' || CHR(64+i);
 16          END LOOP;
 17
 18          OPEN :c FOR sqlText || sqlFromText;
 19  END;
 20  /

PL/SQL procedure successfully completed.

SQL> PRINT C

       FLG        FLG        FLG
---------- ---------- ----------
         0          0          0
         0          0          1
         0          1          0
         0          1          1
         1          0          0
         1          0          1
         1          1          0
         1          1          1

8 rows selected.

Published by: Centinul on December 28, 2009 09:35

Tags: Database

Similar Questions

  • HO OfficeJet Pro 8600: how to remove a static ip address on my HP 8600, using mac 10.7.5 work with wifi

    I have trouble printing through my wifi network. How to remove a static ip address on my HP 8600, using mac 10.7.5 to work with wifi?

    With the help of my NetGear N900 / CG4500BD modem/router with DHCP, there are different IP addresses of the printer, if the printer is connected is 192.168.0.13, when the printer use wifi IP is 192.168.0.20, and on the printer, it shows 192.168.1.142 I think is a static IP address, because it can cause the confussion.

    I appreciate your help, thank you, the Job Dr.

    Hello

    Please go to system-> Network Preferences. Select the airport on the left, and then click Advanced in the bottom right. Switch to TCP/IP and select "using dhcp". Click ok, and then click on apply. After a few seconds, you should get an IP address from the router.
  • How to set a static ip address

    How to set a static ip address in xp pro

    Hello

    Maybe this can help, http://portforward.com/networking/static-xp.htm

    Jack-MVP Windows Networking. WWW.EZLAN.NET

  • How to get a static Image location (Lon & Lat)

    Hi, I have a location (long & Lat),

    How to get a static Image of these data?

    Thank you

    JAM373 blackberry jam europe reading

    and

    http://supportforums.BlackBerry.com/T5/native-development/crush-in-BB-Cascades-imageView-SetImage/m-...

    Found the solution using MapImageGenerator

    I am applying like this

    on .qml:

    function getImage() {
       mapImage.getImageMap(lat, lon, screenWidth);
    }
    
    attachedObjects: [
       StaticMapImage {
         id: mapImage
         onGetProperties: {
           staticMapImage.image = aPropertyMap.img;
         }
      }
    ]
    
    ImageView {
       id: staticMapImage
       preferredWidth: screenWidth
       preferredHeight: 300
    }
    

    on StaticMapImage.cpp:

    StaticMapImage::StaticMapImage(QObject *parent):
        QObject(parent)
        {
    
        }
    
    void StaticMapImage::getImageMap(const double &aLatitude, const double &aLongitude, int width)
        {
        ViewProperties mapProperties;
        mapProperties.setLatitude(aLatitude);
        mapProperties.setLongitude(aLongitude);
        QRect windowRect(0,0, width, 300);
        mapProperties.setWindow(windowRect);
    //  mapProperties.setAltitude(500);
    
        iMapImageGenerator = new MapImageGenerator(mapProperties);
        bool result = connect(iMapImageGenerator,
                SIGNAL(finished(bb::cascades::maps::MapImageGenerator *)),
                this, SLOT(imageFinished(bb::cascades::maps::MapImageGenerator *)));
        Q_ASSERT(result);
        Q_UNUSED(result);
    
        iMapImageGenerator->start();
        }
    
    void StaticMapImage::imageFinished(bb::cascades::maps::MapImageGenerator *aMapImageGenerator)
        {
        bb::cascades::Image img(aMapImageGenerator->imageData());
    
        QDeclarativePropertyMap* propertyMap = new QDeclarativePropertyMap;
        propertyMap->insert("img",  QVariant(QVariant::fromValue(img)));
        setProperties(propertyMap);
    
    //  delete iMapImageGenerator;
        }
    
    QDeclarativePropertyMap *StaticMapImage::properties()
        {
        return iPropertyMap;
        }
    
    void StaticMapImage::setProperties(QDeclarativePropertyMap *aPropertyMap)
        {
        iPropertyMap = aPropertyMap;
        emit getProperties(iPropertyMap);
        }
    

    on StaticMapImage.hpp:

    class StaticMapImage: public QObject
    {
        Q_OBJECT
        Q_PROPERTY(QDeclarativePropertyMap *properties READ properties WRITE setProperties NOTIFY getProperties)
    public:
        StaticMapImage(QObject *parent = 0);
        Q_INVOKABLE void getImageMap(const double &aLatitude, const double &aLongitude, int width);
    
    private slots:
        void imageFinished(bb::cascades::maps::MapImageGenerator *aMapImageGenerator);
    
    public slots:
        QDeclarativePropertyMap *properties();
        void setProperties(QDeclarativePropertyMap *aPropertyMap);
    
    signals:
        void getProperties(QObject *aPropertyMap);
    
    private:
        MapImageGenerator *iMapImageGenerator;
        QDeclarativePropertyMap *iPropertyMap;
    };
    

    Thank you

  • How to create a static library

    Anyone know how to create a static library using QNX Momentics 10.2?

    Is it possible to create a static library which contains the qml file?

    I found this obsolete article: https://supportforums.blackberry.com/t5/Native-Development-Knowledge/How-to-create-a-shared-or-stati...

    Thank you

    File > New > BlackBerry Project and you get the following window:

    You also like the Fund of this model of library by @IsaacGordezky https://github.com/blackberry/Cascades-Community-Samples/tree/master/Cascades-Library-Template.

  • How to rotate text static horizontal 90 degrees?

    How to rotate text static horizontal 90 degrees?  Flash 8 had a rotation button in the properties panel

    Figured it out.  You must set the text to vertical.  Then, select the text and the spin button will be displayed.

  • How to assign a static IP (external) to a virtual computer when provisionng by vCAC

    Hi all


    I'm trying to figure out how to assign a static IP address at a request of vCAC via vCO prior to cloning. Without a static IP address assigned, cloning ends well and gets a random IP address... but I want the virtual machine to use a specific IP address.

    I use the pack of extensibility (not dynamic Ops Designer).


    Is it possible to do? Any ideas would be appreciated.


    Thank you.

    Are you planning on using network profiles for a pool of static IP addresses? If this is not the case, will provide you the IP address at the time of the request? For static IP address assignment, put in the property custom 'VirtualMachine.Network0.Address' and associated custom properties (see page 251 of the Guide) and if you have a comment specified in your plan customization, it will use this information to provide the IP address.

  • How do you know static id of the region

    Read the JQuery tabs - branching at specific tab thread

    He meniotned he must connect the static region ID.

    Can someone tell me how to know the static id of the region? Looking at my regions, they have seq id no. but don't know how to find the static id of the region? I'm just plugin #REGION_STATIC_ID #?

    my parts are built with jquery. I use apex 4

    Thanks in advance.







    ZenG

    Hello

    You change the region and you should see, in the attributes section, a parameter called 'Static Id' - click on help for this setting and you will see:

    >
    "Enter the value to identify this region. You can reference this value using the #REGION_STATIC_ID substitution string #. Referencing this value can be useful when custom JavaScript development. »
    >

    Andy

  • How many number clues can be made in a table?

    How many number clues can be made in a table?

    Hello

    user12059276 wrote:
    How many number clues can be made in a table?

    Any number. There is no limit.

  • How to use a static reference to maintain a VI in memory, but then call it in parallel?

    Hi all

    I have a MainVI and I want to call him a Subvi in parallel so that I can have both windows open and sensitive at the same time.  The Subvi can be closed and then reopened any number of times, but only one in existence at the same time.  I know how to do it using the reference VI opened, offering a path relative to my Subvi, check to see if its already running and if so bring window to front (using front panel: open with entries True/Standard method) and if not run it using the Invoke method: Run (and eventually open its façade by program).  This method worked very well.

    Now, I've added functional global variables in my Subvi, and I want to keep in memory inbetween opening Subvi window.  I can do this by placing a copy of the functional overall in my MainVI, even if I do not here for nothing.  It works very well.

    By chance, I came across a reference to a static reference of VI, which resembled a great improvement in my method, for the following reasons:

    1) Subvi keeps in memory all the time, eliminating the need to put the functional overall in MainVI when it is not used it.

    (2) tells the LabVIEW to include the Subvi when I build my executable, rather than me having to specifically mark as always include in the build specification.

    (3) eliminates the need to continue the path and the name of Subvi updated in a constant string in my code, in order to use the open VI reference.

    However, in trying to implement this solution, I ran into the problem that once you put a reference of VI in strictly typed static (strict typing is necessary to keep in memory) on the block diagram, that VI is reserved for execution.  This means that I can't run it using the Invoke method: Run.  I did not just put it on the diagram directly as a Subvi because I need it to run in parallel to the MainVI.  I searched through these forums extensively, and although there are several references to a static reference of VI, none of them say explicitly how to actually run this 'thing'!  : PEI

    I greatly appreciate any insight into my problem.  If I have to go back to the old way it works perfectly, but I really like the apparent elegance of this solution.  I hope that it will be technically possible, and I'm not bad understand something.

    Thank you for your help,

    -Joe


  • How can I delete old backups made with backup?

    The software that I use at home for backup allows me to program it so that I keep only full backups n.  It deletes the oldest backup automatically performed after the backup complete n + 1.

    At work, I have to use the backup utility that comes with XP Pro.  I was unable to find a way to delete older backups even manually.  As a result, my backup disk is almost full.  Although I really like the automatic deletion that makes my home software, I would be perfectly happy if I could manually delete any backups older than the nth backup complete.

    Is there somehow in the backup utility to remove these old backups?  If Yes, can someone describe how make it?  Thank you.

    Hi tochjo,

    NTBACKUP does NOT contain functionality to do this automatically.

    If you are looking for *. The BKF files and sort by date. Subsequently, remove files from your computer.

    Hope the helps of information.
    Please post back and we do know.

  • How can I burn a dvd made House with windows media player?

    I copied my videos I recorded with my video camera on a dvd and I wanted to make more copies off the dvd but I'm not able to. Whether and how save the video for dvd to be able to drag them into the burn list?

    FWIW... nor Windows Media Player or Windows DVD
    Maker is useful for copying DVD. However if you want to
    to create a video DVD that will play in a free-standing DVD
    Player... Windows DVD Maker would be useful for this.

    Windows Vista - Windows DVD Maker - burn a DVD - video disc
    http://Windows.Microsoft.com/en-us/Windows-Vista/burn-a-DVD-video-disc

    Here is a very simple way to copy your home made DVD:

    First... just a suggestion... using a slow burn speed
    produces a more reliable copy.

    The following freeware can create an ISO Image
    that allows to burn copies. Once you have the
    image created... you can use it to burn as many copies
    as you need.

    FWIW... it's always a good idea to create a system
    Restore point before installing software or updates)

    Click left on the green circle with the white arrow... it is said
    «Click here to download»

    Download ImgBurn:
    http://www.Digital-Digest.com/software/download.php?sid=470&SSID=0&did=1
    (The download is: SetupImgBurn_2.5.7.0.exe)

    (During the installation there will be an option to install
    "UniBlue shortcuts" and the "Ask Toolbar"... you can
    you want to deselect those)

    The following tutorials may be worth a visit:

    How to create an image file of a disc with ImgBurn
    http://Forum.ImgBurn.com/index.php?showtopic=6379

    How to write an image file to a disc with ImgBurn
    http://Forum.ImgBurn.com/index.php?showtopic=61

  • How completely UNINSTALL Internet Explorer 8

    I recently downloaded UFile 2004 and 2005 which are income tax programs. After entering the information, I go to a page of RESULTS. When I do if I get a run time error and the program closes. When I contacted UFile they advised me that if ANY PART of IE this on my computer, these two programs will fail to work completely.

    I find that I can not completely uninstall Internet Explorer 8, even if I did the things ON / OFF. Help, please!

    http://support.Microsoft.com/kb/957700

    "How to uninstall or remove Internet Explorer 8?

    Above is the opinion of MS how to uninstall IE8.

    See you soon.

    Mick Murphy - Microsoft partner

  • How to remove a static IP address b110a

    I changed my wireless router and its IP address clashes with the static IP address that I had set for the printer.  How can I change the static IP address of the B110a or it return to a dynamic address?

    Hello

    Go to the menu of the printer and find the default option of restore network and select it. That should restore the network 192.168.1.0 subnet.

    Visit the Center of HP wireless printing for more information. You will find a multitude of assistants of installation and diagnostiocs it available for download.

    Best regards

    ERICO

  • How to set address static IP for cisco APS to the controller via command line

    Hello

    in our project it 208 APS registered in a WISN-1 controller

    How do I assign a static ip address to this Aps via command line in a controller 4404

    Thanks to the Internet, it takes more time to assign the static ip address

    You don't mention what version of the code, you are on but on 7.0:

    ap static IP config activate

    You can also add

    ap static IP config add domain

    ap static IP config add nameserver

Maybe you are looking for

  • Satellite P - Windows Media Center problem

    Without any visible problems or bug virus threats, Windows Media Center starts to crack on video output. Just randomly losing pixels on a screen and all other similar programs like wmp, vlc media player, mv2, and Intervideo Win DVD works properly?

  • HP 15 r014tx: suggestion of necessary ram upgrade

    Hey! I want to upgrade ramMy current ram is 4 GB I want to upgradeIs there a location empty any where I can inster ram?If so, then can you pls recommend any ramHow many GB of ram can I put in itAnd it is accessible to the user, or I have to visit the

  • Vista KB973917 update cannot install. Help!

    I can't install the windows KB973917 update I get error code 800736B 3 that I even tried closing disable my firewall and windows defender and it still will not be installed. I scanned my pc for any virus and possible hard drive errors but still canno

  • Get a pop-up that won't go away - NMIndexStoreSvr.exe?

    What is this and how can I make them disappear? my machine works fine otherwise, I have just this annoying window that I can't close.

  • 5610 - no Scan Option

    This seems to be a common problem.  I was able to scan from the right side of the façade along, but had some XP problems recently and had to reinstall the software, now the façade gives me the error 'no scan options '. I went through the long chain o