You place your order with the text and integers

One of the fields I need displayed is called ProductValue. According to the distributors of the product, the ProductValue can be an integer or text. I want the resulting table in order by value if it can be converted in its entirety, or alphabetically if he is unable. Currently I

Select *.
table t1
where table1. Product = 'box '.
Order by cast (table1. ProductValue as int)

This query works fine, but when I change "box" for "paint."
It causes an error "invalid number."

with no brake the table looks like

Product | ProductValue
-----------------------
box | 11111
box | 22222
Paint | Blue
Paint | Red
Paint | Green

The question is how can I order it by value if ProductValue can be converted to integer, or alphabetically if he is unable.

Published by: user10785638 on January 12, 2009 11:31

Thanks for pointing it out, Centinul.

Perhaps something like that for 10g and later, should do--

test@ORA10G>
test@ORA10G> @ver1

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

1 row selected.

test@ORA10G>
test@ORA10G>
test@ORA10G> --
test@ORA10G> with t as (
  2    select 'box' product, '000001111100000' productvalue from dual union all
  3    select 'box', '22222'   from dual union all
  4    select 'box', '11111'   from dual union all
  5    select 'paint', 'blue'  from dual union all
  6    select 'paint', 'red'   from dual union all
  7    select 'paint', 'green' from dual)
  8  --
  9  select product,
 10         productvalue
 11    from t
 12  order by to_number(regexp_replace(productvalue,'\D')),
 13           regexp_replace(productvalue,'\d');

PRODUCT PRODUCTVALUE
------- ---------------
box     11111
box     22222
box     000001111100000
paint   blue
paint   green
paint   red

6 rows selected.

test@ORA10G>
test@ORA10G>

isotope

Tags: Database

