Finding literals

hi ,
I used following syntax to find all text literals in a given code:
SCAN ABAP-SOURCE gt_source
                INCLUDE PROGRAM FROM 'ZTEST_AM_ALV2'
                TOKENS INTO gt_tokens
                STATEMENTS INTO gt_stmts.
loop at gt_tokens into w_tokens where type = 'S'.
This gives all text literals ie '.........' , i want to also filter out all literals with text element assigned to them.eg ' Hello World',(001).
Literals like this shld be filtered out and only literals with no cooresponding Text element assigned to them should b obtained.
Thanks.

Hi..,
parameter: p_report type SY-REPID .
data :
t_sourcetab type standard table of D022S,
wa_line(72) type c,
w_char type c '''.
READ REPORT p_report INTO t_sourcetab.
Loop at t_sourcetab into wa_line.
search wa_line for w_char.
if sy-subrc eq 0.
write : 'Column:', sy-fdpos, 'Line.no:' , sy-tabix.
endif.
endloop.
regards,
sai ramesh

Similar Messages

  • Procedural ABAP refactoring or mass source code replacement

    I am trying to change hard coded values from multiple source codes with respective constant names. Is there a tool to find and replace them according to a rules table. I wouldn't mind even if this tool was not in SAP (eg. Eclipse).
    Thank you in advance,
    Michalis.

    Dear Thomas,
    thank you for your prompt response.
    My idea was (and is) that since the ABAP compiler is embedded in Netweaver, it would be smart to get the compiler functionality together with regular expressions declaration in order to do what unix like systems do for years, replace strings with other strings. The program you suggest is well known for finding literals (substrings) in source, but when it does you never know what is the role of the literal on the source code line (in the particular code statement).
    Of course I agree with you regarding the term refactoring, that a human eye is needed, if I was to do real source code pattern recognition and replacement, but my driving need is more simple and way far from that (at least for now).
    Please keep me posted in case you have any news on the subject.

  • How to find text literals

    Hi All,
    I need to find text literals through my code
    for eg:
    report ztest.
    write: 'HI'.
    In this how do i find whether the line is containing " ' " or not
    if sy-subrc eq 0.
    loop at itab into wa .
    if wa-a ne ' ' '.
    endif.
    read
    Thanks
    San

    hi,
    i think you want to search for a text or symbol in the given string.
    If it is so, then you can do this way
    if itab-field CS 'AV'.
    endif.
    CS will take u the value AV if it exist in the itab-field.
    and sy-fdpos will give u the exact position of the word AV.
    so from this u can solve ur problem i suppose..

  • Can Oracle convert literals to bind variables?

    Good morning everyone.
    I have a procedure similar to this in our database:
        FUNCTION Get_Tag_Element_Id_For_Set(Element_Attr_Id_Table_In   in    ATTRIBUTE_TABLE_ID_TAB) RETURN NUMBER IS
          v_Select_Statement                    VARCHAR2(32767);
          v_Element_Id                             ELEMENT.Element_Id%TYPE;
        BEGIN
          FOR I IN 1..Element_Attr_Id_Table_In.COUNT LOOP
            IF v_Select_Statement IS NULL THEN
              v_Select_Statement := 'SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Element_Attribute_Id = ' || Element_Attr_Id_Tab_In(i);
            ELSE
              v_Select_Statement := v_Select_Statement || ' intersect ' ||
                                    'SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Element_Attribute_Id = ' || Element_Attr_Id_Table_In(i);
            END IF;
          END LOOP;
          EXECUTE IMMEDIATE v_Select_Statement INTO v_Element_id;
          RETURN v_Element_Id;
        END;What this does is to create a query similar to this:
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 1 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 2 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 3 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 4 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 5;
    I am using Dynamic SQL because the number of intersect pieces can vary from 1 to 15 and in the future it can grow.
    The problem that I have is that because the literals are part of the string, the query is being hard parsed every single time. In our production environment this means 100s of thousands of times per day which according to our DBA has added 15% plus to our average load. I know that I can come up with a rewrite to avoid this, but I was wondering if there is a parameter I can set at the session or at the database level where the database itself can convert this kind of query into one with bind variables.
    Thanks,
    Tom
    Edited by: Thomas Morgan on May 3, 2013 8:21 PM

    Thomas Morgan wrote:
    Basically I have an XML document.
    The document has ELEMENTS.
    ELEMENTS can have attributes.
    There is a many to many relationship between ELEMENT and ATTRIBUTES so I have a XREF table to represent this relationship.
    When I receive a new document, I need to determine if a group of ATTRIBUTES already exist together in the XREF table so I have to find their common ELEMENT_ID or NULL in which case I would create a new ELEMENT and associate the new set of attributes to the new ELEMENT.
    Since the number of attributes can vary from 1 to around 15 for now, I had to dynamically build the query that find the common ID(intersect) if it exists.
    Here is some DDL and inserts:
    CREATE TABLE ELEMENT(ELEMENT_ID NUMBER NOT NULL);
    CREATE TABLE ELEMENT_ELEMENT_ATTRIBUTE_XREF(Element_Id NUMBER NOT NULL, Element_Attribute_Id NUMBER NOT NULL);
    ALTER TABLE ELEMENT_ELEMENT_ATTRIBUTE_XREF ADD CONSTRAINT ELEMENT_ATTR_MANY_2_MANY_PK PRIMARY KEY(Element_Id, Element_Attribute_Id);
    ALTER TABLE ELEMENT ADD CONSTRAINT ELEMENT_PK PRIMARY KEY(Element_Id);
    INSERT INTO ELEMENT VALUES(1);
    INSERT INTO ELEMENT VALUES(2);
    INSERT INTO ELEMENT VALUES(3);
    INSERT INTO ELEMENT VALUES(4);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(1, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(1, 2);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(2, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 3);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 4);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 5);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(4, 6);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(4, 7);
    So for instance if I passed an array (Attribute ID Tab) containing ELEMENT_ATTRIBUTE_ID list 6 and 7 I would get 4 as the answer.
    Hope this helps,
    Thanks,
    TomAwesome, thanks!
    I'm not sure this works 100% for what you need, but I thought I'd give it a shot. I've used a built in array (sys.odcinumberlist) that you should have access to on your installation (assuming you have a relatively recent version of Oracle).
    I left out the part where you would loop through the array you are currently passing in to your procedure to build up this new array that you can use in a SQL statement.
    Cheers,
    create or replace procedure maybe_this
       in_list           sys.odcinumberlist
    is
       l_commonality     number;
    begin
       begin
          select
             distinct
                xref.element_id
          into
             l_commonality
          from
                table(cast(in_list as sys.odcinumberlist))  list
            ,  element_element_attribute_xref   xref
          where
             xref.element_attribute_id = list.column_value;
          dbms_output.put_line('match on element_id = ' || l_commonality);
       exception
          when too_many_rows or no_data_found
          then
             dbms_output.put_line('no match');
       end;
    end;
    ME_TUBBZ?exec maybe_this(sys.odcinumberlist(1,2));
    no match
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    ME_TUBBZ?exec maybe_this(sys.odcinumberlist(6,7));
    match on element_id = 4
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01

  • Using 'between' for literals inside 'where' clause

    Dear all,
    I run the following queries in 10.g XE HR sample schema:
    The first query is limited by characters between "I" and "S" where the second query is limited by words between "IT" and "Sales".
    My question is, how come the first query doesn't return "Sales" row as it does in the second one? I don't quite understand how does "between" works on string literals. Please help.
    Regards,
    Valerie
    SQL> select department_name from departments where department_name between 'I' a
    nd 'S' order by department_name;
    DEPARTMENT_NAME
    IT
    IT Helpdesk
    IT Support
    Manufacturing
    Marketing
    NOC
    Operations
    Payroll
    Public Relations
    Purchasing
    Recruiting
    DEPARTMENT_NAME
    Retail Sales
    12 rows selected.
    SQL> select department_name from departments where department_name between 'IT'
    and 'Sales' order by department_name;
    DEPARTMENT_NAME
    IT
    IT Helpdesk
    IT Support
    Manufacturing
    Marketing
    NOC
    Operations
    Payroll
    Public Relations
    Purchasing
    Recruiting
    DEPARTMENT_NAME
    Retail Sales
    Sales
    13 rows selected.

    Imagine how those words are ordered in an encycopedia or thesaurus.
    1. I
    2. IT
    3. IT Helpdesk
    4. IT Support
    5. Manufacturing
    6. Marketing
    7. NOC
    8. Operations
    9. Payroll
    10. Public Relations
    11. Purchasing
    12. Recruiting
    13. S
    14. Sales
    15. System Management
    "S" is ordered before "Sales". Between includes everything including the lower and the upper boundary (row 1-13). It does not include stuff that is ordered AFTER the upper boundary (Row 14++).
    So if you want to find everything the starts with "S" then you have several options.
    1) Show everything after including "I" but before "T" (T not including)
    select department_name
    from departments
    where department_name >=  'I'
    and department_name < 'T'
    order by department_name;or
    2) Show everything where the first letter is between "I" and "S"
    select department_name
    from departments
    where substr(department_name,1,1) between 'I' and 'S'
    order by department_name;I would almost always choose the first option. Usually it is faster because an index on the department name can be used if there is one.
    There is a third option. But this is kind of silly and incomplete. You could add the very last string that you can imagine as the upper boundary of the between function.
    select department_name
    from departments
    where department_name between 'I' and 'Szzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
    order by department_name;Edited by: Sven W. on Dec 14, 2010 12:54 PM - added third option

  • Regex: how can Matcher.matches return true, but Matcher.find return false?

    Consider the class below:
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class RegexBugDemo {
         private static final Pattern numberPattern;
         static {
                   // The BigDecimal grammar below was adapted from the BigDecimal(String) constructor.
                   // See also p. 46 of http://www.javaregex.com/RegexRecipesV1.pdf for a regex that matches Java floating point literals; uses similar techniques as below.
              String Sign = "[+-]";
              String Sign_opt = "(?:" + Sign + ")" + "?";     // Note: the "(?:" causes this to be a non-capturing group
              String Digits = "\\p{Digit}+";
              String IntegerPart = Digits;
              String FractionPart = Digits;
              String FractionPart_opt = "(?:" + FractionPart + ")" + "?";
              String Significand = "(?:" + IntegerPart + "\\." + FractionPart_opt + ")|(?:" + "\\." + FractionPart + ")|(?:" + IntegerPart + ")";
              String ExponentIndicator = "[eE]";
              String SignedInteger = Sign_opt + Digits;
              String Exponent = ExponentIndicator + SignedInteger;
              String Exponent_opt = "(?:" +Exponent + ")" + "?";
              numberPattern = Pattern.compile(Sign_opt + Significand + Exponent_opt);
    //     private static final Pattern numberPattern = Pattern.compile("\\p{Digit}+");
         public static void main(String[] args) throws Exception {
              String s = "0";
    //          String s = "01";
              Matcher m1 = numberPattern.matcher(s);
              System.out.println("m1.matches() = " + m1.matches());
              Matcher m2 = numberPattern.matcher(s);
              if (m2.find()) {
                   int i0 = m2.start();
                   int i1 = m2.end();
                   System.out.println("m2 found this substring: \"" + s.substring(i0, i1) + "\"");
              else {
                   System.out.println("m2 NOT find");
              System.exit(0);
    }Look at the main method: it constructs Matchers from numberPattern for the String "0" (a single zero). It then reports whether or not Matcher.matches works as well as Matcher.find works. When I ran this code on my box just now, I get:
    m1.matches() = true
    m2 NOT findHow the heck can matches work and find NOT work? matches has to match the entire input sequence, whereas find can back off if need be! I am really pulling my hair out over this one--is it a bug with the JDK regex engine? Did not seem to turn up anything in the bug database...
    There are at least 2 things that you can do to get Matcher.find to work.
    First, you can change s to more than 1 digit, for example, using the (originaly commented out) line
              String s = "01";yields
    m1.matches() = true
    m2 found this substring: "01"Second, I found that this simpler regex for numberPattern
         private static final Pattern numberPattern = Pattern.compile("\\p{Digit}+");yields
    m1.matches() = true
    m2 found this substring: "0"So, the problem seems to be triggered by a short source String and a complicated regex. But I need the complicated regex for my actual application, and cannot see why it is a problem.
    Here is a version of main which has a lot more diagnostic printouts:
         public static void main(String[] args) throws Exception {
              String s = "0";
              Matcher m1 = numberPattern.matcher(s);
              System.out.println("m1.regionStart() = " + m1.regionStart());
              System.out.println("m1.regionEnd() = " + m1.regionEnd());
              System.out.println("m1.matches() = " + m1.matches());
              System.out.println("m1.hitEnd() = " + m1.hitEnd());
              m1.reset();
              System.out.println("m1.regionStart() = " + m1.regionStart());
              System.out.println("m1.regionEnd() = " + m1.regionEnd());
              System.out.println("m1.lookingAt() = " + m1.lookingAt());
              System.out.println("m1.hitEnd() = " + m1.hitEnd());
              Matcher m2 = numberPattern.matcher(s);
              System.out.println("m2.regionStart() = " + m2.regionStart());
              System.out.println("m2.regionEnd() = " + m2.regionEnd());
              if (m2.find()) {
                   int i0 = m2.start();
                   int i1 = m2.end();
                   System.out.println("m2 found this substring: \"" + s.substring(i0, i1) + "\"");
              else {
                   System.out.println("m2 NOT find");
                   System.out.println("m2.hitEnd() = " + m2.hitEnd());
              System.out.println("m2.regionStart() = " + m2.regionStart());
              System.out.println("m2.regionEnd() = " + m2.regionEnd());
              System.out.println("m1 == m2: " + (m1 == m2));
              System.out.println("m1.equals(m2): " + m1.equals(m2));
              System.exit(0);
         }Unfortunately, the output gave me no insights into what is wrong.
    I looked at the source code of Matcher. find ends up calling
    boolean search(int from)and it executes with NOANCHOR. In contrast, matches ends up calling
    boolean match(int from, int anchor)and executes almost the exact same code but with ENDANCHOR. Unfortunately, this too makes sense to me, and gives me no insight into solving my problem.

    bbatman wrote:
    I -think- that my originally posted regex is correct, albeit possibly a bit verbose, No, there's a (small) mistake. The optional sign is always part of the first OR-ed part (A) and the exponent is always part of the last part (C). Let me explain.
    This is your regex:
    (?:[+-])?(?:\p{Digit}+\.(?:\p{Digit}+)?)|(?:\.\p{Digit}+)|(?:\p{Digit}+)(?:[eE](?:[+-])?\p{Digit}+)?which can be read as:
    (?:[+-])?(?:\p{Digit}+\.(?:\p{Digit}+)?)        # A
    |                                               # or
    (?:\.\p{Digit}+)                                # B
    |                                               # or
    (?:\p{Digit}+)(?:[eE](?:[+-])?\p{Digit}+)?      # COnly one of A, B or C is matched of course. So B can never have a exponent or sign (and A cannot have an exponent and C cannot have a sign).
    What you probably meant is this:
    (?:[+-])?                                   # sign       
        (?:\p{Digit}+\.(?:\p{Digit}+)?)         #   A
        |                                       #   or
        (?:\.\p{Digit}+)                        #   B
        |                                       #   or
        (?:\p{Digit}+)                          #   C
    (?:[eE](?:[+-])?\p{Digit}+)?                # exponent
    and that this must be a sun regex engine bug, but would love to be educated otherwise. Yes, it looks like a bug to me too.
    A simplified version of this behavior (in case you want to file a bug report) would look like this:
    When `test` is a single digit, m.find() returns _false_ but matches() returns true.
    When `test` is two or more digits, both return true, as expected.
    public class Test {
        public static void main(String[] args) {
            String test = "0";
            String regex = "(?:[+-])?(?:\\p{Digit}+\\.(?:\\p{Digit}+)?)|(?:\\.\\p{Digit}+)|(?:\\p{Digit}+)(?:[eE](?:[+-])?\\p{Digit}+)?";
            java.util.regex.Matcher m = java.util.regex.Pattern.compile(regex).matcher(test);
            System.out.println("matches() -> "+test.matches(regex));
            if(m.find()) {
                System.out.println("find()    -> true");
            } else {
                System.out.println("find()    -> false");
    }

  • Java's Defualt Literal Types (Whole number literals defaults to int?)

    Hello guys, its my first Post here, just want to ask
    is java whole number literals defaults to int?
    check these codes
    ---code 1:---
    Java Code:
    1
    byte b = 10;
    //code 1 works
    ---code 2:---
    void someMethod(byte a,byte b)
    System.out.println(a+b);
    then I use it
    someMethod(10,5);
    //code 2 doesn't work, it yields an error
    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The method sum(byte, byte) in the type Test is not applicable for the arguments (int, int)
    now these are my questions
    1. does java whole number literals defaults to int? (I think so, basing on the code)
    2. if question no. 1 is true, then why code 1 worked? it shouldn't right, coz its a downward cast (from int to byte).
    3. what really happens under the hood?
    by the way, the jdk version I used is 1.7.0
    Thank you guys in advance

    915343 wrote:
    Hello guys, its my first Post here, just want to ask
    is java whole number literals defaults to int?Yes.
    1
    byte b = 10;
    //code 1 worksThe literal expression *10* is an int. But it's a compile-time constant that fits into a byte, so the assignment is okay without a cast.
    ---code 2:---
    void someMethod(byte a,byte b)
    System.out.println(a+b);
    then I use it
    someMethod(10,5);
    //code 2 doesn't work, it yields an errorBecause 10 and 5 are ints, not bytes, and there's no method that can take int as args. The automatic narrowing conversion that takes place for assignment does not come into play when finding a matching method signature.
    1. does java whole number literals defaults to int? (I think so, basing on the code)Yes.
    3. what really happens under the hood?Read the JLS for those details.
    http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10
    http://java.sun.com/docs/books/jls/third_edition/html/conversions.html
    http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12
    Edited by: jverd on Feb 17, 2012 3:49 PM

  • Replacing unicode character literals with characters.

    Hi, say i have a String like:
    String example = "\\u1234 llamas \\uabcd\\c0d4";etc.
    How would I replace all the unicode literals (\\u1234 etc.) with the actual characters?
    Is there an easy way to do this?

    sabre150 wrote:
    It is interesting that every time I post my solution to this problem it is ignored. OK, it does require a third party component and it does use a regex but it does work. All one has to do is to construct a UnicodeRewriter and then useIt does involve adding a about 50 lines of code or more for what ought to be quite a trivial operation. And if you don't need a Rewriter for anything else that's an overhead, even if you just copy and past it.
    This rather relates to a discussion I initiated last month, how good a reason do you need to import 3rd party libraries. Tastes vary
    How about:
    byte[] bytes = ("X=" + originalString + "\n").getBytes("ISO-8859-1");
    InputStream bis = new ByteArrayInputStream(bytes);
    Properties p = new Properties();
    p.load(bis);
    String result = bis.getProperty("X");That's less code than your subclass alone, let alone the rewriter. OK it's a bit weird and not totally bulletproof should, say, newlines find their way into your input stream.
    Also it uses an "official" interpreter of escaped Java strings rather than making one up.
    Edited by: malcolmmc on Jul 11, 2009 8:53 AM

  • Standard Procedure to find out the hardcoding

    Hi Experts,
    What is the standard procdure to look for whether any hardcoding is existing in the system ....????
    Thanks in Advance,
    Praveen

    Hi Praveen,
    You can use transaction SCI to find the hardcoded text used in the progra. Once you get the programs and text location you need to manually check all the code to find out the literals used in the ' ' are actually hard coding or not.
    Regards,
    Atish

  • Finding 'text-'

    hi,
    I have to find all the text elements ie 'TEXT-' in ne given pgm.
    This is required as i want the o/p as list of all the text literals and unassigned text symbols.
    So any one can help on this.
    Thanks.

    Hi..
    use this..
    data:
    begin of wa,
       str type string,
    end of wa.
    data:
      itab like standard table of wa.
    READ REPORT <prog> INTO itab .
    loop at itab into wa.
      if wa cs 'text-'.
        write:/ ' line no..',sy-tabix,
               ' The position...', sy-fdpos,
               ' the line is...' wa-str.
       endif.
    endloop.
    this will get u all the text literals..
    Ram
    Message was edited by:
            Rammohan Nagam

  • ALC-FUT-001-007: Syntax error in the regular expression *. from File Utilities - Find in ES2

    Has anyone encountered the above error when trying to use the Foundation - File Utilities service Find?
    This is occuring in ES2, and I have tried using an asterisk, as well as the exact file name I know exists.
    I have tried literals in the Process Properties, as well as passing it in via string variables.
    Any help is appreciated.
    Thanks
    Mark

    Thanks for your response.
    Here is what we have learned:
    We should not put the regular expression value in single quotes - eliminates the error.
    The problem is, the Find operation always returns an empty list no matter what criteria we enter - even C:\ with criteria = *.*
    ES 2 is running on a Windows 2003 machine.
    Thanks Again
    Mark

  • Need to find out gap in data

    Hi All
    I have the following records:
    --Drop Table
    drop table agreement;
    drop table GRP_INFO;
    --Create table
    create table agreement
    Agreement_Id Number(5),
    Coverage_Effective_Date Date,
    COVERAGE_termination_date date
    Create Table GRP_INFO
    Agreement_Id Number(5),
    Grp_Id Number(5),
    Effective_Date Date,
    TERMINATION_DATE Date
    --Insertion
    Insert Into Agreement
    Select 100,'01JAN-2013','31-DEC-2013'
    From Dual;
    Insert Into Agreement
    Select 200,'01JAN-2013','31-DEC-2013'
    From Dual;
    Insert Into Agreement
    Select 300,'01JAN-2013','31-DEC-2013'
    From Dual;
    Insert Into Agreement
    Select 400,'01JAN-2013','31-DEC-2013'
    From Dual;
    Insert Into Grp_Info
    Select 100,1,'01-JAN-2013','31-MAR-2013'
    From Dual
    UNION ALL
    Select 100,2,'01-APR-2013','02-APR-2013'
    From Dual
    UNION ALL
    Select 100,3,'03-APR-2013','15-APR-2013'
    From Dual
    UNION ALL
    Select 100,4,'03-APR-2013','15-APR-2013'
    From Dual
    UNION ALL
    Select 100,5,'01-JUN-2013','31-DEC-2013'
    From Dual
    Union All
    Select 200,6,'01-JAN-2013','02-APR-2013'
    From Dual
    Union All
    Select 200,7,'03-APR-2013','15-APR-2013'
    From Dual
    Union All
    Select 200,8,'03-APR-2013','15-APR-2013'
    From Dual
    Union All
    Select 200,9,'01-JUN-2013','30-NOV-2013'
    From Dual
    Union All
    Select 300,10,'01-JAN-2013','15-APR-2013'
    From Dual
    Union All
    Select 300,11,'16-APR-2013','31-DEC-2013'
    From Dual
    Union All
    Select 400,12,'02-JAN-2013','31-DEC-2013'
    From Dual;
    COMMIT;
    --Query on agreement table
    Select * from Agreement;
    --Query Result
    agreement_id                    coverage_effective_date                     coverage_termination_date
    100                                         01-JAN-13                                                   31-DEC-13
    200                                         01-JAN-13                                                   31-DEC-13
    300                                         01-JAN-13                                                   31-DEC-13
    400                                         01-JAN-13                                                   31-DEC-13
    --Query on grp_info table
    agreement_id                  grp_id       effective_date          termination_date
    100                                              1                     01-JAN-13                       31-MAR-13
    100                                              2                     01-APR-13                       02-APR-13
    100                                              3                     03-APR-13                       15-APR-13
    100                                              4                     03-APR-13                       15-APR-13
    100                                              5                     01-JUN-13                        31-DEC-13
    200                                              6                     01-JAN-13                        02-APR-13
    200                                              7                     03-APR-13                        15-APR-13
    200                                              8                     03-APR-13                        15-APR-13
    200                                              9                     01-JUN-13                         30-NOV-13
    300                                              10                   01-JAN-13                         15-APR-13
    300                                              11                   16-APR-13                         31-DEC-13
    400                                              12                   02-JAN-13                          31-DEC-13
    --Result
    agreement_id
    100
    200
    400
    --Logic for the above result
    Each agreement_id have multiple grp_id and all grp_id or atleast one should cover all period agreement_id for example:
    - Agreement_id 100 has coverage effective date is 01-Jan-2013 and coverage_termination_date is 31-Dec-2013 and if you look into all record against agreement_id 100 then you can find that the period from 16-Apr-2013 till 31-May-2013 are missing so I need this agreement_id.
    - Agreement_id 200 has coverage effective date is 01-Jan-2013 and coverage_termination_date is 31-Dec-2013 and if you look into all record against agreement_id 200 then you can find that the period from 01-DEC-2013 till 31-DEC-2013 are missing so I need this agreement_id.
    - Agreement_id 300 has coverage effective date is 01-Jan-2013 and coverage_termination_date is 31-Dec-2013 and if you look into all record against agreement_id 300 then you can find that no period is missing so I don't need this agreement_id.
    - Agreement_id 400 has coverage effective date is 01-Jan-2013 and coverage_termination_date is 31-Dec-2013 and if you look into all record against agreement_id 300 then you can find that the period from 01-JAN-2013 till 01-JAN-2013 is missing so I need this agreement_id.
    Please let me know if you have any questions related to my scenario and I really appreciate if someone provide me solution for this issue.
    Regards
    Shumail

    Hi,
    Here's one way:
    WITH got_gap  AS
        SELECT agreement_id, effective_date, termination_date
        ,      CASE
                   WHEN  effective_date >
                         1 + MAX (termination_date) OVER ( PARTITION BY  agreement_id
                                                           ORDER BY      effective_date
                                                           ROWS BETWEEN  UNBOUNDED PRECEDING
                                                           AND           1         PRECEDING
                   THEN  1
               END  AS gap
        FROM    grp_info
    SELECT    g.agreement_id
    FROM      got_gap g
    JOIN      agreement a  ON  a.agreement_id = g.agreement_id
    GROUP BY  g.agreement_id
    HAVING    COUNT (g.gap)             > 0
    OR        MIN (g.effective_date)    > MIN (a.coverage_effective_date)
    OR        MAX (g.termination_date)  < MAX (a.coverage_termination_date)
    ORDER BY  g.agreement_id
    Output:
    AGREEMENT_ID
             100
             200
             400
    This makes no assumptions about effective_date and termination_date, except that effective_date <= termination_date on each row.  It's okay if different rows for the same agreement_id overlap, or if one encompasses another.
    Don't try to insert VARCHAR2 values (such as '01-JAN-2013') into DATE columns.  Use TO_DATE, or DATE literals.

  • Numeric literals and BYTE

    Are numeric literals really not automatically converted to byte, if a function expects a byte?
    It seems that I have to cast the '0' below to a byte, which I find quite incredible, is that true?
    public class Mine
    public static void main(String[] args)
    test((byte)0);
    public static void test(byte t)
    System.out.println(t);
    If I don't cast it I get:
    Mine.java:5: test(byte) in Mine cannot be applied to (int)
              test(0);
              ^
    1 error

    LeslieViljoen wrote:
    Yes! They'll probably all be using Ruby, and I'll have to first tell them what a "cast" is!
    So, to ask another question: is there something special about an INT? Does the virtual machine use a 32 bit INT as a kind of base type?Yes, as previously mentioned, all literal numbers (barring the ones marked with L for long, f for float etc.) are considered to be ints and not for example shorts.

  • Find the data in the TextField which is visible

    Requirement
    There is JTextField which has certain String say "ABCDEFGHIJ" and the textfield is small and could only display "ABC" and other data is in the JTextField but scrolled out
    I have another JTextField beneath it and so I want teh remaining data should be shown there
    The reason behind this is
    I have made a Display Screen in which there r 2 TextFields for a single Data which is going to be filled up automatically and Can't make one because the Form which is to be printed has to be like that
    So is there any slution by which I can see the text shown over there and so I can copy the remaining text in another JTextField
    I know there is some javax.swing.text.TextUI
    But I don't know how to find from that
    Thanks in advance
    CSJakharia

    968650 wrote:
    SELECT mkct_group_code FROM ID_MKT_CONTTYPE_GROUP_MASTER where mkct_group_code=20'
    Note mkct_group_code column is varchar2(10) type.
    It has values as
    20
    10
    30
    20'
    30' Oracle has introduced the Q notation to represent string literals. By using this you can specify your own separator.
    Example.
    If you want to pass a string as Hi it's Karthick's post
    Previously we use to do it like *'Hi it''s Karthick''s post'*
    But using the Q notation you can just do this *q'[Hi it's Karthick's post]'*. Here the Square brackets are the separators. Only thing you need to make sure is that the separator is not part of the actual string. You can specify any separator like q'|Hi it's Karthick's post|' or *q'{Hi it's Karthick's post}'* etc.

  • Find open and close smart quotes

    Dear scripter,
    Here I am trying find whether all the open double smart quotes(") are closed with close double smart quotes("). Here is my small work to find how many open and close quotes.
    myopenqu=app.activeDocument.search("^{", false, false, "^{");
    myclosequ=app.activeDocument.search("^}", false, false, "^}");
    myopenqulength = myopenqu.length;
    myclosequlength = myclosequ.length;
    if(myopenqulength!=myclosequlength)
    alert("Quotes not matched\n"+ myopenqulength +" Open quotes found\n" + myclosequlength +" Close quotes found")
    It works well, the script just alert if I have 25 open quotes and 23 close quotes
    Quotes not matched
    25 Open quotes found
    23 close quotes found
    Now I want to find the quote set where the 24,25th set close quotes are missing?
    Is there any way to find the misisng quotes
    Thanks in advance
    regards
    a r u l
    vpublish.net

    You'd have to look for unmatched quotes, in this case two cases of two open quotes without an intervening closed quote. This is difficult to script in CS2 because it doesn't have GREP natively and because of footnote problems. In CS3/4 it should be possible. But even then it will work only if you don't have quotes within quotes.
    Peter

Maybe you are looking for

  • Suggestions for Creative Cloud 2.0 ?

    Now that most of us have sifted through both the miss-information and cold reality of the Creative Cloud model, maybe it's time to tell Adobe what we would like to see offered in Creative Cloud or preferred alternatives. Due to the well-documented di

  • Re: Purpose of business component in integration builder?

    Hi everyone,      As I'm new to pi so, I just want to know what is the purpose of creating a business component. Can anyone help on this? Thanks&Regards, Suresh M

  • Essbase Studio: Failed to deploy Essbase cube

    Hi I have started working with Essbase studio sometime back and I am able to deploy BSO cube with success using the TBCSample Database which comes along with Essbase. Now I wanted to deploy ASO cube, as no sample database is available I thought to cr

  • 5800's new and old homescreen changes with v40 FW

    After upgrading to v40, I've compared the new homescreen to the old homescreen and to the old homescreen with v21-31, these are my findings. - The old homescreen on v40 does not have the email notification that Nokia introduced a short while ago and

  • Macbook pro 15 in earlier 2011

    Hi all, I got screen flickering and graphic disorder issues on my macbook pro 15 in earlier 2011. Please advice me how to fix!