[8i & 10g XE] How to compare a column with the text of a column with numbers

This is probably a simple question, but I can't seem to find the answer. I tried variations on use to_number to_char and interpreters, all nothing will do.

The real problem is that I have a table with a column of numbers in a database 8i (datatype = NUMBER (3)) and a column with the text (datatype = CHAR (3)), and I need to compare two values.

This table has thousands of lines, but here's an example of the data in these two columns:
TXT     CHR
-----------
001     1
001     2
002     2
XXX     1
003     3
What I want to do is select the lines where the TXT and CHR VALUES do not match, then it would be (given my example):
TXT     CHR
-----------
001     2
XXX     1
But, I'm having difficulties in comparing two columns, because they are not the same type of data.

I tried to work on a simplified version of the problem in the 8i database both my 10g XE database:
SELECT     *
FROM     (
     SELECT     1.000               AS nbr
     ,     TO_CHAR(1.000,'000')     AS txt
     ,     CAST('001' AS CHAR(3))     AS chr
     FROM     dual
     )
WHERE     txt = chr
;
But this also returns any line, and it isn't even the "XXX" in the text column to treat in this example.

Can someone help me understand what it is that I'm missing?

Thank you!

Hello

user11033437 wrote:
This is probably a simple question...

Simple if you know the secret; maddening if you do not have.

... I tried to work on a simplified version of the problem in the 8i database both my 10g XE database:

SELECT     *
FROM     (
     SELECT     1.000               AS nbr
     ,     TO_CHAR(1.000,'000')     AS txt
     ,     CAST('001' AS CHAR(3))     AS chr
     FROM     dual
     )
WHERE     txt = chr
;

Try:

TO_CHAR (1.000, 'FM000')

By default, TO_CHAR leaves place the beginning of the string to a sign less, in which case he should ever one, TO_CHAR (1,000, '000') returns makes 4 characters, not 3. "FM" in the format said TO_CHAR do not add a space.

If it does not, after the release of DUMP (txt) for the few lines that you can't match, so that we can see exactly what is in them.

Tags: Database

