Help needed in Count Logic

Hi Following are my table structure and data . i have two column( No.of.Fields , Text)
No.of.Fields | Text
8 | YYYYYYYY
6 | YYYYYY
4 | NNNN
3 | NNN
2 | YYYYY
i want a sample query to validate the no.field count and Text char count matches. if that doesn't match i want to get the particular record details.
In the above sameple no.of field 2 has exceeds char count. actual text shoulod be "YY".
so please help me to identify the rows which has non matached. i have more than 500 records in the table. please help me on this by providing the sample.

Hi.
>
Don't forget about NULLs:
>
Thanks you're right, it depends on how he want to deal with nulls, e.g. if we assume that nulls have a length of 0
Here's one way:
WITH data AS
     SELECT 8 n,'YYYYYYYY' string FROM DUAL UNION ALL
     SELECT 6 n,'YYYYYY' string FROM DUAL UNION ALL
     SELECT 4 n,'NNNN' string FROM DUAL UNION ALL
     SELECT 3 n,'NNN' string FROM DUAL UNION ALL
     SELECT 2 n,'YYYYY' string FROM DUAL UNION ALL
     SELECT 8 n,'YYYYYYY' string FROM DUAL UNION ALL
     SELECT 6 n,'YYYYY' string FROM DUAL UNION ALL
     SELECT 4 n,'NNN' string FROM DUAL UNION ALL
     SELECT 3 n,'NN' string FROM DUAL UNION ALL
     SELECT 2 n,'YYYY' string FROM DUAL UNION ALL
     SELECT 0 n,null string FROM DUAL UNION ALL
     SELECT 1 n,null string FROM DUAL
SELECT
     n,
     string,
     NVL(LENGTH(string),0) ls
FROM data
WHERE n != NVL(LENGTH(string),0);
N     STRING     LS
2     YYYYY     5
8     YYYYYYY     7
6     YYYYY     5
4     NNN     3
3     NN     2
2     YYYY     4
1     (null)     0Best regards.