Similar Questions

  • You place your order on the Apple Site

    I ordered a 7 IPhone September 21, as it was very
    hard to get one at the store here in Rome, Italy
    at that time. Today, 7 October, I see that the IPhone is available to any
    store, but I have still not received my... and shipping follow-up shows that
    the phone is always located in Amsterdam, Holland. This means that it will be
    probably need another 7 days to be delivered to me! Now, I want to only disclose my
    concern that I think that what makes an online prescription should be advantaged
    otherwise it's not really a reason to buy
    an article on the Web Site!

    And this is the last time I'll do so!

    Thank you!

    Greetings from Rome

    !

    Don't know what your question on the iTunes Store, but you already know that you talk only to other users on these forums and that Apple are not here - if you want to contact Apple using the 'contact us' link at the bottom right of each page here.

  • You place your order with a reports folder

    Hi all

    I have a problem in sequencing the name of reports, the present system automatically organizes the reports based on alphabetically as below

    A
    B
    C

    I want the order to be as below, is that possible? I want reports to be arranged according to our use.

    A
    C
    F
    B

    Please confirm if this is possible.

    Thank you
    Natraj

    Hi Ludovic,.

    Maybe you can just put a number before the name of reports to change the sequence:

    1A
    2 C
    3 F
    4 B

    I don't know of any other possibility.

    Best regards, Tim

  • How to set text in an object, so the object expands with the text and has even space on both sides of the object in illustrator cc?

    How to set text in an object, so the object expands with the text and has even space on both sides of the object in illustrator cc?

    R,

    You can do this:

    (1) create the initial direct Type;

    (2) in the appearance palette dialog, click on add a new fill and define the color as you wish;

    (3) effect > convert to shape > Rectangle corners round/Rectangle/Ellipse and set parent > width/extra height as you wish (essentially what needs to be added to the size of the bounding box, if anything).

    After that you can change the Type and the filled area will fit as shown on the picture.

  • problems with the text and rounded rectangles

    So I have some rounding of the rectangles in fireworks, then export as fxg, and import it into flash catalyst - but they lose the roundness of rectangles square become. Also have problems with the text as half displaying or doesn't appear do not at all.

    feature request

    -would be really cool to be able to change the paths in flash catalyst

    -Edit the code in code view

    see you soon

    brand

    Hi, the absence of a property of corner radius is a limitation of the FXG export command in Fireworks CS4. We work closely with the Fireworks team to improve interoperability FXG in CS5.

    Thank you for your comments and suggestions.

    -brian

    Team Flash Catalyst

  • How to organize a table like 'move with the text' and 'around and underneath "? For now, my only option in the menu drop-down is "in line with text.

    Hello. I am trying to format a table, so that when I hit it, it moves to the bottom of the page and the bumps any text underneath down as well (that is if you can see the whole table and all text at any time)

    .

    However, the only options I seem to have are moving with the text > inline with the text. The first part is what I want, but having the means of inline with the text of table than all text below it floats UNDER the table, and you can't read it.

    PIC 1 - My only option when "move with the text" is selected. As you can see all the other features are also grayed out.

    Photo 2 - I want now, select above and below, but when I select something other that in line with the text...

    PIC 3... it jumps to stay on the Page option is not what I want.

    Any ideas?

    You can have a floating table in v4.3 Pages ' 09 that moves before the text typed before it, but this feature has not been added to any release of v5 Pages. Simply set the table in the Wrap Pages ' 09 Inline with the text Inspector, and object causes the film if you wish.

  • How can we have a column with the text and radio button in the same row?

    Hello

    I have a column that need to have data with a radio button. Has been able to achieve this by using < trh:tableLayout >. But when I select the option button it moves to the next line. You want to stop this behavior of option button to move to the next line. This column also includes a hyperlink. If the text and the hyperlink are made invisible visible based on the action of the radio button.
    Adding one more doubt. A horizontalgrid of specific columns can make invisible?
    Any help would be appreciated.

    example code:
    < trh:cellFormat id = "cf8" halign = 'Start' >
    < af:activeOutputText value = "#{rank." Actions}"id ="aot2"/ >
    < af:goLink text = ' #{rank. " Actions}"id ="gl1 ".
    clientComponent = "true" visible = "false".
    targetFrame = "_blank" destination = "http:// + #{rank." BUTTON_URL} ">"
    < / af:goLink >
    < af:selectBooleanRadio text = "" id = "sbr1" > "
    < af:clientListener method = "selectCheckBox" type = "click on" / >
    < / af:selectBooleanRadio >
    < / trh:cellFormat >

    Thank you
    Nita

    Remove the components from . Put the other components like the direct children of the PanelGroupLayout:

    
      
        
        
        
        
          
        
      
    
    

    If you need to add some space between the components horizontan, you can put (s) between components.

    Dimitar

  • After you place a disc in the computer and clicking on file, I can't find burn it to disc to copy.

    Help

    After you place a disc in the computer to copy an album. By clicking on the file but I can't BURN TO DISC? copy the disc.

    You again to create a playlist before you can burn.

  • You place your order by number Char field

    I have a char with data field.

    Required order is lower.

    Column1

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

    12

    12-A

    12-B

    122

    122-A

    122-C

    123

    123-A

    123-B

    I have to order both at the level of form and report.

    Pasha

    Lahore, Pakistan

    The 'trick' is pad strings or a part of them to the same length. In your case, it may be sufficient for the whole string if lpad suffix (A, B, C) are always of length 1.

    Otherwise, you will need to split the string at the position of the hyphen and lpad for both parties.

    Ah, now I see that you do not always have a suffix. Just so add an artificially.

    As the length, you must choose a value greater or equal to the maximum length of the string or their parts RESP.

    order by lpad (decode (instr (column1,'-'), 0, column1 |)) ((' - 0', column1), 10, '0')

    or

    Select Column1 from)

    Select

    Column1

    , max (length (decode (instr (column1,'-'), 0, column1 |))) (((' - 0', column1))) on len)

    tab

    )

    order by (lpad, len, '0')

  • How to make a slideshow of heroes with the text and the button for each slide?

    I'm trying to make a basic slide show (auto no buttons) which will be the width of page 100% and I want each picture to have a title and a status button they can click to access other pages, for the life of me I can't this is! What I am doing wrong?

    Indeed I could solve my problem, yay 2 + hours of troubleshooting finally paid off!

    I tried the white color text and read 'Check this video now!', but the background was a color of the light, so it is in contradiction with the white text. To remedy this problem, I created a rectangle shape, he made black and reduced the opacity to 40% and threw it behind the text. In order to get the button under the text that says: 'Click here'! I was able to use a copy + paste glitch by sticking the trio in the caption text box for an image, thus allowing me to have a unique caption for each photo in an automatic slideshow. The problem arises due to the notion of a chart of the icon to stay on the text no matter how it is pasted into the text box but I could understand that if you group the text above the rectangle elements before pasting in the text area of the legend, then the text will remain on the chart! Yay problem solved (at least for now)!

  • You place your order for recovery disc for mini 110

    Hello world

    first of all, I say this isn't really a laptop, I have a mini 110-3610sa.

    I've upgraded to windows 7 Professional to windows 7 basic, whatever he was going well until I stopped

    I lost the HP quick web and also the restoration of the factory, it goes to the windows recovery.

    can help you, I would really like to have fast web back it was very good and I was getting just configured with e-mails and fav sites.

    any help

    Ron tinydamed

    You can order recovery disks by following the instructions in the link below

    http://h20000.www2.HP.com/bizsupport/TechSupport/document.jsp?objectID=c00810334

  • You place your order of cross-directories

    Hello

    I need your help.

    I want to browse directories and order all the files by date.

    I used this command:

    cmd /c dir "c:\nuovacartella" / b/s A:-D / o:-d

    but the files are classified at the folder level.

    See the example:

    /C dir "c:\nuovacartella" C:\>cmd / b/s /A:-D / TC o:d

    c:\nuovacartella\cartella file\uno.txt

    c:\nuovacartella\cartella file\AAA\ciao.txt

    c:\nuovacartella\cartella file\AAA\due.doc

    c:\nuovacartella\cartella file\AAA\tre.xsl

    c:\nuovacartella\cartella file\AAA\appenaCreato.rar

    c:\nuovacartella\cartella file\BBB\B2\son a file.txt

    file Link\son a c:\nuovacartella\cartella

    c:\nuovacartella\cartella Link\uno

    c:\nuovacartella\cartella Link\appenaCreato

    c:\nuovacartella\cartella Link\ciao

    /C dir "c:\nuovacartella" C:\>cmd / b/s /A:-D / TC o:-d

    c:\nuovacartella\cartella file\uno.txt

    c:\nuovacartella\cartella file\AAA\appenaCreato.rar

    c:\nuovacartella\cartella file\AAA\tre.xsl

    c:\nuovacartella\cartella file\AAA\due.doc

    c:\nuovacartella\cartella file\AAA\ciao.txt

    c:\nuovacartella\cartella file\BBB\B2\son a file.txt

    c:\nuovacartella\cartella Link\ciao

    c:\nuovacartella\cartella Link\appenaCreato

    c:\nuovacartella\cartella Link\uno

    file Link\son a c:\nuovacartella\cartella

    but I want the files classified into cross-folder.

    Is it possible to do so (for example, using a batch script)?

    Thanks in advance. Leonardo

    Hi Leon,

    Thanks for posting your question in the Microsoft Community!

    I suggest you to ask your question on the MSDN Forums.

    http://social.msdn.Microsoft.com/forums/en-us/categories

    Hope this hslps.

  • Preloader you place your order

    Hi, I'm replenish items are several tutorials on different sites to create my own slideshow based on xml with correlated images. It works great except that I am not able to control the order in which the images are loaded. They get loads in the order that they are downloaded, not in order of my XML file. It is that is causing the links and other attributes that I put in my xml doc, to fall out of sync.

    I guess that there is a way to push my items in a specific order, or make sure that the additional attributes are loaded at the point where the image is pushed into the table. I guess some context would help (see attached code)

    I think that I have provided all the relevant information, but if you need to see another feature let me know.

    Yet once, in charge of everything very well when I test locally, it's just that the order is out of sync when I actually download the items. The heavier images are transferred backward, even though these attributes are in the right order.

    I really wish to keep pictures in the order of the XML doc, but if this is not possible I need to at least be able to make sure that the attribute values are assigned to the correct image container. I don't know where and how.

    Thanks in advance!

    Try:

  • You place your order of SNS-3415

    I ordered the SNS-3415 as ISE 1.1.4.

    I thought I have to install the ISE, however, it has been installed.

    but I don't know what is the ID/PW...

    No one knows about it?

    Hello

    You'll have to reimage, on a new installation, you should be presented with invites it installation.

    Tarik Admani
    * Please note the useful messages *.

  • you place your order in xquery-distinct values

    I was surprised to see the return of the following different results, is this a bug in the XML Query rewrite, or is the order of not only guaranteed the distinct values?

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    SQL > SELECT XMLQUERY)

    2 ' (string code points

    3 distinct-values ((99,98,97)))'

    4 ELECTION CONTENT) result

    5 FROM dual;

    RESULT

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

    ABC

    SQL > SELECT / * + NO_XML_QUERY_REWRITE * /.

    () 2 XMLQUERY

    3 ' (string code points

    distinct-values ((99,98,97))) 4'

    5 ELECTION CONTENT) result

    6 FROM dual;

    RESULT

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

    CBA

    SQL >

    Hello

    The specs say the order is "dependent application": fn: distinct values

    Summary so is (I guess), strict language point of view, should not rest on any apparent order in the resulting sequence.

    The results collected by the two queries probably be different for the same reason: different implementation.

    First one with XQuery Rewrite active is solved using the SQL operators and functions, something along these lines:

    SELECT 'CODEPOINT2STR_FUNC' ('SEQUENCE')

    DE)

    SELECT 'AGGREGATE_FUNC' (VALUE (T) SEPARATE) "SEQUENCES".

    TABLE ("SEQUENCE_FUNC"(99, 98, 97)) T

    ) ;

    While the second is evaluated by the XVM and apparently maintains the original order.

