Call a select stmt with multiple columns inside another column

Hi all

I have a question about the appeal of a select statement, which is to have multiple columns inside another select statement.

I know that we can use inline views to retrieve data from another table within a query as shown below.

SELECT (SELECT dname FROM dept WHERE deptno = e.deptno), deptno, sal FROM emp e;

Now, I'm going to pull the loc also column within the same view of inline. But oracle is not allowing me to do the same thing.

Is there a way we can achieve the same thing because I don't want to hit the area two times table each time for each emp record.

Appreciate your valuable suggestions.

Thank you
Madhu K.

Maybe just a simple outer join?

select ut.subscriberid
      ,ut.unitid
      ,ut.install_date
      ,nvl(tuh.hardwaretype, 'NO_HW')
from   tt_unit ut
left   join tt_unit_hwtype tuh
on     tuh.unitid = ut.unitid
where  trunc(ut.install_date) >= V_CONST_PROG_START_DT;

Tags: Database

Similar Questions

  • GROUP BY with multiple columns.

    I have a little query on the GROUP BY clause.

    Sometimes, we will give several names of columns in GROUP BY. If it behaves in the same way as ORDER BY (multi-column) I wish I had an example where I can use GROUP BY multiple columns. in any case regardless of his behaviour, it will be really appreciated if someone can explain a scenario where GROUP BY with multiple columns can be used.

    I know about the use of GROUP BY aggregate functions, but using a single column.

    Thank you.. !!!

    No, not like that

    I think that Group by does not follow any order...

    If we execute like this

    SELECT registrationid, dateofbirth, sum (age) FROM prawin62 WHERE registrationid = 22 GROUP BY dateofbirth, registrationid.

    22     1/23/1975     54
    22     5/18/2011     330
    

    It will give the same result based on date of birth...

    ~ Praveen

  • Gears - error when you try to insert values into a table with multiple columns

    Hello

    I started playing with the gears and SQlLite today and I get an error when I try to insert values into a table with multiple columns.

    I have:

    var db = google.gears.factory.create('beta.database');
        db.open('developerSet');
        db.execute('create table if not exists Developers (DeveloperName text, DeveloperAge int)');
    
        var devName = "Davy"
        var devAge = 32;
    
        try {
            db.execute('insert into Developers values (?, ?)', [devName, devAge]);
            alert('success');
        }
        catch (e) {
            alert(e);
        }
    

    I get the error:

    net.rim.device.api.database.DatabaseException; insert into developers values (?,?): SQL logic error or missing database.

    I use this reference: http://code.google.com/apis/gears/api_database.html

    Everything works if I have only one field as:

    var db = google.gears.factory.create('beta.database');
        db.open('developerSet');
        db.execute('create table if not exists Developers (DeveloperName text)');
    
        var devName = "Davy"
        var devAge = 32;
    
        try {
            db.execute('insert into Developers values (?)', [devName]);
            alert('success');
        }
        catch (e) {
            alert(e);
        }
    

    I use the plug-in Visual Studio 2.0 for 2008 that are running Windows XP SP and Simulator 2.13.0.56

    Thank you

    Davy

    Yes, a SQLite database will persist between battery pulls.  The database is registered either to internal MEM or removable media (not the device memory), depending on which is available on your device.

    In general, its not considered a best practice to remove your table as soon as it is empty and re - create it again when you want to add data.  This adds extra overhead fresh for the final, delete and insert first for a given table.  Instead, define and finalize your drawing before you create your table.  Once created, review the static schema.

    That being said, for development purposes, it may be easier to provide an easy way to drop your tables while you develop your schema.

    See you soon,.

    Adam

  • Declare a type of table with multiple columns

    I have a table with a column of type, and I want to create one with two columns.

    My type is:
    create or replace type "NUMBER_TABLE" in the table of the number;

    And I use it in function:

    FUNCTION GetValues()
    return NUMBER_TABLE
    as
    results NUMBER_TABLE: = NUMBER_TABLE();
    Start
    Select OrderId bulk collect in: results from (select * from tbl_orders);
    -Other code...
    end;

    I want select it be like this:
    Select OrderId, OrderAddress bulk collect into: results from (select * from tbl_orders);

    How to do this?

    Is that what you are looking for:

    CREATE OR REPLACE TYPE two_col_rec AS OBJECT (empno NUMBER, ename VARCHAR2(10))
    /
    
    CREATE OR REPLACE TYPE two_col_table AS TABLE OF two_col;
    /
    
    CREATE OR REPLACE FUNCTION GetValues RETURN two_col_table AS
       results two_col_table := two_col_table();
    BEGIN
       SELECT two_col(empno, ename) BULK COLLECT INTO results FROM emp;
       --
       RETURN results;
    END;
    /
    show errors
    
  • Select problem with multiple statements

    I have a stored procedure where I create a table variable and then doing an insert and the problem I have is to separate my select statements that I use to insert into the table variable. I tried wrapping each select statement in parentheses and separating them by a comma; However, it does not either. I also tried aliasing the select statement with the same column name. I will be using the return on this stored procedure for a graph charting.

    Here's a SP and here is the error.


    The selection list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of columns in the INSERT.

    I try and rewrite in the form a single query using case statements. But the syntax that might work is

    insert into @SomeTable (col1, col2, col3)
    Select (select count (*) of @OtherTable).
    (select count (*) in @OtherTable),
    (select count (*) in @OtherTable)

    (> [TWO_RACES] [int] NULL)

    And it would be tall... everyone. LMAO

  • ComboBox with multiple columns

    Is it possible to make a ComboBox with two columns in the drop-down list box?

    Thank you

    Use the dropdownwidth property

  • create xmlindex structured with multiple columns reflecting different XPath expressions

    I run a XMLEXISTS query to return documents that contain a specific search template. The search model is based on two distinct XPATHS. I tried to create an XML Index structured to support the request. While I can make it work when I specify that a XPATH, I can't make it work when I specify both.

    Oracle version: 11.2.0.3

    extendeddata / / DESC

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    U NOT NULL VARCHAR2 (14)

    XMLCONTENT NOT NULL SYS. XMLTYPE BINARY STORAGE

    ROWINSERTDATE NOT NULL DATE

    XMLSIZE NOT NULL NUMBER (10)

    DATAIMPORTID NOT NULL VARCHAR2 (100)

    MESSAGEFLOWNAME NOT NULL VARCHAR2 (200)

    Table is partitioned by month on ROWINSERTDATE

    XMLType column stored as files secure.

    Here's the query...

    SELECT u, xmlcontent

    To extendeddata

    WHERE the XMLEXISTS ('declare namespace CAMT54 = "urn: iso: std: iso: 20022:tech:xsd:camt.054.001.02";)

    $p / CAMT54:Document / CAMT54:BkToCstmrDbtCdtNtfctn / CAMT54:Ntfctn [CAMT54:Acct / CAMT54:Id / CAMT54:IBAN = $iban]

    [and CAMT54:Ntry / CAMT54:CdtDbtInd = $ctddbtind]' Xmlcontent passing that 'p ',.

    "XXXXXXXXXXXXXXXXXXXXXX" AS "iban",.

    "DBIT" as "ctddbtind")

    AND rowinsertdate > = TO_DATE (' 2014-06-01 00:00:00 ',' ' SYYYY-MM-DD HH24:MI:SS)

    AND rowinsertdate < TO_DATE (' 2014-07-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS');

    Here's the index...

    CREATE INDEX EXTENDEDDATA_XML_IDX1 ON EXTENDEDDATA (XMLCONTENT)

    INDEXTYPE IS XDB. XMLIndex LOCAL SETTINGS (' XMLTable EXTENDEDDATAIBAN)

    XMLNAMESPACES ("urn: iso: std: iso: 20022:tech:xsd:camt.054.001.02" as "CAMT54").

    "/ CAMT54:Document / CAMT54:BkToCstmrDbtCdtNtfctn / CAMT54:Ntfctn"

    COLUMNS

    IBAN VARCHAR (34) PATH "CAMT54:Acct / CAMT54:Id / CAMT54:IBAN".

    CTDDBTIND varchar (4) PATH "CAMT54:Ntry / CAMT54:CdtDbtInd" ');

    CREATE INDEXES SEPA_PAY. EXTENDEDDATAIBAN_IDX1 ON EXTENDEDDATAIBAN (IBAN, CTDDBTIND)

    TABLESPACE SEPA_PAY_BIG_IDX;

    exec dbms_stats.gather_table_stats (ownname = > 'SEPA_PAY', tabname = > 'EXTENDEDDATA');

    Here is the plan to explain it...

    PLAN_TABLE_OUTPUT

    ------------------------------------------------------------------------------------------------------------------------------------

    Hash value of plan: 417322092

    --------------------------------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |

    --------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |              |  1050 |   648KO |    38 (0) | 00:00:01 |       |       |

    |*  1 |  FILTER |              |       |       |            |          |       |       |

    |   2.   RANGE OF SINGLE PARTITION |              |  1050 |   648KO |    32 (0) | 00:00:01 |    16.    16.

    |   3.    TABLE ACCESS FULL | EXTENDEDDATA |  1050 |   648KO |    32 (0) | 00:00:01 |    16.    16.

    |   4.   SEMI NESTED LOOPS.              |     1.     6.     6 (0). 00:00:01 |       |       |

    |   5.    SEMI NESTED LOOPS.              |     1.     4.     4 (0) | 00:00:01 |       |       |

    PLAN_TABLE_OUTPUT

    ------------------------------------------------------------------------------------------------------------------------------------

    |   6.     XPATH EVALUATION.              |       |       |            |          |       |       |

    |*  7 |     XPATH EVALUATION.              |       |       |            |          |       |       |

    |*  8 |    XPATH EVALUATION.              |       |       |            |          |       |       |

    --------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 Filter (EXISTS (SELECT / * + < impossible >))

    7 - filter("P2"."$ C_01"="DBIT')

    8 - filter("P1"."$ C_01"="XXXXXXXXXXXXXXXXXXXXXX')

    PLAN_TABLE_OUTPUT

    ------------------------------------------------------------------------------------------------------------------------------------

    Note

    -----

    -Construction detected no optimized XML (activate XMLOptimizationCheck for more information)

    The following is an extract from the XML file...

    " < document xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "xmlns =" urn: iso: std: iso: 20022:tech:xsd:camt.054.001.02 "" >

    < BkToCstmrDbtCdtNtfctn >

    < GrpHdr >

    < MsgId > NFTTEST201311060150412 < / MsgId >

    < CreDtTm > 2013 - 11 - 06T 15: 04:12 < / CreDtTm >

    < / GrpHdr >

    < Ntfctn >

    < id > 00001 / < ID >

    < CreDtTm > 2013 - 11 - 06T 15: 04:12 < / CreDtTm >

    < Acct >

    < id >

    XXXXXXXXXXXXXXXXXXXXXX < IBAN > < / IBAN >

    < /ID >

    < / Acct >

    < do >

    < Amt CTL = "EUR" > 89.00 < / Amt >

    < CdtDbtInd > DBIT < / CdtDbtInd >

    < m > BOOK < / m >

    < BkTxCd >

    < Prtry >

    < Cd > 99999999999999 < CD >

    < / Prtry >

    < / BkTxCd >

    < NtryDtls >

    < TxDtls >

    < refs >

    < Course > 999_99999999 < / course >

    < MndtId > str1234 < / MndtId >

    < / refs >

    < AmtDtls >

    < TxAmt >

    < Amt CTL = "EUR" > 89.00 < / Amt >

    < / TxAmt >

    < / AmtDtls >

    < BkTxCd >

    < Domn >

    < Cd > < CD > SEPA

    < Montaut >

    < Cd > < CD > SEPA

    < SubFmlyCd > CORE < / SubFmlyCd >

    < / Montaut >

    < / Domn >

    < / BkTxCd >

    < RltdPties >

    < UltmtDbtr >

    str1234 < n > < /Nm >

    < id >

    < OrgId >

    < BICOrBEI > XXXXXXXX < / BICOrBEI >

    < Scout >

    str1234 < id > < /ID >

    < SchmeNm >

    str1 < Cd > < CD >

    < / SchmeNm >

    str1234 < HIRS > < / HIRS >

    < / Scout >

    < / OrgId >

    < /ID >

    < / UltmtDbtr >

    < Instantane >

    str1234 < n > < /Nm >

    < PstlAdr >

    < Ctry > IE < / Ctry >

    < AdrLine > str1234 < / AdrLine >

    < / PstlAdr >

    < / Instantane >

    < CdtrAcct >

    < id >

    XXXXXXXXXXXXXXXXXXXXXX < IBAN > < / IBAN >

    < /ID >

    < CTL > EUR < / CTL >

    < / CdtrAcct >

    < UltmtCdtr >

    str1234 < n > < /Nm >

    < id >

    < OrgId >

    < BICOrBEI > XXXXXXXX < / BICOrBEI >

    < Scout >

    str1234 < id > < /ID >

    < SchmeNm >

    str1 < Cd > < CD >

    < / SchmeNm >

    str1234 < HIRS > < / HIRS >

    < / Scout >

    < / OrgId >

    < /ID >

    < / UltmtCdtr >

    < Prtry >

    < Tp > default SEPA < /TP >

    < Pty >

    < id >

    < PrvtId >

    < Scout >

    < id > < /ID > XXXXXXXXXXXXX

    < / Scout >

    < / PrvtId >

    < /ID >

    < / Pty >

    < / Prtry >

    < / RltdPties >

    < Purp >

    str1 < Cd > < CD >

    < / Purp >

    < RmtInf >

    < Ustrd > str1234 < / Ustrd >

    < Strd >

    < CdtrRefInf >

    < Tp >

    < CdOrPrtry >

    < Cd > SCOR < CD >

    < / CdOrPrtry >

    str1234 < HIRS > < / HIRS >

    < /TP >

    < ref > str1234 < / Ref >

    < / CdtrRefInf >

    < / Strd >

    < / RmtInf >

    < / TxDtls >

    < / NtryDtls >

    < / try >

    < / Ntfctn >

    < / BkToCstmrDbtCdtNtfctn >

    < / document >

    Can someone help me build an index for the query above?

    Thank you.

    This should work better, with the caveat explained above:

    SELECT t.*
    FROM extendeddata t
    WHERE XMLEXISTS('declare default element namespace "urn:iso:std:iso:20022:tech:xsd:camt.054.001.02";(::)
                   /Document/BkToCstmrDbtCdtNtfctn/Ntfctn[Acct/Id/IBAN=$iban]'
            Passing Xmlcontent,
                    'XXXXXXXXXXXXXXXXXXXXXX' AS "iban"
               )
    and XMLEXISTS('declare default element namespace "urn:iso:std:iso:20022:tech:xsd:camt.054.001.02";(::)
                   /Document/BkToCstmrDbtCdtNtfctn/Ntfctn[Ntry/CdtDbtInd=$ctddbtind]'
            Passing Xmlcontent,
                    'DBIT' as "ctddbtind")
    AND rowinsertdate >= TO_DATE(' 2014-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
    AND rowinsertdate < TO_DATE(' 2014-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
    ;
    

    (see how the predicates in each XQuery expression corresponds to the structure of the index)

    BTW, this kind of "DIY" XMLEXISTS works just as well.

    It emulates what we would have hoped for a single XMLExists in the first place:

    SQL> SELECT t.*
      2  FROM extendeddata t
      3  WHERE rowinsertdate >= TO_DATE(' 2015-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
      4  AND rowinsertdate < TO_DATE(' 2015-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
      5  AND EXISTS (
      6    SELECT null
      7    FROM XMLTable(
      8           XMLNamespaces(default 'urn:iso:std:iso:20022:tech:xsd:camt.054.001.02')
      9         , '/Document/BkToCstmrDbtCdtNtfctn/Ntfctn'
     10           passing t.xmlcontent
     11           COLUMNS IBAN      VARCHAR2(34) PATH 'Acct/Id/IBAN'
     12                 , CTDDBTIND VARCHAR2(4)  PATH 'Ntry/CdtDbtInd'
     13         ) x
     14    WHERE x.iban = 'XXXXXXXXXXXXXXXXXXXXXX'
     15    AND x.ctddbtind = 'DBIT'
     16  ) ;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 409033022
    
    ---------------------------------------------------------------------------------------------------------------
    | Id  | Operation                             | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                      |                       |     1 |   824 |     4  (25)| 00:00:01 |
    |   1 |  NESTED LOOPS                         |                       |     1 |   824 |     4  (25)| 00:00:01 |
    |   2 |   SORT UNIQUE                         |                       |     1 |    38 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS BY INDEX ROWID BATCHED| EXTENDEDDATAIBAN      |     1 |    38 |     2   (0)| 00:00:01 |
    |*  4 |     INDEX RANGE SCAN                  | EXTENDEDDATAIBAN_IDX1 |     1 |       |     1   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY USER ROWID          | EXTENDEDDATA          |     1 |   786 |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("SYS_SXI_1"."IBAN"='XXXXXXXXXXXXXXXXXXXXXX' AND "SYS_SXI_1"."CTDDBTIND"='DBIT')
       5 - filter("ROWINSERTDATE">=TO_DATE(' 2015-06-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "ROWINSERTDATE"		   
  • How to retrieve unique records with multiple columns

    I have a sps_prod table as described below-

    POGNAME VARCHAR2 (1500)
    INDEX #VERSION VARCHAR2 (200)
    POG_MODEL_STATUS VARCHAR2 (100)
    POG_LAYOUT_TYPE VARCHAR2 (500)
    POG_MARKET_SPECIFIC VARCHAR2 (500)
    POG_CONTACT_NUMBER VARCHAR2 (100)
    AREA_SUPPORTED VARCHAR2 (500)
    POG_COMMENTS VARCHAR2 (1500)
    POG_FOOTER_COMMENTS VARCHAR2 (1500)
    POG_ELECTRICAL_LIST_1 VARCHAR2 (1500)
    POG_ELECTRICAL_LIST_2 VARCHAR2 (1500)
    POG_CARPENTRY_1 VARCHAR2 (1500)
    POG_CARPENTRY_2 VARCHAR2 (1500)
    INSTALLATION_INSTRUCTION_1 VARCHAR2 (1500)
    INSTALLATION_INSTRUCTION_2 VARCHAR2 (1500)
    FIXTURE_REORDER_NUMBER VARCHAR2 (200)
    FIXTURE_ID VARCHAR2 (200)
    FIXTURE_NAME VARCHAR2 (500)
    FIXTURE_IMAGE VARCHAR2 (500)
    PART_REORDER_NUMBER_9 VARCHAR2 (500)
    PART_FIXTURE_ID_9 VARCHAR2 (500)
    PART_FIXTURE_NAME_9 VARCHAR2 (500)
    PART_FIXTURE_IMAGE_9 VARCHAR2 (500)
    UPC VARCHAR2 (50)
    ITEM_NUMBER VARCHAR2 (50)
    DESCRIPTION VARCHAR2 (700)
    MERCH_TYPE VARCHAR2 (20)
    HEIGHT VARCHAR2 (100)
    WIDTH VARCHAR2 (100)
    DEPTH VARCHAR2 (100)
    DATE OF CREATE_TS

    There are 4 million records in it and many with the same combination of POGName, #Version, POG_Model_Status, POG_Layout_Type, POG_Market_Specific, POG_Contact_Number and Fixture_Name Index. How do the records to retrieve all the columns above, but with a unique combination of fixture_name and reorder_number. It has no keys defined on the table.

    I guess that it is a simple problem but the fact I'm trying to retrieve all the columns I'm stumbling.

    Thanks in advance.

    Hello

    Sanders_2503 wrote:
    ... There are 4 million records in it and many with the same combination of POGName, #Version, POG_Model_Status, POG_Layout_Type, POG_Market_Specific, POG_Contact_Number and Fixture_Name Index. How do the records to retrieve all the columns above, but with a unique combination of fixture_name and reorder_number.

    I don't see a column named reorder_number. Do you mean fixture_reorder_number or part_reorder_number_9?

    So, you want only one row for each distinct combination of fixture_name and some other column (I'll assume it's fixture_reorder_number). Does it matter which line? They will not necessarily have the same values for the other columns.
    The following query returns the one with the first pogname (in sort order):

    WITH     got_r_num     AS
    (
         SELECT  pogname, index#version, pog_model_status, pog_layout_type
         ,     pog_market_specific, pog_contact_number, fixture_name
         ,     ROW_NUMBER () OVER ( PARTITION BY  fixture_name
                                   ,                    fixture_reorder_number
                             ORDER BY        pogname
                           )         AS r_num
         FROM    sps_prod
    )
    SELECT  pogname, index#version, pog_model_status, pog_layout_type
    ,     pog_market_specific, pog_contact_number, fixture_name
    FROM     got_r_num
    WHERE     r_num     = 1
    ;
    

    If there be a tie (i.e. two or more lines with the same fixture_name, fixture_number and pogname first) and then the will be chosen arbitrarily.

    Instead of "ORDER BY pogname", you can ORDER all the other columns OR expressions, but you must have an ORDER byclause of analytics. You can do "ORDER BY NULL" If you really want pcik an arbitrary line.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and also publish the results you want from these data (or some examples of acceptable results).
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • Report with multiple columns NUMBER of counts of the same table

    I am new to discoverer, so I'm a little lost.

    I work to create a report to show usage data and Knowledge Base of e-business. I have written using subqueries in SQL query that is in the format:

    Solution number | Soultion title | Solution views. Positive feedback | Negative feedback
    Title of 12345 _ 345 _ 98 34


    The entries 'Views', 'Positive' and 'Negative' are stored in the same table, so I do a count where setid = setid and usedtype = VS, then count where usedtype = usedtype and PF = NF

    Discoverer, I can get the number of solution, the title and THE totals but I can't seem to understand how to get an ACCOUNT for three different things from the same table in the columns on the same line.

    When I go on change map-> select the items once I select the option NUMBER of the UsedType column in the CS_KB_SET_USED_HISTS table, I can't select it again. I also found way now to add a column based on a query entered.

    If someone could help it would be much appreciated.

    Thank you

    Published by: Toolman21 on December 2, 2010 14:17
    _ to correct spacing added.

    Hello
    You can separate the column with a case or decode.
    for example to create 2 calculations:

    case
    When usedtype = "PF".
    then - that contain both
    0 otherwise
    end

    case
    When usedtype = 'NF '.
    then - that contain both
    0 otherwise
    end

    After that, you can create the aggregation count on those.

    Tamir

  • How to select several values with a select statement with other columns

    Hi all

    I have a small request related to the selection of values in a table.

    create table employees (eid, ename varchar2 (20));

    insert into employee values (1, 'Nik');

    insert into employee values (2, "Prashant");

    commit;


    Now, I have a small list of say A, b, C, I want to choose this list with all the lines as

    with test1 as)

    Check the eid, ename for employee

    )

    Select eid, ename, 'A' col1 in test1

    UNION ALL

    Select eid, ename, 'B' col1 in test1

    UNION ALL

    Select eid, ename, 'C' col1 in test1

    but the problem with that is that in production my employee table has millions of records and it scans the employee three times table (or the number of constant values)

    Is there another way to do this.

    Thank you

    Nik

    Here is an approach with the scanning of a single table test1

    Select t.eid, t.ename, c.col1

    t test1

    Cross join (select 'A' col1 of union double all the)

    Select 'B' of all the double union

    Select the double ' C') c

  • Histogram with multiple columns

    I use a CFC to enter data in a database.  Data from looks like this

    Jan 100 cars

    Jan 150 trucks

    Jan 125 bikes

    Feb 112 cars

    Feb 132 trucks

    Feb 121 bikes

    etc.  I want a chart bar to see the numbers on the left and the month along the bottom.

    When I import it, it leaves two empty columns then shows the bikes from Jan.  When I add another series, it does the same thing.  What I want is for the data to be left aligned and have Jan and a column for each item, then have Feb and a column for each element.

    Coming from my data via

    event.result = inventory

    as Collection ArrayCollection;

    < mx:ColumnChart

    y=" 40 "

    ID ="

    myChart "

    dataProvider ="

    {inventory} "

    showDataTips ="

    true "

    selectionMode ="

    unique "

    width ="

    100% "height =" " 100% " >

    <! - vertical axis - >

    < mx:verticalAxis >

    < mx:LinearAxis " baseAtZero = ' true "

    < / mx:verticalAxis >

    < mx:horizontalAxis >

    < mx:CategoryAxis

    dataProvider ="

    {inventory} "

    categoryField ="

    sale " />

    < / mx:horizontalAxis >

    < mx:series >

    < mx:ColumnSeries

    Color ='

    #FFFFFF "

    xField ="

    month "

    yField ="

    sale " >

    < / mx:ColumnSeries >

    < mx:ColumnSeries

    Color ='

    #FFFFFF "

    xField ="

    month "

    yField ="

    sale " >

    < / mx:ColumnSeries >

    < / mx:ColumnChart >

    You need three ColumnSeries. Set the dataProvider of each directly (instead of setting for the ColumnChart) something like this:

    var car: ListCollectionView = new ListCollectionView();

    cars. List = inventory;

    cars.filterFunction = {function(item:Object):Boolean}

    return item ['category' / * or whatever your category field * /] == "cars."

    };

    Do something similar for the motorcycles and trucks. You can do something like this if you do not know the number of categories as well, but it's rather more complicated (and left as an exercise for the reader).

  • call a script sql with one parameter of another

    I would like to call a sql script that takes a single parameter (& 1)... but it doesn't.
    It looks like (first.sql):
    begin
    for cv in (select table_name from all_tables where owner='IBIS') loop
            @my_script.sql cv.table_name;
    end loop;
    end;
    but when I run it, I got an error:
    @first.sql;
    old   9: spool &1..cob replace
    new   9: spool cv.table_name.cob replace
    old  10: select '       05 DBUFF-' || '&1' || '-1.' from dual;
    new  10: select '       05 DBUFF-' || 'cv.table_name' || '-1.' from dual;
    old  12: from all_tab_cols where table_name='&1' and substr(column_name,1,3)<>'SYS';
    new  12: from all_tab_cols where table_name='cv.table_name' and substr(column_name,1,3)<>'SYS';
    old  13: select '          05 ' || '&1' || '-ROWID          PIC X(18).' from dual;
    new  13: select '          05 ' || 'cv.table_name' || '-ROWID          PIC X(18).' from dual;
    What is missing?

    Kind regards...

    Hello

    The trick is to generate a sql script with all your calls to internal scripts and their parameters.

    For example, my script is internal countTableIndex.sql :

    select 'Table &1 has got '||count(*)||' indexes.' from user_indexes where table_name='&1';
    

    And here's my script outside coutnIndex.sql :

    set serverout on pages 0 lines 100 feed off time off verify off define on tab off trimspool on trimout on termout on termout off
    spool cmd.sql
    begin
    for cur in (select table_name tab from user_tables) loop
         dbms_output.put_line('@countTableIndexes.sql '||cur.tab);
         null;
    end loop;
    end;
    /
    spool off
    set termout on
    @cmd.sql
    exit;
    

    As you can see, it generates a file cmd.sql containing internal script calls and ultimately calls the script cmd.sql.
    In my example schema scott after the execution, the cmd.sql file contains:

    @countTableIndexes.sql DEPT
    @countTableIndexes.sql EMP
    @countTableIndexes.sql BONUS
    @countTableIndexes.sql SALGRADE
    @countTableIndexes.sql TOTO
    

    Here is the result of my machine:

    [oracle@Nicosa-oel test19_parameterizedSqlScripts]$ sqlplus -s scott/tiger@my11g @countIndex.sql
    Table DEPT has got 1 indexes.
    Table EMP has got 1 indexes.
    Table BONUS has got 0 indexes.
    Table SALGRADE has got 0 indexes.
    Table TOTO has got 0 indexes.
    
  • Problems with video clip inside another MC button

    Hi all
    So I solved a problem earlier thanks to this site, but she has created a different problem. I could find a way to get an external text to load into a text inside a music box. However, the problem is I want to have a series of buttons also inside the MC which will change, delivery, the text in the (loading area in the text to another file). I'm running problems, however, because I can't figure out how to get the movie clip buttons to work.

    A short brief on the installer. I have a master.swf that loads in splash.swf (menu animation and splash) and about.swf (a paragraph loaded when you click on 'about' in the navi bar). When about.swf opens, I got a piece of film clip and text and the submenu appear after 20 images.

    This is the code that I placed on frame 1 of the about.swf:

    [PHP] boxmovie.btn_about2.onPress = function () {}
    trace ("button has been pressed");
    _level0.loadText (loadedInfo, ' vars/about2.txt');
    } [PHP]

    You can download the files
    goldinroute.com/MacGregor/Help.zip

    Any help would be appreciated!

    I guess what to expect, I hang on the file... OK, did you give the button the instance name 'more'? ("btn_about2") is not there in the file I have. Then, copy the following code must be IN the MC boxmovie, guess where... of 23 frame, because you cannot assign code to an object that doesn't exist or has not been instantiated, the chronology. so it should read:

    btn_about2.onPress - function() {}
    _level0.loadText (loadedInfo, ' vars/about2.txt');
    }

    (btw - if you reverse the way in which you name the inclinometer, Flash will give you a list of the methods of the class, when you type a '.' later, as in "about2_btn" to instead, just a thought for you, even with as "boxmoive_mc" for example ;))

  • View with a column that is derived from a function

    We can create a view with a column being filled using a pl/sql script, which uses 2 other columns on the same line as input?

    Example,
    Let's say I have a vision with

    Reg. Don't | Total | Customer account | Flag of billing. CodeFn
    $1234 45 2109 Y < value in this column would be what returns the expected script pl/sql, after using the Reg # (1234) and Total (45) as entries >
    $1236 15 2101 Y < input values would be 1236 & 15 >.

    Basically, I would like the script to generate a number that is returned in this column rather than do a simple Select stmt to extract columns from other tables/views.

    Edit: The point of view does not display right... Here is a picture
    view

    Thank you!

    Published by: jess_saunders on May 8, 2012 14:05

    Hello

    jess_saunders wrote:
    We can create a view with a column being filled using a pl/sql script, which uses 2 other columns on the same line as input?

    Example,
    Let's say I have a vision with

    Reg. Don't | Total | Customer account | Flag of billing. CodeFn
    $1234 45 2109 Y
    $1236 15 2101 Y .

    Of course, you can use a function that you created in the same way that you would use a built-in function:

    CREATE OR REPLACE VIEW     view_x
    AS
    SELECT  reg_no
    ,     total
    ,     customer_account
    ,     billing_flag
    ,     my_function (reg_no, total)     AS codefn
    FROM     table_x
    ;
    

    You cannot reference the procedures or anyonymous blocks in a CREATE VIEW statement (or any other SQL statement of stinks); only functions.

    Basically, I would like the script to generate a number that is returned in this column rather than do a simple Select stmt to extract columns from other tables/views.

    I don't know what you're saying here.
    As long as the function has no arguments, or make any kind of DML or DDL, then you can use it in the definition of the view, as stated above. The function failed to contain SELECT statements.
    Your notice must be based on other tables or views. If she does not really need anything from any other table, you can base your opinion on double. A CREATE VIEW statement must contain a query, and a query in Oracle must refer to a table or a view.

  • Unique table with several columns or several tables split?

    What is the best.

    A table with multiple columns inside or divided into several tables. Why?
    How will the performance in the two scenarios?

    Hello

    user13024762 wrote:
    I have a table EMP that has column EMP_ID, EMP_NAME MGR_ID, MGR_NAME, SALARY, EXP_IN_MNTHS, EXP_IN_YRS... etc with multiple columns

    I have the following tables
    EMP-> EMP_ID, EMP_NAME

    Each row in the table emp thie represents a separate employee. I guess other columns in the emp table might be birth_date, social_security_number and status (by example, 'Active', 'Leave', 'complete'). Here's what an employee has (at least) one of. If there is a one-to-many relationship between an employee and an attribute, then you probably want another table for this attribute.

    BISHOP-> EMP_ID, MGR_ID, MGR_NAME

    There is a one-to-many relationship between employees and managers? In other words, an employee may have 2 or more managers? If Yes, then you need another table.
    If there is only a one-to-one relationship between employees and managers (in other words, if an employee is never more than 1 Manager) so why don't you just have a mgr_id column in the emp table?
    Managers are also used for? (This is often the case, as in scott.emp and hr.employees.) If so, do not store their names in the EME and tables of mgr. Store name (and date of birth and other information) in the table emp only and, if you need a table of Bishop, just the emp_id and mgr_id column.

    SAL-> EMP_ID, SALARY

    There is a one-to-many relationship between the employees and wages? In other words, an employee may have 2 or more treatments? If so, how will you use the values? Is a special treatments in some way, as it will be used more often than others? (In other words, you may have a current and past wages salary, but the last wages are rarely used.)
    If you never have more than 1 salary for a given employee, why not just have a sal column in the emp table?

    EXP-> EMP_ID, EXP_IN_MNTHS, EXP_IN_YRS

    There is a one-to-many relationship between the employees and what whether you store in this table?

    etc. with more tables

    What is the best based on

    (1) performance and data recovery
    (2) ease of use
    (3) maintainability

    A one-to-many relationship requires an additional table. If an employee can have up to 3 managers, don't have mgr1, mgr2 and mgr3 columns in the emp table. Use a separate table, with up to 3 lines for the same employee, instead.
    For 1-1 relationships, it is usually best to not have separate tables.

Maybe you are looking for

  • Lines in imported pictures

    When I import images using the card reader SD Apple in Photos on my iPad, I get a series of lines on one edge of each image.  The lines are not on the original and do not appear if I import the images in the Photos on my iPhone using the same SD card

  • New drivers of graphics card for Satellite P200

    Because Toshiba is not to update the graphic card drivers, I was wondering if anyone has tried using DH mobility modder found in [http://www.driverheaven.net/] I have the Satellite P200 x 16 with an ATI Mobility Radeon HD 2600 and thank you

  • Cannot install 2 important updates - unknown error: Code 80070026 and Code 26

    For months now, I have tried to run updates for Vista Windows, but I get these two error codes. I thought I might have a virus that my antivirus regularly had not taken, I went to http://onecare.live.com/site/en-us/center/whatsnew.htm and performed a

  • Who created the interface user of Windows XP?

    I want to tip my hat to this designer.  Who did he was very intelligent.  One thing had to be added.  An easy tablecloth on your black eyes theme.

  • System.TypeLoadException: Could not load type 'DateTimeOffset '.

    Hello.I had trouble with "Vodafone Mobile Connect Lite" (Vodafone mobile broadband software) since I recently had to put windows xp on my computer. I have updated windows and have service pack 3 installed.I tried to remove the program and reinstalled