Similar Questions

  • can anyone tell how to compare two documents with two controlled with the same mouse pointers

    can anyone tell how to compare two documents with two controlled with the same mouse pointers?

    Windows and OS X can only display a mouse pointer - it is created by the operating system, not the application.

  • How can I copy parts of the text of a pdf file in preview?

    How can I copy parts of the text of a pdf file in preview? For example, the beginning and the end part of a passage - copy not a few sentences in the Middle

    Select the first part of the text you want to copy. Press the command and option together and also select another passage of text. Now, press command + C to copy the two text selections.

    Hypothesis: The PDF did not limit content selection.

  • How to add an outline to the text?

    How to add an outline to the text?

    Add a line in the character of the text layer settings.

  • How to set background color of the text?

    I have a TextFrame: abcd

    I want to set the background color of the text "bc" is red

    How to set background color of the text?

    Who would be with custom underscore. Set the solid style, choose a color and to adjust the weight and offset of an underline, making it thick and move up behind the text.

  • How to compare two columns in Xl

    I want to compare two columns in the file of Xl. column A contains phrases and column B contains the words

    For example

    Column A                                                                       Column B                                                                           Column C

    I have an Apple and I'll eat every day Apple Apple

    I have a banana and eat weekly banana papaya

    Oranges are rich in nutritions cauliflowers Oranges

    Papaya is good for health                                               Grapes                                                                                 Papaya

    Oranges

    Lichi

    Banana

    I want to check each value of column B in each cell in column A, and if it matches then it should return the corresponding value in the result to me. Column C should Look Like as shown above.

    Can someone point me in the right direction here of what formula to use for this Xl.

    Thank you

    This is a forum for Mac OS X technologies, so here's an Applescript solution:

    1. Copy-paste the script in the Script Editor
    2. Select the cells in columns A and B
    3. Command + c to copy to the Clipboard
    4. Click on the button "run" in the Script Editor
    5. Click once in the top cell in column C where you want the data
    6. Command + v to paste

    Here are the results:

    There is no verification error here. You must select and copy to the Clipboard before the race.

    SG

    the value LstOfLsts to makeListOfLists (the Clipboard as a 'class utf8 ')

    the value theSentences to getCol1Vals (LstOfLsts)

    the value collected in getCol2Vals (LstOfLsts)

    game of theMatches to «»

    Repeat with I in collected items

    If theSentences contains I then ¬

    the value of theMatches to theMatches & i & return

    end Repeat

    Set the Clipboard for theMatches

    to getCol1Vals (LofL)

    game of col1Vals to «»

    Repeat with en LofL points

    the value col1Vals to the col1Vals & "" & i point 1

    end Repeat

    end getCol1Vals

    to getCol2Vals (LofL)

    the value col2Vals to {}

    Repeat with en LofL points

    If i's point 2 is not "" then ¬

    i copy point 2 to the end of col2Vals

    end Repeat

    return col2Vals

    end getCol2Vals

    at makeListOfLists (theTxt)

    value was to theTxt paragraphs

    the value text point of delimiters

    the value theListOfLists to {}

    Repeat with I from 1 to count was

    the value theListOfLists to the theListOfLists & {the was point i text elements}

    end Repeat

    the value point text delimiters to «»

    return theListOfLists

    end makeListOfLists

  • How to compare installed Windows with a disk

    How to compare Windows with a DVD disc and product installed?

    Me once again.
    Just read the error 0xC004F063 code indicates that the license service is not in the BIOS of the computer, the required license. This occurs when the parts have been replaced. Here, you should try an activation of the phone.

    See you soon
    Julia

  • How to get a subset of the text in a field of varchar2

    Hello.  I'm trying to select a subset of the text in a field of varchar2.  It is the view dba_audit_trail login information.  Here is an example of the field (dba_audit_trail comment_text):

    Authenticated by: Word of PAST DIRECTORY; EXTERNAL NAME: cn = orcladmin, cn = Users, dc is idacorp, dc = local; Customer's address: (ADDRESS = (PROTOCOL = tcp (PORT = 99999))(HOST=555.555.555.555))

    I'm trying to simply select the text of 'sleep' - i.e. everything after the first ' = 'up to the first"

    I can get everything after the first '=' with this:

    Select substr (comment_text, instr (comment_text, '=') + 1) of dba_audit_trail

    ... but I don't know how to stop at the first «,»

    Any help would be greatly appreciated.

    Thank you!

    Post edited by: DRC

    Hello

    Here's a way to do it:

    WITH got_pos AS

    (

    SELECT comment_text - and whatever the other columns you need

    INSTR (cooment_text, "=") AS equal_pos

    INSTR (cooment_text, ",") AS comma_pos

    OF dba_auit_trail

    WHERE--no filtering is going here

    )

    SELECT SUBSTR (comment_text

    equal_pos + 1

    , comma_pos - (equal_pos + 1)

    ) AS first_cn

    OF got_pos

    ;

    You could do it without a subquery; you would just do the exact same INSTR 2 times, I used equal_pos 2 times.

    You can also get the results desired using regular expressions, such as:

    SELECT REGEXP_SUBSTR (comment_text

    , '=([^,]*),'

    1

    1

    NULL

    1

    ) AS first_cn

    OF dba_audit_trail

    ;

    Although this uses less code, it is slower than with a SUBSTR and INSTR.

  • How to remove adds that cover the text making it impossible to read the text

    When an item is open, run to the bottom of the article an add is superimposed on the text makes it impossible to read the details of the new. Any attempt to remove fail it and the result of the opening to add it. How can I block the inclusion of these adds?

    This happens on all websites or only on certain sites?

    These messages may be generated by an add-on. Could disable you all THE modules critical or unknown here:

    • Firefox orange (or the Tools menu) button > addons > Plugins - particularly PriceGong «»
    • Firefox orange (or the Tools menu) button > addons > Extensions

    Then restart Firefox and revisit the problem pages in order to see if you turn it off.

  • BoolText.text how to give several channels (on the text and off text)

    How can I automatically change the text 'on' and 'Off' a Boolean value text. In the node property, I found BoolText.Text but how to use it to give power and text turn off? Thank you

    Hi TDE_CH,

    You can use the property '[4] Strings' to define these texts or you right-click on your control and use the Properties dialog box to change it.

    Mike

  • How to put a border around the text?

    Someone would be able to show me how to put a border of text around the text?

    Hello

    I think that if you want to put a border on the box containing that go to 'outline' so you can color and size choices
    but in the text, it is impossible.

  • How can I add background to the text in the Image?

    How can I add exact background behind the text on the pictures?

    bg6.jpg

    Announces a form (with the marquee tool, for example) between the image and the text layer and reduce the opacity according to the needs.

  • How do I change police inside the text fields of the form

    I went through tutorials on lynda.com and success exceeds my form.

    However I can't understand how a change of default Times Roman in form fields in a different typeface.

    I assigned followed by paragraph styles, object styles, but nothing happens. I also can't change the font color in the text fields.

    Anyone know how to change these attributes?

    You cannot change the default font to a form field in Indesign. You can change the font in Acrobat by changing the form > by selecting the field properties > appearance > fonts

  • How to add a hyperlink in the text of the legend?

    Hello

    I am using Captivate 5. Everyone knows how to insert a hyperlink in a text caption? For example, the text in the text of the legend are 'See Adobe Captivate Forum for more details'. How to create a hyperlink for 'Adobe Captivate Forum' which leads to the website of the forum?

    Thank you

    Helen

    There is no hyperlink tru object in Captivate as such.

    You can use a button or click box to provide users with an interactive object that when you click on will call a URL or a document.

    However, this is not really you give a substitution effect of mouse than the way users are accustomed to seeing in normal web hyperlinks.

    If you really want to add a piece of text of the hyperlink screen (with substitution effect) for a Captivate project, the closest, you will come to is this widget: http://www.infosemantics.com.au/hyperlink

  • How can we create ARC of the text as string options in illustrator?

    Hello

    I read illustrator js doc much time but you could not find any function that is responsible for the CRA the text as.

    Warp options in illustrator object-> deformation-> Make with Warp Envolop.

    Any body can help me, how can we have achieved that.

    Thank you

    Sana Ullah

    Hi Sana, distortion of the envelope is not scriptable.