Maybe you are looking for

  • That means a green light flashing on iPod Shuffle 4th Gen?

    When you listen to songs on my iPod Shuffle 4th gen, the LED flashes green (connected to the helmet, not the USB port on the computer).  I thought it was supposed to stay green. What does a flashing green light?  Thank you.

  • Satellite A500 - upgrade from Vista to Windows 7 error

    I'm moving my Vista Home Premium to Windows 7 Home Premium via the Assistance of Toshiba upgrade so it will automatically download the software and some Toshiba Utilities. At the beginning of the launch, an error message 'this model does not support

  • Satellite A500/02J: Unable to get link REGZA/HDMI to work

    I have a laptop A500/02J Satellite with hdmi output, and I have a pre-installed toshiba hdmi control program.Recently, I bought a color LCD toshiba REGZA 32AV500A TV and have my computer works through the tv via hdmi. However, my tv has regza link an

  • OK for use with a 3rd party charger?

    Wanted to buy the Motorola chargerof origin, but it is out of stock. I found this Blackberry folding blade charger for Playbook Can I use this charger for motorcycle G 2nd Gen? People say it's a quick charger, I don't know if this will eventually be

  • E2000: Xbox and iTouch work... but not cell phone?

    I use a Linksys E2000 wireless router that works perfectly when connected to a Xbox 360 Slim with built-in wireless and an Apple 3rd generation iTouch. When you want to try to connect my laptop, it's another story. My internet connection laptop is hi