Similar Messages

  • Help Needed in Relational logic

    Hi
    Working in 2008 R2 version.
    Below is the sample data to play with.
    declare @users table (IDUser int primary key identity(100,1),name varchar(20),CompanyId int, ClientID int);
    declare @Cards table (IdCard int primary key identity(1000,1),cardName varchar(50),cardURL varchar(50));
    declare @usercards table (IdUserCard int primary key identity(1,1), IDUser int,IdCard int,userCardNumber bigint);
    Declare @company table (CompanyID int primary key identity(1,1),name varchar(50),ClientID int);
    Declare @client table (ClientID int primary key identity(1,1),name varchar(50));
    Declare @company_cards table (IdcompanyCard int primary key identity(1,1),CompanyId int,IdCard int)
    Declare @Client_cards table (IdclientCard int primary key identity(1,1),ClientID int,IdCard int)
    insert into @users(name,CompanyId,ClientID)
    select 'john',1,1 union all
    select 'sam',1,1 union all
    select 'peter',2,1 union all
    select 'james',3,2
    Insert into @usercards (IdUser,IdCard,userCardNumber)
    select 100,1000,11234556 union all
    select 100,1000,11234557 union all
    select 100,1001,123222112 union all
    select 200,1000,2222222 union all
    select 200,1001,2222221 union all
    select 200,1001,2222223 union all
    select 200,1002,23454323 union all
    select 300,1000,23454345 union all
    select 300,1003,34543456;
    insert into @Cards(cardName,cardURL)
    select 'BOA','BOA.com' union all
    select 'DCU','DCU.com' union all
    select 'Citizen','Citizen.com' union all
    select 'Citi','Citi.com' union all
    select 'Americal Express','AME.com';
    insert into @Client(name)
    select 'AMC1' union all
    select 'AMC2'
    insert into @company(name,ClientId)
    select 'Microsoft',1 union all
    select 'Facebook',1 union all
    select 'Google',2;
    insert into @company_cards(CompanyId,IdCard)
    select 1,1000 union all
    select 1,1001 union all
    select 1,1002 union all
    select 1,1003 union all
    select 2,1000 union all
    select 2,1001 union all
    select 2,1002;
    Requirement : 
    1. Get the distict Users card details. the reason for using distinct is, user can have same card multiple with different UserCardNumber.
    Ex : user can have more than BOA card in the @usercards table with different UserCardNumber. But though he has two BOA card, my query should take one row.
    2. After the 1st step, i need to check if any details on @company_cards based on Users companyId.If yes then selct the details from @company_cards. if not select it from @client_cards
    In this case we need to make sure that we shouln't have repeated data on @FinalData table. 
    My Logic:
    Declare @FinalData table (IDCard int,CardName varchar(50),CardURL varchar(50))
    declare @IdUser int = 100, @ClientID int,@companyID int;
    select @ClientID = ClientID,@companyID = CompanyId from @users where IDUser = @IdUser;
    insert into @FinalData (IDCard,CardName,CardURL)
    Select distinct c.IdCard,c.cardName,c.cardURL from @usercards UC join @Cards C on(uc.IdCard = c.IdCard)
    where IDUser=@IdUser;
    if exists(select 1 from @company_cards where @companyID = @companyID)
    BEGIN
    insert into @FinalData(IDCard,CardName,CardURL)
    select c.IdCard,c.cardName,c.cardURL from @company_cards cc join @Cards c on(cc.IdCard = c.IdCard) where CompanyId = @companyID
    and cc.IdCard not in(select IDCard from @FinalData);
    END
    ELSE
    BEGIN
    insert into @FinalData(IDCard,CardName,CardURL)
    select c.IdCard,c.cardName,c.cardURL from @client_cards cc join @Cards c on(cc.IdCard = c.IdCard) where ClientID = @ClientID
    and cc.IdCard not in(select IDCard from @FinalData);
    END
    select * from @FinalData;
    the logic produces the valid result. Is there any alternative way to achieve this logic. I feel there might be some proper way to query this kind of logic. any suggestion please.
    [the sample schema and data i provided just to test. i didn't include the index and etc.]
    loving dotnet

    You can simply merge the statements like below
    Declare @FinalData table (IDCard int,CardName varchar(50),CardURL varchar(50))
    declare @IdUser int = 100
    ;With CTE
    AS
    Select IdCard, cardName, cardURL,
    ROW_NUMBER() OVER (PARTITION BY IdCard ORDER BY Ord) AS Seq
    FROM
    Select c.IdCard,c.cardName,c.cardURL,1 AS Ord
    from @usercards UC join @Cards C on(uc.IdCard = c.IdCard)
    where IDUser=@IdUser
    union all
    select c.IdCard,c.cardName,c.cardURL,2
    from @company_cards cc join @Cards c on(cc.IdCard = c.IdCard)
    join @users u on u.CompanyId = cc.CompanyId
    where u.IDUser = @IdUser
    union all
    select c.IdCard,c.cardName,c.cardURL,3
    from @client_cards cc join @Cards c on(cc.IdCard = c.IdCard)
    join @users u on u.ClientID= cc.ClientID
    where u.IDUser = @IdUser
    )t
    insert into @FinalData (IDCard,CardName,CardURL)
    SELECT IdCard, cardName, cardURL
    FROM CTE
    WHERE Seq = 1
    select * from @FinalData;
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Help needed on the logic used to display ERP Sales order in CRM WEB UI

    Hi,
    I have a requirement where i need to trigger an activity/workflow in CRM for orders that are created through ERP Salesorder functionality. In the workflow list, we need to give the order description and provide an hyperlink to the order number. on selection of order number, it should display the ERP sales order. To achive this in workflow, i am trying to understand the as-is standard functionality which is available in Agent Inbox search on ERP sales order.This search is getting the ERP orders and on selecting the order it is opening the ERO sales order page. I tried debugging the method GET_MAINCATAEGORY available in the component iccmp_inbox and in the view Inboxsearch.But couldnt really able to crack the logic how it is retrieving the ERP sales order from inbox search. Any pointers on how this is achieved will be of great help.
    Thanks,
    Udaya

    Hi Denis,
    very good idea. I thougt myself about that workaround, but it is not really that for what I searched.
    I mean the "SAP Query" is a really good standard tool, that are used by many customers. That is why think there must be a standard way to display the SAP Query in the Web UI without using Transaction Launcher.
    But it seems that there is no way, except of the transaction launcher or by using an additional analyse system like SAP BI.
    By the way do you know a Web UI compoment which enable the user to start reports like SE38?
    Regards
    Fabian

  • Help Needed in Date Logic

    Hi I am working in sqlserver 2008 R2 and below is my sample research query
    i am trying to get previous 6 months data.
    WITH CutomMonths
    AS (
    SELECT UPPER(convert(VARCHAR(3), datename(month, DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N, 0)))) Month
    ,DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N, 0) startdate
    ,DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N + 1, 0) enddate
    FROM (
    VALUES (1)
    ,(2)
    ,(3)
    ,(4)
    ,(5)
    ,(6)
    ) x(N)
    WHERE N <= 6
    SELECT month
    ,SUM(isnull(perks.amount,0)) AS PerkAmount
    FROM CutomMonths
    LEFT JOIN (
    select 10.00 as amount,'2014-04-03' as StartDate,'2015-04-03' as EndDate union all
    select 10.00 as amount,'2014-04-03' as StartDate,'2015-04-03' as EndDate
    ) perks ON
    CutomMonths.startdate >= perks.StartDate
    AND CutomMonths.startdate < perks.EndDate
    GROUP BY CutomMonths.Month
    ,CutomMonths.startdate
    ORDER BY CutomMonths.startdate ASC
    current output what i am getting:
    Expected Output:
    I found why the April month i din't get the $20 because the startdate of my perks CTE '2014-04-03'. If it is '2014-04-01' then i will get the expected output.
    But i should not change the the date on perks. How to neglect this date issue and consider the month instead to get the expected output. please help me on this as i am struggling on my logic 
    loving dotnet

    I'm just going to focus on the JOIN criteria in this reply since my answer above and your 2nd response are essentially the same except for the JOIN.
    What your are describing and what you are doing in code is conflicting. 
    You are saying this:
    "I just need to check whether the perks start date falls in between month start date and month end date"
    ..., which translated directly to code would be this:
     ON perks.StartDate >= CustomMonths.StartDate
    AND perks.StartDate <= CustomMonths.EndDate
    What I believe you are getting after is this:
    "I just need to check whether the dates within the perks start and end date range fall in between month start date and month end date"
    ..., which translated directly to code would be this, which is also my answer proposed above:
    ON CustomMonths.StartDate >= DATEADD(DAY, -(DAY(perks.StartDate) - 1), perks.StartDate)
    AND CustomMonths.StartDate <= perks.EndDate
    However, if you really want to use the code solution you proposed, then you would actually be saying this:
    "I just need to check whether the dates within the perks start and end date range fall in between month start date and month end date, but if perk end date happens to be the first day of the month, then ignore it and use the previous day."
    ..., in which case then your code, as follows, would be the solution:
     ON CutomMonths.startdate >= DATEADD(mm, DATEDIFF(mm, 0, perks.StartDate), 0)AND CutomMonths.startdate < DATE
    ADD(mm, DATEDIFF(mm, 0, perks.EndDate), 0)
    NOTE: The alternate JOIN I had commented out in my proposed answer above will do the exact same thing as your latest proposed solution
     ON CustomMonths.StartDate >= DATEADD(DAY, -(DAY(perks.StartDate) - 1), perks.StartDate)
    AND CustomMonths.StartDate < perks.EndDate
    BTW, I see how you are getting to the first day of the month by subtracting all the months from the given date to 01/01/1901, and then turning around and adding them all back to 01/01/1901.  While that is one way to get to the first day of the month, it
    seems excessive from a calculation stand point, although I haven't performed any performance tests to know for certain.
    SELECT DATEADD(mm, DATEDIFF(mm, 0, '2014-04-03'), 0)
    I prefer simply subtracting one less than the current day number from the given date to get to the same first day of the month value.
    SELECT DATEADD(DAY, -(DAY('2014-04-03') - 1), '2014-04-03')

  • Help needed in business logic implmentation in oracle sql.

    I got a requirement from customer that i need to generated numbers based on first value which is entered by users but not second values..
    for example:
    c1 c2
    1 1
    2 1
    3 1
    4 1
    1 2
    2 2
    3 2
    4 2
    1 3
    2 3
    3 3
    4 3
    1 4
    2 4
    3 4
    4 4
    1 5
    2 5
    3 5
    4 5
    unlimited..
    the user input only first column values which comes from UI and i need to provide second column values when records are getting inserted into db table.
    user always enter only 1-4 values in first column but never input second values in second column of table.. both columns are numerical.
    the second values should be provided automatically or programmatically when records are getting inserted into table and automatically... how this can be done?
    Can any one help me out to get this done either using sql,plsql concept?
    thanks a lot in advance.

    Hi,
    Demonstration
    SQL> DROP TABLE t1;
    Table supprimée.
    SQL> CREATE TABLE t1 (c1 NUMBER, c2 NUMBER);
    Table créée.
    SQL>
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1  (c1) values(2);
    1 ligne créée.
    SQL> insert into t1 (c1) values(3);
    1 ligne créée.
    SQL> insert into t1 (c1) values(4);
    1 ligne créée.
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1 (c1) values(2);
    1 ligne créée.
    SQL> insert into t1 (c1) values(3);
    1 ligne créée.
    SQL> insert into t1 (c1) values(4);
    1 ligne créée.
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1 (c1) values(2);
    1 ligne créée.
    SQL> commit;
    Validation effectuée.
    SQL>
    SQL> CREATE OR REPLACE VIEW view_t1
      2  AS
      3     SELECT c1, ROW_NUMBER () OVER (PARTITION BY c1 ORDER BY c1) c2
      4       FROM t1;
    Vue créée.
    SQL>
    SQL>
    SQL> SELECT   c1,c2
      2      FROM view_t1
      3  ORDER BY c2, c1;
            C1         C2
             1          1
             2          1
             3          1
             4          1
             1          2
             2          2
             3          2
             4          2
             1          3
             2          3
    10 ligne(s) sélectionnée(s).
    SQL>

  • Help needed in the logic

    i hav select query like this:-
    SELECT COUNT(*) INTO NO_OF_WORKERS FROM PA0000
    WHERE ENDDA = '99991231' AND STAT2 = '3'.
    with this select query , i can get the no. of workers .
    How can i get the no. of workers in the recording period <u><b>excluding</b></u> those persons who were absent from work on paid/unpaid leave for the entire period?

    Hi Hari,
    I got the solution for you.use the following sql query.
    SELECT COUNT(*) INTO NO_OF_WORKERS
    FROM PA0000 AS a inner join PA2001 as b on apernr = bpernr
    WHERE aENDDA = '99991231' AND aSTAT2 = '3'
    and ( bawart = '0100' or bawart = '0727' ).
    Now onething, in my comapany, in PA2001, field awart = '0100' means paid leave and 0727 means unpaid leave.
    this things r configured in SPRO. so must replace the values of awart in sql qurey as per the values of paid/unpaid leave in your company.
    you can do one thing, go to infotype pa30..then put 2001 in the infotype field in that screen, put cursor in STy field , hit F4 , it will show you the value for paid unpaid leave.
    Note the value , modify the value of awart field inthe sql query, thats it.
    cheers, and hey dont forget to give reward points.

  • Help needed on Mapping logic

    Hi guys,
    I have logic like,
    pernr>logic>pernr.
    Pernr is the first field.
    Whenever the logic fails, it should not process rest of the below fields.
    it should directly go to next record.
    Any ideas.......
    santosh.

    You can achieve this using gloval variable.
    1. right click on the parent node  of pernr. -
    >Add Variable (say ifPernrTrue)
    2. Map this variable with the same logic and give value "true" if logic successful and "false" if logic fails
    Whenever the logic fails, it should not process rest of the below fields.
    3.Map rest of fields as :
    ifPernrTrue (the variable u created) \
    >   if  (without else )  -
    > fields...
                   source filed     /

  • Help needed Regarding a business logic

    Hi all,
    My business requirement is
    requires to get a checksum from the KIOSK field. This would be something like a rule that for a given KIOSK generates a number from 0 to 9.
    The Field value contains alphanumerical
    Can any of guys help me in this logic.how to generate a checksum for a given field..
    Thanks & Regards;
    Vinit

    Alright I found something  I am not  sure if it is of use to you , A checksum is generally used to  detect the integrity of file
    it is calculated oin basis of hash algorithms so  how it is useful to for incoming filed values i m not  sure
    Please find the links below
    http://en.wikipedia.org/wiki/Checksum
    http://www.fastsum.com/support/online-help/checksums.php
    http://www.flounder.com/checksum.htm
    http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/
    If it is useful , you need to implement a hash algorithm
    regards
    Ninad

  • Want to use Logic 8 Pro for Podcasting, help needed

    I have a few problems. I just switched over to Logic after using ProTools for 4 years so I'm a newbie. I'm about to start a podcast soon and I want to use Logic 8 Pro to do so. Is there a book that someone can recommend me for getting familiar with Logic?
    Here are the things I need to get done:
    I have a mixer and I need to know how to record the sounds playing through my computer to end up in Logic. I basically want to be able to capture the audio playing on my computer and have that be on the podcast. How do I do this?
    Secondly, I'm confused about what Input 1 and Input 2 are. What is the difference?
    I'd appreciate anyone who could IM me to help me further with Logic if I have a quick question or anything. My AIM screen name is DirtyVibes. Any help would be appreciated.
    Thank you,
    -RandomSkater

    Is there a book that someone can recommend me for getting familiar with Logic?
    Yes, the Getting Started manual, you can download it from Apple.
    I have a mixer and I need to know how to record the sounds playing through my
    computer to end up in Logic. I basically want to be able to capture the audio
    playing on my computer and have that be on the podcast. How do I do this?
    I'm not sure what you are asking here. If you want to record the whole output of your computer, I recommend using a virtual audio driver like Soundflower or Jack.
    Secondly, I'm confused about what Input 1 and Input 2 are. What is the difference?
    Input 1 is the input marked "1" on your audio interface (or the left channel on a stereo pair).
    Input 2 is the input marked "2".
    If your audio interface has more than 2 inputs, they will all show up, so you can record different inputs to different tracks if required.
    You might be better off using Garageband to record your podcasts, it's simpler and has dedicated podcast functions (like adding iTunes artwork and so on).

  • HT1338 Macbook pro two days old...bought logic from app store...logic has installed partly each time i open it up it wants to download rest of programme then stops half way thru and gets error message 'logic is unable to continue with download' help neede

    Macbook pro two days old...bought logic from app store...logic has installed partly each time i open it up it wants to download rest of programme then stops half way thru and gets error message 'logic is unable to continue with download' help needed !

    Hello:
    I would trot back into the Apple store and have them fix the problem (or call Applecare with a warranty issue).  There is no sense in you wasting your time trying to troubleshoot things on a new computer.
    Barry

  • Help needed about character counting

    I need to count the characters in a file and I can do it
    though I need to specify which letter is the most significant,
    I couldn't find a good way of programming it,
    can anybody help?
    Thank you

    I hope it makes sense and I hope you can helpSure. Have a look at the following little class:public class CharCount implements Comparable {
       private char chr; // the character itself
       private int freq; // the number of times it occurred
       public CharCount(char chr) { this.chr= chr; }
       public char getChar() { return char; }
       public void inc() { freq++; }
       public boolean equals(Object obj) { return compareTo(obj) == 0; }
       public int hashCode() { return char+freq; }
       public int compareTo(Object obj) {
          CharCount that= (CharCount)obj;
          if (this.freq < that.freq) return -1;
          if (this.freq > that.freq) return  1;
          return this.chr-that.chr;
       public String toString() { return ""+chr; }
    }... most of this class is just the obligatory hullabaloo except for the
    compareTo method: if 'a' occurs more often than 'b', 'a' is considered
    larger. if both frequencies are equal it considers 'b' larger than 'a'
    lexicographically.
    Next we implement a map that uses a Character as its key and
    a CharCount as the associated value. This class can count all
    characters being fed to it:public class CharConsumer {
       private Map map= new HashMap();
       public void feed(char chr) {
          Character key= new Character(chr);
          CharCount cc= map.get(key);
          if (cc == null)
             map.put(key, cc= new CharCount(chr));
          cc.inc();
       public SortedSet getCharacters() {
          return new TreeSet(map.values());
    }... this class just updates the map when it receives another character.
    The trickery-dickery can be found in the last method which can all be
    explained if you read the corresponding API documentation.
    kind regards,
    Jos

  • Need help pulling unrelated counts into a report

    Post Author: tminner
    CA Forum: Crystal Reports
    Right now I'm using Crystal 9 to create Performance Reviews for all our employees (about 400/month) and everything is fine except I need 4 counts for tardies, warnings, absences, and suspensions.  Of course these are kept in unrelated tables for example I'm counting tardies from VP_TIMESHEETCOMMENTS.comments = "Tardy-Late for Work" and absences from VP_TIMESHEETCOMMENTS.comments = "Absent". 
    When I create running totals for these it works fine, however when I try to count warnings from EVENTS.event = "Warning" then all my running totals give me wrong information.
    What would be a better way of doing this?  I'm also grouping by person ID and have the entire Performance Review in the group footer.  I just need accurate counts for the last year.  Please help....
    Tim

    Post Author: crimson
    CA Forum: Crystal Reports
    Try this:
    If you are grouping on 'person ID' in your main report, group on 'person ID' in your subreport. Then from your main report, Right Click on the subreport. Click on Change Subreport Links. Set up a subreport parameter field 'person ID' and it will create a parameter field in the subreport (ex: ?Pm-person_ID) that ties it to the group value in the main report. Be sure and click on the checkbox that says "Select data in subreport based on field:" with the person ID field name right underneath it.

  • Need help regarding Cycle counting

    Hi All,
    I need your help regarding cycle counting process in SAP PI. The scenario is as follows,
    At present in the legacy system business practice is to count certain number of materials say 100 materials every day. Out of these 100 materials; we keep fixed percentage for the materials to be counted i.e. out of 100 certain percentage will of A material, certain percentage will of B materials like wise.
    Also every day we want to generate a list of these 100 materials to be counted (this list can be handed over to inventory person to physically count the material) and  generation of PI documents to subsequently post the count results.
    Please note that we will be manually assigning cycle count indicator (A or B or C etc) in the material master.
    Thanks,
    Attarde

    from OSS Note 518418 - FAQ: Cycle Counting
    3. Question:
    I do not understand the determination of the date of physical inventory in the cycle counting physical inventory. How is the planned date or the date of physical inventory determined in the SAP system?
    Answer:
    In principle, the program calculates the planned date of physical inventory according to the following formula:
       planned date = base date + Interval (Trans.OMCO/Tab.XT159C-ININV)
    Usually, the base date is the 'date of the last physical inventory'. Depending on the type of the stock or the batch management requirement, this date is read from one of the following table fields:
      MARD-DLINL (Normal materials)
       MCHB-CHDLL (Batch materials, separately valuated materials)
    If no physical inventory has been carried out yet and if this date field is therefore empty, the system uses the creation date of the material as basis date. The basis date then comes from one of the following table fields:
      MSTA-ERSDA (Normal materials)
       MCHB-ERSDA (Batch materials, separately valuated materials)
    Since the cycle counting physical inventory always runs for the current fiscal year, the earliest possible physical inventory date is the 01.01. and the latest possible physical inventory date is the 31.12 of the current year.
    If the date of the physical inventory is a non-working day, the program automatically proposes the next possible workday.

  • Need help with voltage counter

    I have a system that passes current through a resistor when ever a button is pushed.  The voltage across the resistor (about 100mV) is read by a cFP-AI-102 Analog Input voltage module.  I'm trying to figure out a way to count the number of times this happens.  In other words, I need to count how many times the button is pushed.
    I've tried using a While Loop, but since it counts with every iteration I end up with way too many counts for each button push.  Is there a way I only count once?
    Thanks,
    Eric

    Hi!
       If I understand, you want to measure how many times button is pushed, i.e. how many transition 0 -> 100 mV, right?  I'd do that with a shift register and a while loop.... just save the past state of the analog in, if the comparison between the past state and curtrent state is > 50 mV, you have a push.... (actually it depends on how terminals are connected...)
     Post your code, perhaps I can understand better the starting point. 
       remember: this way you're going to measure too many transitions, because usually, when a button is pressed or released you have some oscillating voltage (I don't know if you ever tried to handle a switch button with a microcontroller, there you can see this).  But maybe, AI module sample at "low frequencies" respect to this phenomenon.
    graziano

  • Help need in writing a logic/proc

    SELECT   TRACK_NUM, MIN(sub_account) AS START_KEY, MAX(sub_account) AS END_KEY
      FROM (
                  SELECT to_number(sub_account) as sub_account,
                  RANK() OVER (PARTITION BY sub_account
                  ORDER BY ROWNUM) AS ROW_INSTANCE,
                  NTILE(  20  ) OVER (ORDER BY sub_account) AS TRACK_NUM
                  FROM  STG_SUB_MASTER_MONTH_HISTORY)
                  WHERE ROW_INSTANCE = 1
                  GROUP BY TRACK_NUM ;The above sql gives result set like
    TRACK_NUM     START_KEY     END_KEY
    1     200000028     2095931954
    2     2095932501     5067004214
    3     5067004346     1.1092E+10
    4     1.1092E+10     2.1028E+10
    5     2.1028E+10     2.3078E+10
    6     2.3078E+10     2.9010E+10
    7     2.9010E+10     3.1089E+10
    8     3.1089E+10     3.3051E+10
    9     3.3051E+10     3.4081E+10
    10     3.4081E+10     3.7014E+10
    11     3.7014E+10     3.7067E+10
    12     3.7067E+10     4.1006E+10
    13     4.1006E+10     4.5040E+10
    14     4.5040E+10     4.9047E+10
    15     4.9047E+10     5.2030E+10
    16     5.2030E+10     6.4578E+10
    17     6.4578E+10     7.1001E+10
    18     7.1001E+10     7.1035E+10
    19     7.1035E+10     7.2048E+10
    20     7.2048E+10     7.9553E+10Now i have to pass these start key and end key to my below code
    Insert into /*+ Parallel (A,8) append */ Sub_phone_Rateplan_fss A
    SELECT /* Index(Sub, IDX_Sub_hist)*/
                    sub.MARKET_CODE        ,
                            sub.SUB_CTYPE ,
                            phn.PH_BASIC_SRV        ,
                            sub.MONTH_ID  ,
                             sub.SUB_ACCOUNT        ,
                            sub.SUB_LAST_NAME     ,
                           sub.SUB_FIRST_NAME   ,
                            SUB.WS_ENTRY_DATE AS SUB_WS_ENTRY_DATE   ,
                            sub.WS_DISC_DATE       ,
                            sub.SUB_DISC_REASON ,
                            sub.SUB_BILL_CYCLE    ,
                            sub.SUB_MUN_CODE     ,
                            sub.SUB_30DAY_BAL     ,
                            sub.SUB_60DAY_BAL     ,
                            sub.SUB_90DAY_BAL     ,
                            sub.SUB_OVR90_BAL     ,
                            sub.SUB_WRTOFF_AMT ,
                            sub.SUB_BALANCE_DUE ,
                            sub.SUB_CURRENT_BAL ,
                            sub.SUB_STATUS,
                            phn.PH_MOBIL_ID         ,
                            phn.WS_ESN_UN           ,
                            phn.WS_START_DATE    ,
                            phn.WS_STOP_DATE      ,
                            PHN.WS_ENTRY_DATE AS PHN_WS_ENTRY_DATE   ,
                            phn.PH_STATUS            ,
                            phn.PH_FEAT_CODES     ,
                            phn.PH_MODEL  ,
                            phn.CRICKET_LOCATION_ID_KEY           ,
                            phn.FEATURE_SET_ID 
                         -- NTILE(10) OVER(PARTITION BY SUB.SUB_ACCOUNT ORDER BY SUB.SUB_ACCOUNT) AS NT
                        FROM STG_SUB_MASTER_MONTH_HISTORY SUB, STG_PHN_MASTER_MONTH_HISTORY PHN
                        WHERE
                        --SUB.MONTH_ID = PHN.MONTH_ID
                         SUB.SUB_ACCOUNT = PHN.PH_ACCOUNT 
                         And to_number(SUB.Sub_Account)  BETWEEN   @startkey and  @endkey;
                                          Commit;can anyone help me getting the logic or the procedure since i have to use the result set provided above by the first query.
    Message was edited by:
    Vakeel

    Hi, Vakeel,
    The usual way of using the results of one query in another is to join the two queries. Sometimes it's easier to do a corellated sub-query instead. I can't tell which is the best way for you, or exactly how to do it, because I don't understand exactly what results you want.
    Please post a few rows of sample data and the results you want to get from that data. Simplify as much as possible. For example, post a query that uses NTILE (4) instead if NTILE (20). (If you know how to solve one, you can solve the other.)
    Another example: only select a couple of columns in the second query.

Maybe you are looking for

  • Ipod classic won't download music into itunes

    When I attach my ipod classic to my computer/itunes, it won't allow me to transfer the music or playlists from my ipod to itunes. However, it allows my itouch to transfer music into itunes.

  • Message queue like in C++ threads

    Hi, I have a question. Does java support threads sending messages to each other like in C++ threads on Windows? On Win32, a thread sends message to another thread. This message gets queued up in a message queue, I think, by the OS. The receiver threa

  • Why CanPutXMP Fail

    i wrote this code, when i try this code with jpg file, it works, but when i try it with gif file, the CanPutXMP return false, can you help? thank you very much open file using SXMPFiles myFile the file is opened. then i tried to add a new name-value

  • Window component drag issue

    Hi all, I've got a problem with a Flash application I'm developing. I'm creating an application with multiple nested screens, each of these screens is a Window component. The problem that I'm having is that if I move a Window by dragging it then set

  • Fetch From UWL to WD view :UWL Exception Logged in users context or session

    Hi, We have a requirement in which , we need to fetch all UWL Items and need to display these in a webdynpro view. We tried based on this link [Custom UWL|http://searchsap.techtarget.com/tip/0,289483,sid21_gci1240907,00.html]. Coding What I have Trie