Maybe you are looking for

  • HP Touchsmart IQ510 to play games?

    Hi, my girlfriend brought one of them, yesterday, the Comet and its brilliant, I just have a few questions. I tried to install The Elder Scrolls Oblivion and after that, the installation and I press 'play' it comes up with an error message saying...

  • How to copy an a refnum xygraph is - a?

    Normally it's simple enough to get my own. Purpose: Col Refnum XY graph for Subvi--> Purpose of Subvi: PRINT XYGRAPH to file/pdf/bmp, manipulate the xy graph more (back ground color change to leaving for printing, leaving graph xy for printing size,

  • BlackBerry Smartphones BBID locked out

    Hello. Is there a way around this headache? I forgot my BBID IDs I needed to purchase an app. As indicated, I opened a session on the Web site on my PC and reset my login and my password. Online, I can sign with no problem however my laptop seems to

  • Turn on Cisco IP Phones to the (VMWI or MWI) message waiting indicator Visual?

    How can I brighten Cisco IP Phones to the (VMWI or MWI) message waiting indicator Visual programmatically?

  • How to remove colors custom Script UI control?

    Dear forum,I am writing a script for batch renaming links in InDesign.If the user types the text edit field the new name which coincides with name of the original link (1st static text in the Group), the script gives a warning and he painted red.When