Number consecutive transformed two return true or flase.12345678, 12346578

Oracle 11 g 2 version.

In the sub sample data column has, b if there are 2 two consecutive numbers are transposed in the B of A column she must return the string "true".

with t as
(
Select '123456789 ', '123476581' double b
Union of all the
Select '123456789 ', '123465789' from dual
Union of all the
Select '332211', '332121' from dual
Union of all the
Select '54321', '54312' from dual
Union of all the
Select '78901', '79801' from dual
)
Select a, b from t

I need output like below.


a and b val

123456789 123476581 FALSE
123456789 123465789 TRUE
332211 332121 TRUE
54321 54312 TRUE
78901 79801 TRUE
65432 63452 FALSE


Thanks in advance.

Published by: raj_tech on July 6, 2012 03:06

raj_tech wrote:
HI CHRIS.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE 11.2.0.1.0 Production."
AMT for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

Thank you
RAJESH

Great, so now you have shown us your version.

How about in response to the answer that you were given and let people know if you have had your answer or if there is still a problem. Which is called communication and feedback, and it is certainly useful things along if you do this.

Tags: Database

Similar Questions

  • String.startsWith always returning true.

    Hello, I have a small issue that has been driving me nuts. I am a beginner in Java, so the problem is most likely something stupid that I monitor, so I would like another opinion.

    Basically I have a listfield I want to make it searchable. I had another problem earlier with indexOfList always returning-1, so I gave up using it. Instead, I am a loop in the listfield table and see if _seriesList [i] .startsWith (_searchField.getText ()). For some reason, it ALWAYS returns true, causing the first item in the list to be chosen as the result of the search. Here is the code:

      for(int i = 0; i < _seriesListField.getSize(); i++)    {     String temp = _searchField.getText();     System.out.println(_seriesList[i].Title);     System.out.println(temp);     if(_seriesList[i].Title.startsWith(temp));        {         System.out.println("startsWith returned TRUE");           _seriesListField.setSelectedIndex(i);         return;       } }
    

    No matter what value I give, startsWith return true. I also tried to use substring (0, temp.length () .equals (temp) instead and who also returned the value true. My console output is:

    07 - ghost<-- the="" name="" of="" the="" first="" item="" in="" the="">
    C<-- the="" value="" i="" typed="" into="" the="">

    startsWith, returned the TRUE value

    The javadoc for startsWith says he can return true if the prefix is null or if channels .of each other, see, however I see that these two are clearly false from the console output.

    I could use help to find out why this happens and fixing it, and if it turns out to be something mind-numbingly stupid and/or obvious I apologize profusely in advance.

    It is a sad, sad day for me. I had a semicolon after the if test. While the error itself is not so bad, the fact that it took me nearly an hour to discover this is painful.

  • one of the three conditions, return true

    I just saw the GOLD (Boolean Express) where if one of the TWO conditions, then return true to stop the labview.

    Y does it have that provides all Boolean Express if one of THREE conditions met, return true?

    type in compound under the rapid fall.

  • Counter: Why is 'Task is' returns True after the time of the HIGH?

    Realized that my other thread has been put out on the rails by... myself.

    Started testing the "task performed is" function on a counterexample over;

    Why is it returns "True" after time and not up AND down?

    And more still-so, how can I get him back 'True' after the time of low AND high? How can I get it to tell me that it's "done" after 9.1seconds instead of the ~ 3 seconds like today. Is there a better setup that I can use? (the numbers are arbitrary)

    A couple of notes, assuming that we have to deal with default impulses that are active top with a low idle state.

    1. in general, a pulse is defined with a 'time in idle state', first followed by a time in the status of the pulse.  Therefore, by definition a pulse (and so also a task of pulse) is indeed at the end of its active state (high).

    2. HOWEVER, the impulse first in no pulse train DO NOT USE 'small time' entry to set his time in idle state before the pulse.  Instead, it uses the "Initial deadline" entry for the first pulse while 'Low Time' is used for all subsequent impulses.

    3. as a result, when you generate a single pulse, 'Low Time' is meaningless.  Only 'Initial period' is important.  Therefore fitting your low downtime desired within the' original' instead of ' Low Time.

    This type of agreement has always seemed awkward at best to me.  I think that aid should be a lot more important emphasis on the idea that 'Small time' gets ignored for pulse unique.  I mean, the info * is * there but it's pretty easy to miss before you know to look for.  In any case, hope this helps you in your application.

    (An alternative you might consider is to set the pulse with a high idle state.  Then you wire the "Initial delay" to set the first time high and your task would end after 'small time' you set.  Just be aware that when you work with reverse polarity pulses, you should check the output terminal to see what is true by default as well until you begin your task and after remove you it from the State.   A given Council could be biased with meter output in poor condition, so when your task wants to reverse the polarity you might see a rising edge, the task begins in its state of rest high and then a front coming down like the ends of the task and the jury returns to its weak State by default.)

    -Kevin P

  • My computer crashed and I reinstall first elements 7, but it will not recognize my serial number there are two on the CD case please help

    My computer crashed and I reinstall first elements 7, but it will not recognize my serial number there are two on the CD case please help

    When you ask a question you will need to provide some basic information

    Mac or Windows and EXACTLY what version of the operating system?

    Recent Mac AND Windows operating systems have been known to cause problems "weird."

    Lost information - response #1 in https://forums.adobe.com/thread/2008767

    Invalid License http://helpx.adobe.com/creative-suite/kb/error-serial-number-valid-product.html

    -http://helpx.adobe.com/creative-suite/kb/invalid-serial-number-cs4.html

    - and http://forums.adobe.com/thread/1038761

  • linkXmp.isValid - returns true - when no metadata information available?


    I'm trying to check if an image has given Xmp and I am TRUE in both cases - the cases where there is no data and where there is

    the data browser shows as no metadata information available when there is no data but true is returned on linkXmp.isValid

    How do test you for this condition?   or is it a bug or my misunderstanding

    Thanks for looking at this problem for me

        //  isValid    bool     readonly    Returns true if the object specifier resolves to valid objects.
        // linkXmp.isValid   returns true    ... when  no Metadata information available.????
        var myLabel;
        var myLink = myGraphic.itemLink;
        var myStatus = myLink.linkXmp.isValid ;
        $.writeln(myLink.linkXmp.isValid );
        
    

    Oops, I'm sorry, that is not properly located.

    Instead of

    if (e.message !== "No Metadata information available.") {
    

    Please use

    if (e.message !== app.translateKeyString(
        "$ID/NoMetaDataAvailableError"))
    {
    

    (you can find the $ID / strings by use of the app.findKeyStrings ()).

  • isShowing() returns true when I do not see the image

    Hello friends,
    Why isShowing() returns true when I do not see the image?

    See you soon,.
    André Uhres
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.util.logging.*;
    import javax.swing.*;
    
    public class IsShowingDemo extends JFrame {
    
        private JTextArea jTextArea1;
    
        public IsShowingDemo() {
            jTextArea1 = new JTextArea();
    
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setTitle("IsShowingDemo");
    
            jTextArea1.setBackground(new java.awt.Color(255, 255, 204));
            jTextArea1.setEditable(false);
            jTextArea1.setLineWrap(true);
            jTextArea1.setText("Please iconify this window or take some other window "
                    + "to front so that this one is hidden. "
                    + "Then double click the white tray icon.");
            jTextArea1.setWrapStyleWord(true);
            getContentPane().add(jTextArea1, BorderLayout.CENTER);
    
            setSize(400, 300);
            setLocationRelativeTo(null);
    
            BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
            Graphics2D graphics = image.createGraphics();
            graphics.fillOval(2, 2, 12, 12);
            setIconImage(image);
            installTrayicon(image);
        }
    
        private void installTrayicon(final Image image) {
            TrayIcon icon = new TrayIcon(image, "IsShowingDemo", null);
            icon.addActionListener(new ActionListener() {
    
                @Override
                public void actionPerformed(final ActionEvent e) {
                    boolean showing = IsShowingDemo.this.isShowing();
                    JOptionPane.showMessageDialog(null, "frame is showing = " + showing
                            + ", \ndo you see the frame?");
                }
            });
            try {
                SystemTray.getSystemTray().add(icon);
            } catch (AWTException ex) {
                Logger.getLogger(IsShowingDemo.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    
        public static void main(final String args[]) {
            EventQueue.invokeLater(new Runnable() {
    
                public void run() {
                    new IsShowingDemo().setVisible(true);
                }
            });
        }
    }

    Because the image shows according to Java. They could be overlapped by other windows or is reduced to a minimum is not something that Java checks in this method.

    If you want to make visible by the user you will need to use something like:

    if(TestShowing.this.getExtendedState() == Frame.ICONIFIED) {
      TestShowing.this.setExtendedState(JFrame.NORMAL);
    }
    TestShowing.this.toFront();
    

    But make sure it is visible to the user would require native lib I think (or take a screenshot and are looking for your setting here).

  • Number shaped with two digits "behind the point" :-)

    Hello

    Please excuse my very bad English because I'm french :-)

    I use the beta JDE v4.7 and the Blackberry Storm Simulator included.

    I would like to know how to format a calculated result as #. # (a floating-point value with two digits "behind the point') to display in a RichTextField instance.

    I tried this:

    """"
    String strSomme;
    String strSommeTTC;
    Double dblSomme;
    Double dblSommeTTC;
                   
    strSomme = saisieField.getText ();
                   
    dblSomme = Double.parseDouble (strSomme);
    dblSommeTTC = dblSomme * 119,6 / 100.0;
     
    Trainer fmt = new Formatter();
     
    strSommeTTC = fmt.formatNumber(dblSommeTTC,2);
     
    RichTextField affichageField = new RichTextField ("sum TTC:" + strSommeTTC, Field.NON_FOCUSABLE);
    Add (affichageField);
    """"
     
    Only the small portion of code compiles fine but I get an exception when you run the program in the Simulator: javax.microedition.global.UnsupportedLocaleException

    I don't know if the Formatter class is the best way to convert a 45.528652541 to 45.53 number for example.

    Thanks for any help.

    Nice day.

    Marc

    I ended up writing a method to do this...

        final static String toString(double sum)
        {
            // Turn random double into a clean currency format (ie 2 decimal places)
            StringBuffer result;
    
            if (Math.abs(sum) < .01)
            {
                result = new StringBuffer("0.00");
            }
            else
            {
                if (sum > 0)
                    sum = sum + 0.005;
                else
                    sum = sum - 0.005;
                result = new StringBuffer(Double.toString(sum));
                final int point = result.toString().indexOf('.');
                if (point > 0)  // If has a decimal point, may need to clip off after 2 decimal places
                {
                    if (point < (result.length()-2))  // eg "3.1415"
                    {
                        result =  new StringBuffer(result.toString().substring(0,point+3));
                    }
                }
            }
            return result.toString();
        }
    

    I would like to know if there is a better way!

  • Channel number SELECT dataset not return

    Hi, I have a problem with the following code:

    PROCEDURE create_so (p_import_batch IN VARCHAR2) 
     IS
    
    
     v_import_batch VARCHAR2(1000);
      
     CURSOR sales_c (x_import_batch IN VARCHAR2)
     IS
     SELECT pbo.*
     ,      msib.inventory_item_id
     FROM XXMEL_PVS_BSH_ORDER pbo
     ,    mtl_system_items_b msib
     WHERE 1=1
     AND msib.segment1 = pbo.material
     AND msib.organization_id = 26
     AND  to_char(pbo.import_batch_id) IN ( x_import_batch);
    
     BEGIN
    
      select '('''||replace(p_import_batch,':',''',''')||''')' 
      INTO v_import_batch
      from dual;
       
      FOR sales_r IN sales_c (v_import_batch)
       LOOP
       
        raise_application_error(-20001,v_import_batch);--Program should raise this error as the cursor should return rows
    
      END LOOP;
    
    END;
    

    I'm passing in the procedure a 1:2:3 as a VARCHAR2 parameter.  The value should be passed as a VARCHAR2 because we use a part of the shuttle from one page of the APEX.

    I want to extract all records in the table of pbo which have an import_import_batch_id (which is a number data type) as v_import_batch who, at the minute ('1', ' 2', 3').

    The import_batch_id is a numeric field, so I got to to_char to try to work with the VARCHAR2 parameter I am by the way.

    The

     select '('''||replace(p_import_batch,':',''',''')||''')' 
      INTO v_import_batch
      from dual;
    
    

    code works well and is back ('1 ', '2', 3') which is what I want.  If I then run the select with this hard coded that value

    SELECT pbo.*
           ,msib.inventory_item_id
     FROM XXMEL_PVS_BSH_ORDER pbo
     ,    mtl_system_items_b msib
     WHERE 1=1
     AND msib.segment1 = pbo.material
     AND msib.organization_id = 26
     AND to_char(pbo.import_batch_id) IN ('1','2','3')
    

    It works OK and return lines that I expect returned.  If I try to use the variable rather than the hard-coded value, the SELECT statement does not return anything.

    Any advice would be great.

    Thank you

    Chris

    You must convert your of as '1 ', '2',' 3' can be considered to be 3 ranks.

    Try the following question

    SELECT pbo.*
           ,msib.inventory_item_id
     FROM XXMEL_PVS_BSH_ORDER pbo
     ,    mtl_system_items_b msib
     WHERE 1=1
     AND msib.segment1 = pbo.material
     AND msib.organization_id = 26
     AND to_char(pbo.import_batch_id) IN (
     select regexp_substr ( txt, '[^,]+', 1, level) data from (select '1,2,3' txt from dual) t CONNECT BY level <= length (txt) - length (replace (txt, ',')) + 1
     )
    
  • REGEXP_LIKE ('HÖEGH', ' ^ [A-Z0-9 "-.--] * $" ") returns TRUE.

    Hi all

    10 gr 2, the expression above evaluates to true then in Java (and in my view must always) is equal to FALSE because character O. How do I apply only the characters A-Z (without any diacritic), 0-9, ".". ' - ' and ' ' ' (single quote)? In the case of 'HÖEGH', the expression should return false, as it is if you go here: http://www.regexplanet.com/simple/index.jsp.

    Thank you
    Kind regards!

    BB

    nls_sort must also be binary:

    SQL>  alter session set nls_comp = binary
    /
    Altersession successfully completed.
    
    SQL>  alter session set nls_sort = binary
    /
    Altersession successfully completed.
    
    SQL>  select * from dual where regexp_like('HÖEGH', '^[A-Z0-9''\.\-]+$')
    /
    no rows selected.
    
    SQL>  select * from dual where regexp_like('HOEGH', '^[A-Z0-9''\.\-]+$')
    /
    DUMMY
    -----
    X
    1 row selected.
    
  • When records [i] .isDisabled () returns true?

    Hello

    Please check this code

    ServiceBook sb = ServiceBook.getSB();        net.rim.device.api.servicebook.ServiceRecord[] records = sb               .findRecordsByCid("WPTCP");       String uid = null;
    
          for (int i = 0; i < records.length; i++) {         // Search through all service records to find the         // valid non-Wi-Fi and non-MMS            // WAP 2.0 Gateway Service Record.            ConstantData.data += "\nIs the current record valid?: "                   + records[i].isValid() + "\nIs it Disabled: "                 + records[i].isDisabled();
    

    Is to put this line when used in storm 2 with verizon 3 g enabled

    Is the current record valid?: trueIs it Disabled: false
    
    Data is valid and is enabled
    
    UID at record0: MMS 50009Is the current record valid?: trueIs it Disabled: true
    

    What happens the last line?

    I've found that when no link found

    Records [i] .isDisabled () is true.

    Are there other opportunities in Verizon? Coz, this occurs only with Verizon and not in any other service provider that I used.

    See the documentation for the ServiceRecord.isDisabled ()API:

    "True if this record has no routing information; Otherwise, true.

    So I think it is problem with the routing on your device carrier.

    You can also check getNetworkType() and getType() for more details on this service.

  • App settles at the bottom there is if acceptsForeground() returns true and another application called.

    Hi guys.

    I have an app that chooses his 'background or foreground behavior depends on its entry points.

    I don't want the background version is displayed on the Ribbon 'Application Switch' so I use recommended substitution: -.

    protected boolean acceptsForeground() {}

    Return acceptsForeground;

    }

    where the variable 'acceptsForeground' has been defined by querying the arguments of entry point.

    This works because the variant of the application background does not appear on the Ribbon "Switch Application". So far so good.

    However, when the application is running its first plan variant, a click on a mapfield launches BB Maps. Closed WhenBB cards, my application remains in the background and is accessible onlythrough 'Application Switch' or by clicking on its icon on the Ribbon (then the OS says that it is already running and he commutes in the foreground). I just return origin as it does without the "fix."

    If I take the 'acceptsForeground()' replace the sequence of mapfield BBMaps and back runs as expected, but the version of the application background appears in 'Application Switch' which I don't want.

    Any ideas guys? I've been hunting everywhere and there is no indication on the boards that someone has had this problem.

    BTW I have not yet delivered this material test, some simulators 9780 & 9800.

    Hi Peter,.

    Sorry I disappeared for a bit, I was faced with the emphasis on a mapfield as I had to pay to send this request to the UAT.

    In any case, the problem is solved, but in a strange way.

    When the problem occurred, I was stating the application variable before using it immediately. Once I moved the statement immediately after the start of the main method and assigned null in the declaration, all the rest worked as announced.

    What I'll be able to do, is to guarantee I have not had not previously forced the JVM to assess the class too early, causing some uninitialized fields to be null (i.e. what the call of acceptsForeground() substituted sometimes generated 'on the fly'). Various calls to the methods referencing fields may have forced the assessment. With the assignment statement and nothing happening really early I also assume that the assessment by the JVM is complete and correct. The application manager did not have a chance to enter in conflict with the main method.

    I think we can close this post and I thank you for your suggestions and help. Its always good to have a different perspective.

    Concerning

    Tim

  • I lost my serial number. How to return it...?

    Please help me

    Hi Andika,

    You can find your serial key by following the steps described in this document KB quickly find your serial number.

    Let me know in case if you encounter any problem.

    Kind regards
    Nicos

  • Is it possible to pdf content that spreads and have the page number on the two-page spread?

    Is it possible to PDF content chemically and have page numbers on the two pages of the spread? If for example spread 1 would be page 1 and 2 but would be only considered as page 1. Is is possible to change it to be page 1 and 2 and still a gap?

    The way to do this is to display the pdf as unique pages and then open Acrobat to change the initial display of the document settings. (There are in the file properties). Make the change, close and save the document, and then when reopen you it, you will see as spreads, but the search for the page will follow your InDesign page numbers.

  • Convert number rounded to two decimals

    Hi all

    I have a number of dice 156 in a column with number (10.2);

    but I want update in 156.00...

    Can be simple, but how?

    Edited by: 887268 may 29, 2012 10:04

    Hello

    156
    156,00
    156.0000000000000 and
    00000156.0000 are all the same NUMBER. There is nothing to convert.

    If you want to display a NUMBER in some way (for example, with 2 digits after the decimal point) and then use TO_CHAR or have your front end format the column. In SQL * Plus, for example, you can use the COLUMN command:

    COLUMN   sal     FORMAT  99999.99
    
    SELECT  ename
    ,       sal
    FROM    scott.emp
    ;
    

    Output:

    ENAME            SAL
    ---------- ---------
    SMITH         800.00
    ALLEN        1600.00
    WARD         1250.00
    JONES        2975.00
    ...
    

Maybe you are looking for