SQL query to retrieve all instances of a model within the column

I had an obligation to build a query for the scenario below. Pls help to troubleshoot.

Scenario.
Table 1 has two columns < number > col1 and col2 < CLOB >
The table has 2 rows

< Number > col1 has the following values
Row1-col1
1

Row2-col1
2

Col2 < Clob > has the following values

Row1-col2
blah blah blah blah blah blah blah A1235 A1234
blah blah blah blah blah blah blah A1237 A1236

Col2 Row2
blah blah blah blah blah blah blah A1239 A1238


The query should return (expected result)
A1234
A1235
A1236
A1237
A1238
A1239

I tried with the substr, but it returns only the first occurrence of the pattern

Query:
Select
REGEXP_SUBSTR (col2,
"A [0-9] {4}') 'REGEXP_SUBSTR'"
FROM table1


Output:
A1234
A1238


I want a loop must be created and check until the end of the column.
Pls help me with the query. It will be useful.

Thank you
Nanan

Published by: 950268 on August 1, 2012 07:19

You can simulate loops with sql functions as the clause-type (since 10 g) or recursive subquery (since 11.2).
Generally in this forum link it by the approach will be proposed.
The depth will be the number of occurrences of your model and the level will be the real occurency.
So just search inthi forum for an abundance of examples

select regexp_substr(col2, 'A[0-9]{4}', 1, level)
from tabel1
connect by
level <= regexp_count(col2,'A[0-9]{4}')

regexp_count since 11. ?

concerning

Tags: Database

Similar Questions

  • SQL query for retrieving data based on Certain model

    Hi all

    I want to retrieve all the identifiers of all the people who are permanently seated during the last hour.

    Data are expressed as below:

    -Creation of the activity Table

    CREATE TABLE activity_log

    (

    Username, NUMBER of

    Activity VARCHAR2 (30),

    StartTime VARCHAR2 (6).

    EndTime VARCHAR2 (6)

    );

    -Filling with sample data

    INSERT INTO activity_log VALUES('39','Walking','09:01','09:05');

    INSERT INTO activity_log VALUES('39','Walking','09:06','09:10');

    INSERT INTO activity_log VALUES('39','Sitting','09:11','09:15');

    INSERT INTO activity_log VALUES('39','Sitting','09:16','09:20');

    INSERT INTO activity_log VALUES('39','Sitting','09:21','09:25');

    INSERT INTO activity_log VALUES('39','Standing','09:26','09:30');

    INSERT INTO activity_log VALUES('39','Standing','09:31','09:35');

    INSERT INTO activity_log VALUES('39','Sitting','09:36','09:40');

    INSERT INTO activity_log VALUES('39','Sitting','09:41','09:45');

    INSERT INTO activity_log VALUES('39','Sitting','09:46','09:50');

    INSERT INTO activity_log VALUES('39','Sitting','09:51','09:55');

    INSERT INTO activity_log VALUES('39','Sitting','09:56','10:00');

    INSERT INTO activity_log VALUES('39','Sitting','10:01','10:05');

    INSERT INTO activity_log VALUES('39','Sitting','10:06','10:10');

    INSERT INTO activity_log VALUES('39','Sitting','10:11','10:15');

    INSERT INTO activity_log VALUES('39','Sitting','10:16','10:20');

    INSERT INTO activity_log VALUES('39','Sitting','10:21','10:25');

    INSERT INTO activity_log VALUES('39','Sitting','10:26','10:30');

    INSERT INTO activity_log VALUES('39','Sitting','10:31','10:35');

    INSERT INTO activity_log VALUES('39','Standing','10:36','10:40');

    INSERT INTO activity_log VALUES('39','Standing','10:41','10:45');

    INSERT INTO activity_log VALUES('39','Walking','10:46','10:50');

    INSERT INTO activity_log VALUES('39','Walking','10:51','10:55');

    INSERT INTO activity_log VALUES('39','Walking','10:56','11:00');

    INSERT INTO activity_log VALUES('40','Walking','09:01','09:05');

    INSERT INTO activity_log VALUES('40','Walking','09:06','09:10');

    INSERT INTO activity_log VALUES('40','Sitting','09:11','09:15');

    INSERT INTO activity_log VALUES('40','Sitting','09:16','09:20');

    INSERT INTO activity_log VALUES('40','Sitting','09:21','09:25');

    INSERT INTO activity_log VALUES('40','Standing','09:26','09:30');

    INSERT INTO activity_log VALUES('40','Standing','09:31','09:35');

    INSERT INTO activity_log VALUES('40','Sitting','09:36','09:40');

    INSERT INTO activity_log VALUES('40','Sitting','09:41','09:45');

    INSERT INTO activity_log VALUES('40','Sitting','09:46','09:50');

    INSERT INTO activity_log VALUES('40','Sitting','09:51','09:55');

    INSERT INTO activity_log VALUES('40','Walking','09:56','10:00');

    INSERT INTO activity_log VALUES('40','Sitting','10:01','10:05');

    INSERT INTO activity_log VALUES('40','Standing','10:06','10:10');

    INSERT INTO activity_log VALUES('40','Standing','10:11','10:15');

    INSERT INTO activity_log VALUES('40','Walking','10:16','10:20');

    INSERT INTO activity_log VALUES('40','Walking','10:21','10:25');

    INSERT INTO activity_log VALUES('40','Walking','10:26','10:30');

    INSERT INTO activity_log VALUES('40','Sitting','10:31','10:35');

    INSERT INTO activity_log VALUES('40','Sitting','10:36','10:40');

    INSERT INTO activity_log VALUES('40','Sitting','10:41','10:45');

    INSERT INTO activity_log VALUES('40','Standing','10:46','10:50');

    INSERT INTO activity_log VALUES('40','Walking','10:51','10:55');

    INSERT INTO activity_log VALUES('40','Walking','10:56','11:00');

    Based on the data, the user ID 39 must be found, since it's been sitting since 09:36-10:35, which is continuous 1 hour.

    Any guidance how to do using SQL query will be of great help and appreciation.

    Thank you very much

    Kind regards

    Bilal

    So what exactly is wrong with the request that I already gave you?

    Just to remind one untested (because of lack of insert statements) rewrite according to your new data:

    with grp as)

    Select

    username

    UserRecognizedActivityID activity

    starttime

    starttime + endetime + 1

    row_number() over (partition by order of starttime userid)

    -ROW_NUMBER() over (partition of userid, UserRecognizedActivityID order of starttime)

    RN

    of activity_log

    )

    Select

    username

    min (starttime) starttime

    max (endtime) endtime

    max (activity) activity

    GRP

    Group userid, rn

    with round (max (endtime) - min (starttime) * 24 * 60) > = 59

  • SQL query to view all build profiles, properties and values.

    I am trying to create a SQL query to retrieve all our profiles of construction, their properties and their values. The output should include the build profile name, the name of the property and the property value. I found the following tables and just need to understand the appropriate query. I still think that it is a kind of JOIN.

    SELECT [Id]

    [EntityID]

    [PropertyName]

    [Valeurpropriete]

    [IsHidden]

    [IsRuntime]

    [IsEncrypted]

    FROM [VCAC_DB]. [dbo]. [GlobalProfileProperties]

    SELECT [GlobalProfileID]

    [ProfileName]

    [Description]

    FROM [VCAC_DB]. [dbo]. [GlobalProfiles]

    Does that help?

    SELECT GlobalProfiles.ProfileName, GlobalProfileProperties.PropertyName, GlobalProfileProperties.PropertyValue

    OF GlobalProfiles

    INNER JOIN GlobalProfileProperties ON GlobalProfiles.GlobalProfileID = GlobalProfileProperties.EntityID

    I also like this because it gives all the details on the individual custom properties in a profile of construction (such as IsHidden, which tells you if the DEM will treat the property):

    SELECT GlobalProfiles.ProfileName, GlobalProfileProperties.*

    OF GlobalProfiles

    INNER JOIN GlobalProfileProperties ON GlobalProfiles.GlobalProfileID = GlobalProfileProperties.EntityID

  • SQL query to retrieve a single record for each employee of the following table?

    Hi all

    Help me on the writing of SQL query to retrieve a single record for each employee of the following table? preferably a standard SQL.

    CREATE TABLE xxc_contact)

    empnum NUMBER,

    alternatecontact VARCHAR2 (100),

    relationship VARCHAR2 (10),

    phtype VARCHAR2 (10),

    Phone NUMBER

    );

    insert into xxc_contact values (123456, 'Rick Grimes', 'SP', 'Cell', 9999999999)

    insert into xxc_contact values (123456, 'Rick Grimes', 'SP', 'Work', 8888888888)

    insert into xxc_contact values (123457, 'Daryl Dixon', 'EN', 'Work', 7777777777)

    insert into xxc_contact values (123457, 'Daryl Dixon', 'EN', 'Home', 3333333333)

    insert into xxc_contact values (123456, 'Maggie Greene', 'CH', 'Cell', 9999999999)

    insert into xxc_contact values (123456, 'Maggie Greene', 'CH', 'Home', 9999999999)

    expected result:

    EmpNum AlternateContact Relationship PhType Phone       

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    Thanks in advance.

    994122 wrote:

    Thank you all, that I got a result

    http://www.orafaq.com/Forum/m/620305/#msg_620305

    By Lalit Kumar B...

    Specifically, the two simple solutions provided were:

    1 using the row_number, entitled Oracle ranking based on descending order of the inside telephone each empnum group. And finally selects the lines which has least rank (of least since that order is descending for phone).

    SQL > column alternatecontact format A20;

    SQL >

    SQL > SELECT empnum, alternatecontact, relationship, phtype, phone

    2 from (SELECT a.*, row_number() over r (PARTITION BY empnum ORDER BY phone / / DESC))

    3 FROM xxc_contact one)

    4. WHEN r = 1

    /

    EMPNUM ALTERNATECONTACT RELATIONSHIP PHTYPE PHONE

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

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    2. with the help of MAX, Oracle automatically assigns the maximum phone for all the rows in each group of empnum. And finally selects the rows with the maximum phone. Order by clause is omitted here intentionally. You can find out why.

    SQL > SELECT empnum, alternatecontact, relationship, phtype, phone

    2 (SELECT a.*, MAX (phone) over (PARTITION BY empnum) rn FROM xxc_contact one)

    3 WHERE phone = rn

    4.

    EMPNUM ALTERNATECONTACT RELATIONSHIP PHTYPE PHONE

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

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    Kind regards

    Lalit

  • How can I select all instances of a component in the timeline at once without manually shift clicking on each instance?

    Title says it all!

    How can I select all instances of a component in the timeline at once without manually shift + click each instance?

    The reason why I want to do this is because I have a video clip with MANY quick cuts. So the clips are cut out and splattered everywhere. I'm color correction now and so I want to be able to select a clip around wherever it exists in the timeline so I can drag the effect on all the at once, without having to search each occurrence of the item in the timeline panel. This lot "select" would make it so I don't miss not all instances of the clip and saving a ton of time going through the timeline and Shift clicking whenever the clip is also up.

    I hope that the PP is smart enough to do this

    Thanks in advance!

    -Tim

    Choose a single instance of the element, perhaps even the first bit... and use the new Master Clip feature... Firstly here is a written explanation and a video tutorial on this operation... This is a great feature.

    Adobe Premiere Pro help. Master Clip effects

    How to apply effects to all instances of a clip. Adobe first Pro CC tutorials

    Neil

  • SQL Query to retrieve records for all after the Max Dates.

    Hello everyone,

    I am trying to retrieve the record more recent, based on the date field ( nextDate ).

    Currently, there are only 4 records in the MC_Maintenance table and two in the Machine table.

    Machine table

    MC_id             EquipID          

    1                      0227

    MC_id EquipID

    2                     0228

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

    MC_Maintenance table

    Maint_id MC_id Next_maint

    1                      2                      08/25/2010     

    2                      2                      07/01/2010

    3                      1                      2010-11-06

    4                      1                      07/11/2010

    I have am trying to accomplish is,.

    the list of the two machines of the table of the Machine with the MAX (Next_maint) control the list of MC_Maintenance results

    These are the records I want to display.

    Maint_id MC_id Next_maint

    1                      2                      08/25/2010

    4                      1                      07/11/2010                 

    Here is the SQL query

    SELECT

           MC. MC_ID as ID,

    MC.complete_Date completed.

    MC.next_maint as nextDate,.

    MC.maint_notes as noted,.

    MC.facility Facility.

    M.EquipId,.

    $m.name as the name.

    M.SerialNumber SN.

    M.dept as dept.

    M.Freq as freq

    Of MC_Maintenance MC, Machine M

            where  MC. MC_ID = M.MC_ID

    '           Using MAX (nextDate)

    Any ideas would be useful.

    TJ

    I thought it was a simple group of problem?

    SELECT M.EquipID, MC.MC_ID, Max(MC.next_maint)
    FROM MC_Maintenance MC INNER JOIN Machine M ON MC.MC_ID = M.MC_ID
    GROUP BY M.EquipID, MC.MC_ID
    
  • SQL query to retrieve only numbers to a string variable

    Dear all Experts,

    I have a requirement in one of my projects where I need to extract only the numbers present in the variable.

    for example:

    BANK_ACCOUNT_NUMBER = 12345-67890';

    BANK_ACCOUNT_NUMBER = 12345 67890';

    BANK_ACCOUNT_NUMBER = "123.456.7890";

    BANK_ACCOUNT_NUMBER = 123-A456BC7890D';


    In all these cases, I need to retrieve only numbers such as BANK_ACCOUNT_NUMBER = 1234567890 and I am looking for SQL query only.


    Please suggest me the query how to extract numeric values from varchar variable.



    Thank you

    Knockaert

      select regexp_replace('123-A456BC7890D','[^0-9]') from dual;
    

    See you soon,.

    Manik.

  • SQL query to retrieve the same record because no. boxes

    Hi all

    I have a table of Bill XXINV.

    the columns are

    INVH_NO INVH_ITEM_CODE INVH_QTY INVH_BOXES

    1122                XXITEM1                    1                    5

    1123                XXITEM2                     2                   6

    I can do a sql query so that I can retrieve the same records repeated as number INVH_BOXES.

    Select * from XXINV

    where invh_no = 1122

    output:

    INVH_NO INVH_ITEM_CODE INVH_QTY INVH_BOXES

    1122                XXITEM1                    1                    5

    Desired output:

    INVH_NO INVH_ITEM_CODE INVH_QTY INVH_BOXES

    1122                XXITEM1                    1                    5

    1122                XXITEM1                    1                    5

    1122                XXITEM1                    1                    5

    1122                XXITEM1                    1                    5

    1122                XXITEM1                    1                    5

    or

    INVH_NO INVH_ITEM_CODE INVH_QTY INVH_BOXES

    1122 XXITEM1 1 1 of 5

    1122 XXITEM1 1 2 of 5

    1122 1 3 5 XXITEM1

    1122 XXITEM1 1 4 of 5

    1122 XXITEM1 1 5 of 5

    Please suggest. Like I need to print each line in a single page to stick them on boxes so that packaging.

    Kind regards

    Afzal.

    Just add INVH_ITEM_CODE to the connection by the clause.

    Select invh_no

    invh_item_code

    invh_qty

    to_char (, 'fm99') | 'from ' | TO_CHAR (invh_boxes, 'fm99') invh_boxes

    of xxinv

    where invh_no = 1122

    connect

    by level<=>

    and prior invh_item_code = invh_item_code

    and prior sys_guid() is not null

  • Looking for a SQL query to retrieve callvariables + ECC to a RESULTS of SCRIPT EXECUTE (translation VRUS)

    Hi team,

    I'm looking for a SQL query check data (ECC + CallVariable) due to a RESULT of SCRIPT EXECUTE when you ask an external VRU with a translation route to VRU with a 'run external Script '.

    In my view, that the data are analyzed between the termination call detail + termination call Variable.

    If you have already such a SQL query I would be very grateful to have.

    Thanks and greetings

    Nick

    Omar,

    respectfully, shorten the interval of a day might not be an option for a history report ;-)

    I recommend to take a look at the following SQL query:

    DECLARE @dateFrom DATETIME, @dateTo DATETIME

    SET @dateFrom = ' 2014-01-24 00:00:00 '

    SET @dateTo = ' 2014-01-25 00:00:00 '

    SELECT

    TCV. DateTime,

    TCD. RecoveryKey,

    TCD. RouterCallKeyDay,

    TCD. RouterCallKey,

    VME. EnterpriseName AS [ECVEnterpriseName],

    TCV. ArrayIndex,

    TCV. ECCValue

    OF Termination_Call_Variable tcv

    JOIN THE

    (SELECT RouterCallKeyDay, RouterCallKey, RecoveryKey IN Termination_Call_Detail WHERE DateTime > @dateFrom AND DateTime)< @dateto)="">

    THE tcv. TCDRecoveryKey = tcd. RecoveryKey

    LEFT OUTER JOIN Expanded_Call_Variable VME ON tcv. ExpandedCallVariableID = VME. ExpandedCallVariableID

    WHERE the tcv. DateTime > @dateFrom AND tcv. DateTime<>

    With variables, you can set up your code (for example, you could write SET @dateFrom =? and let the calling application to fill in the DateTime for you).

    In addition, join two large tables with all the lines, as you did (TCD - TCV) is never a good option.

    Another aspect to consider: all the ECC is actually arrays (always), is not good to leave aside the index value (tcv. ArrayIndex).

    G.

  • Database SQL query to get all virtual machines with comments enabled customization?

    Hello

    Does anyone know of a SQL query that can be executed against the vCloud Director DB for all virtual machines who invited enabled customization?

    I can't have PowerShell to pull these data on a global scale.

    Thank you

    jkasal

    Has taken a quick...

    Select top 10 v.id, v.name, v.vapp_name, v.vc_id, v.moref, ui_vapp_vm_list_view v.guest_customize_enabled v with (NOLOCK)

    seems to have if the setting is enabled or not.

  • PBL to retrieve all instances assigned to a participant

    Hello

    I have a requirement to print a series of work items in a single PDF file. I think I may have a solution, but faced with the PBL - any help appreciated. My solution is as follows...

    * The participant will affect a number of work items by using bulk actions-> for me
    * Use a Global call a screen flow interactive
    * Screen flow activity includes PBL to retrieve all the work items that are assigned to the current user
    Take all the necessary data from the work items and move into a generation of PDF as a printing element service.

    Could someone please help with how I would recover all bodies assigned to the current user in PBL? I use Oracle BPM 10.3.

    Thank you

    Neil

    Published by: user13297570 on July 2, 2010 09:32

    Neil - try something like this to get a list of instances assigned to the current participant:

    busProcesses as BusinessProcess
    instanceFilter as InstanceFilter
    instance as Fuego.Papi.Instance
    processName as String = "/" + ""
    
    connectTo(busProcesses, url : Fuego.Server.directoryURL,
       user : "",
       password : "", process : processName)
    
    create instanceFilter
        using processService = busProcesses.processService
    
    instanceFilter.searchScope = SearchScope(participantScope : ParticipantScope.ALL,
    statusScope : StatusScope.ONLY_INPROCESS)
    
    addAttributeTo instanceFilter
        using variable = VarDefinition.PARTICIPANT_ID,
              comparator = Comparison.IS,
              value = Participant.id
    
    // list the instances
    for each inst in getInstancesByFilter(busProcesses, filter : instanceFilter) do
    
    end
    

    Dan

  • SQL Query to retrieve data in XML format with several levels

    Hello

    I'm looking to help generate XML from Oracle database. The request must contain many levels of sub...

    For example.
    Create table inventory
    (Group varchar2 (10))
    category varchar2 (10),
    ProductName varchar2 (10),
    Detail varchar2 (10));

    The output should be also present below. The data must be multiple values for each item.

    < inventory >
    < name of group 'auto' = >
    < category name 'cars' = >
    < name productname = 'Seat' >
    < details > red color < / details >
    < details > 5 seats < / details >
    < / productname >
    < / category >
    < / Group >
    < / inventory >

    Please share your ideas by retrieving data in the XML structure using SQL or PL/SQL for oracle 10 g.

    Thank you and best regards,
    Siva.

    This?

    SQL> create table t as
    with t as (
     select 'automobiles' "GROUP", 'cars' category, 'seat' productname, 'color red' details from dual union all
     select 'automobiles', 'cars', 'seat', '5 seats' from dual union all
     select 'automobiles', 'cars', 'make', 'ford' from dual union all
     select 'automobiles', 'cars', 'make', 'Toyota' from dual union all
     select 'automobiles', 'Bus', 'Model', 'volvo' from dual union all
     select 'automobiles', 'flight', 'Airbus', '400 passenger' from dual union all
     select 'automobiles', 'flight', 'Airbus', '500 mph' from dual union all
     select 'HealthCare', 'Nutrition', 'centrum', 'Organic' from dual union all
     select 'HealthCare', 'Nutrition', 'centrum', 'Chemical' from dual union all
     select 'Computers', 'Software', 'Database', 'Oracle' from dual union all
     select 'Computers', 'Software', 'Database', 'sqlserver' from dual
    )
    select * from t
    /
    Createtable successfully completed.
    
    SQL> select xmlserialize (content x.column_value indent) xml
      from xmltable('element Inventory
                     {for $g in distinct-values(ora:view("t")/ROW/GROUP)
                       return element group
                          {attribute name {$g},
                            for $c in distinct-values(ora:view("t")/ROW[GROUP=$g]/CATEGORY)
                              return element category {attribute name {$c},
                                for $p in distinct-values(ora:view("t")/ROW[GROUP=$g and CATEGORY=$c]/PRODUCTNAME)
                                  return element productname {attribute name {$p},
                                    for $d in distinct-values(ora:view("t")/ROW[GROUP=$g and CATEGORY=$c and PRODUCTNAME=$p]/DETAILS)
                                      return element details {$d}
                                                             }
                                                      }
                          }
                     }') x
    /
    XML
    --------------------------------------------------------------------------------
    
      
        
          
            
    Oracle
    sqlserver
    Chemical
    Organic
    volvo
    Toyota
    ford
    5 seats
    color red
    400 passenger
    500 mph
    1 row selected.
  • SQL query to meet all the conditions.

    ID of country client_name

    a                      india        1

    a                     US            1

    oneWE1

    b                      india         1

    c                      india        1

    c                      india         1

    c                      india         1

    c                     us             1

    c                    US            1

    If I do a count if the id of group by client_name and country column I'll get value like that...

    client_name country count (id)

    a                  india          1

    a                    US          2

    b                  india          1

    c                  india          3

    c                   US           2

    Condition of the obligation:

    (1) if the customer is in effect in several countries then show that the customer and country having count (id) > 2, (over the case it will be customer = 'b' and country India, country will be us skip)

    (2) if the customer is does not exist in several countries then show that client and default country (in above cases it will be customer = 'b') while count (id) is less than 2., we show him...

    Catch for me is :-also, we should not ignore any customer... so, as in a. customer... as count (id) for the two countries is not more than 2... so, as per above logic... this client will ignore if we apply only above two conditions

    but we need to show the customer in this case... and take the two value... so my end result I need will be:

    customer country

    a India

    a                    US

    b the India

    c India

    Please suggest the query to achieve even... I am able to get the query that meets condition 1 and condition 2. but failure to have taken also in request... so in my query output is all above, except customer one is ignored

    Thank you very much!

    Hello

    I think I see.  You want to display the lines of 'best' available for any client, where the lines with a COUNT (*) 2 > are 'better' than the lines with COUNT (*) <= 2. ="" if="" a="" client="" has="" any="" rows="" with="" count="" (*)="">2, then to display the lines were COUNT (*) > 2, but if all the lines for a customer have COUNT (*)<= 2,="" then="" those="" are="" the="" "best"="" rows="" available,="" so="" you="" want="" to="" show="" them. ="" how="" many="" different="" countries="" a="" client="" is="" related="" to="" doesn't="">

    I always CREATE TABLE and INSERT statements for your sample data, so I'll we table scott.emp to illustrate.  Instead of customer and country, as at your table, we will use deptno and job.  This query:

    SELECT deptno, job

    AS cnt ACCOUNT (*)

    FROM scott.emp

    GROUP BY deptno, job

    ORDER BY deptno, cnt

    ;

    display the relevant data, i.e.:

    DEPTNO JOB CNT

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

    10. THE CHAIRMAN 1

    MANAGER 10 1

    10 1 CLERK

    20 MANAGER 1

    20 2 ANALYST

    20 CLERKS 2

    30 1 CLERK

    30 1 MANAGER

    30 4 SELLER

    But we don't want to show all the data.  We want to only show the best available for each deptno line type, where the lines with the cnt > 2 (let's call these lines of class 'A') are better then with the NTC<= 2="" (let's="" call="" these="" class="" 'b'="" rows.) ="" the="" output="" we="" want="">

    DEPTNO JOB CNT

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

    10. THE CHAIRMAN 1

    10 1 CLERK

    MANAGER 10 1

    20 CLERKS 2

    20 MANAGER 1

    20 2 ANALYST

    30 4 SELLER

    Deptnos 10 and 20 only have rows of 'B' class, if we want to display the lines of 'B' class for these deptnos.  DEPTNO 30 has at least 1 row of class 'A', so we only show the lines of 'A' class of deptno = 30.  This is an example of a Query of Top - N, and here's a way to do it:

    WITH got_r_num AS

    (

    SELECT deptno, job

    AS cnt ACCOUNT (*)

    DENSE_RANK () OVER (PARTITION BY deptno

    ORDER OF CASES

    WHEN COUNT (*) > 2

    THEN "A".

    OF ANOTHER 'B '.

    END

    ) AS r_num

    FROM scott.emp

    GROUP BY deptno, job

    )

    SELECT deptno, job, cnt

    OF got_r_num

    WHERE r_num = 1

    ;

  • Help me with SQL Query to retrieve data from a view

    Hello Guru,

    I need help in my sql query.
    I use SQL TeraData.
    I want an Oracle result in the following form-

    Open tickets
    Open months failure / Repair Service s/o improvement request Total general
    2009-01-2 4 4 5 15
    2009-02 1 0 2 3 6
    2009-03 4 1 2 2 9
    Grand Total 7 5 8 10 30


    I wrote the query as where - TIME_PERIOD, RQST_TYPE_DM and DEMAND_SUMMARY_FCT are the points of view and I extract the data from the views only.

    Select NVL (CA. TIME_PERIOD. PERIOD_CD, 'Total') THAT year.
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% of Break' THEN 1 END) as BreakFix
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'N/a', 1 END) by n/a
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'Improvement' THEN 1 END) accessories
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% Service' THEN 1 END) as ServiceRequests
    COUNT (CA. RQST_TYPE_DM. RQSTTYP_DESC) AS grand_total
    FROM CA. TIME_PERIOD, CA. RQST_TYPE_DM, CA. DEMAND_SUMMARY_FCT
    WHERE (CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = CA. RQST_TYPE_DM. RQSTTYP_ID)
    AND (CASE
    WHEN CA. DEMAND_SUMMARY_FCT. MONTH_ID = CA. TIME_PERIOD. PERIOD_ID, 1
    WHEN {fn concat ({fn concat (SUBSTR (CA. TIME_PERIOD. {(PERIOD_CD, 3, 4),'-')}, SUBSTR (CA. TIME_PERIOD. PERIOD_CD, 7, 2))} BETWEEN ' 2009-01' AND ' 2009-03' THEN 1
    WHEN CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = '1' then 1
    END) = 1
    GROUP BY ROLLUP (CA. TIME_PERIOD. PERIOD_CD)

    After executing the query, I get the following error:
    3076: syntax Error: Data Type 'Time' does not match a defined Type name.
    :( Kindly help me with this and let me know where I'm wrong... Please.

    Messages indicates something wrong with your data... It would seem that the data does not match your format mask.

    Thus, the data or the format mask.

  • How to hide all instances of a symbol before the display?

    For reasons that I won't detail here, I don't want to use a calendar for a particular project.  I manage a style and visibility in the code.

    Until the composition is visible, I need to adjust the opacity of all instances on the stage of a symbol for zero.  I guess it can be done in a single line of code.

    Is the definitive documentation for EA?: http://www.Adobe.com/devnet-docs/edgeanimate/API/current/index.html

    THX in advance,

    Doug

    Hi, bdggr-

    Yes, the API.  You can use call getSymbols() of the composition.  Here is an excerpt of code that might be able to help.

    var symArray = sym.getComposition () .getSymbols ("symbolDefinitionName");

    for (var i = 0; i)< symarray.length;="" i++)="">

    symArray [i] .getSymbolElement () .hide ();

    }

    -Elaine

Maybe you are looking for