Order in question

Oracle version = 10g

Hi gurus

I have the sample data and I want to order this that data down so I use the multiple case statement, my question is that is a smart way to do the same task without using the multiple case statement, see below

Examples of data

WITH AS A REFERENCE

(

SELECT 1000 TM, 'A' am_pm OF DOUBLE UNION ALL

SELECT 100, 'P' FROM DUAL UNION ALL

SELECT 900 DUAL UNION ALL ' P'

SELECT 500, 'A' FROM DUAL UNION ALL

SELECT 920, 'P' FROM DUAL UNION ALL

SELECT 345, 'P' FROM DUAL UNION ALL

SELECT 230, 'A' FROM DUAL UNION ALL

SELECT 1230, 'A' FROM DUAL UNION ALL

SELECT 444, 'A' FROM DUAL UNION ALL

SELECT 500, 'P' FROM DUAL UNION ALL

SELECT 1030, 'A' FROM DUAL UNION ALL

SELECT 300, 'P' FROM DUAL UNION ALL

SELECT 333, 'P' FROM DUAL UNION ALL

SELECT 555, 'P' FROM DUAL UNION ALL

SELECT 1200, 'A' FROM DUAL UNION ALL

SELECT 100, 'A' FROM DUAL UNION ALL

SELECT 900 DUAL UNION ALL ' A'

SELECT 200, 'P' FROM DUAL UNION ALL

SELECT 323, 'P' FROM DUAL UNION ALL

SELECT 800, 'A' FROM DUAL UNION ALL

SELECT 236, 'A' FROM DUAL UNION ALL

SELECT 1100, 'A' FROM DUAL UNION ALL

SELECT 400, 'P' FROM DUAL UNION ALL

SELECT 200, 'A' FROM DUAL UNION ALL

SELECT 222, 'P' FROM DUAL UNION ALL

SELECT 1145, 'A' FROM DUAL UNION ALL

SELECT 1200, 'P' FROM DUAL UNION ALL

SELECT 930, DUAL UNION ALL ' A'

SELECT 130, 'P' OF THE DOUBLE

)

SELECT TM, AM_PM, BOX WHEN AM_PM = 'P' AND TM AS 12% ' THEN TM

WHEN AM_PM = 'P' AND TM AS 1% ' THEN TO_NUMBER(13||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 2% ' THEN TO_NUMBER(14||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 3% ' THEN TO_NUMBER(15||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM 4% ' THEN TO_NUMBER(16||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM 5% ' THEN TO_NUMBER(17||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 6% ' THEN TO_NUMBER(18||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 7% ' THEN TO_NUMBER(19||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 8% ' THEN TO_NUMBER(20||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 9% ' THEN TO_NUMBER(21||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 10% ' THEN TO_NUMBER(22||) SUBSTR (TM, 2, 3))

WHEN AM_PM = 'P' AND TM AS 11% ' THEN TO_NUMBER(23||) SUBSTR (TM, 2, 3))

ANOTHER TM

END FORMATED_RESULT

REFERENCE

ORDER BY FORMATED_RESULT DESC;

Result

TM, AM_PM, FORMATED_RESULT

920 P 2120

900 P 2100

555 P 1755

500 1700 P

400 P 1600

345 P 1545

333 P 1533

323 P 1523

300 P 1500

222 P 1422

200 P 1400

130 P 1330

100 P 1300

1230 1230 A

1200 1200 A

1200 P 1200

A 1145 1145

1100 1100 A

1030 1030 A

1000A 1000

930 930 A

900 A 900

800 TO 800

500A 500

444 A 444

236 A 236

230 A 230

200A 200

100A 100

Concerning

MUT

Hello

Mitchels wrote:

If I can add a colon (:) in the meantime?.) Thank you

Sure.  If you have a NUMBER as 145, and you want to display it as ' 01:45 ', you can use

To_char (n, 'FM00G00', 'NLS_NUMERIC_CHARACTERS ='.: "')

Tags: Database

Similar Questions

  • Order General questioning of IEC 60870-5-104

    Dear all,

    I use the NI Communications toolkit to create slave IEC 60870-5-104 (station controlled).

    I use s/w of Triangel microworks part and use it as the master for the same. I am able to send and receive the bulk of orders with the examples provided with the Toolkit to "C:\Program NIUninstaller Instruments\LabVIEW 2012\examples\IEC60870-5,

    I am not able to find a way to capture the "questioning general command" from the server.

     

    Can someone help me how to proceed with this.

    Thank you.

    Hi Frabto,

    The development team has had some great insights below. I have bad informed you (sorry!) behavior, that the command general question should be processed automatically in the communication stack.

    First the order of query sent to control the station may request the complete(station interrogation) or a subset (group interview) of all the data points on the control station. NEITHER 60870-5 to the command station supports the command when the control station receives an order of questioning of the station, it will reply with all the values of the data points. If the Group interrogation command, it will reply with the values of the data points that belong to the group. Users are not able to detect whether the query command is received or not, is automatically handled inside the battery, it allows users of the VI called "Set Group.vi" inside the VI polymorphic "set Property.vi" to set a point to be one of the 16 groups and you can see the usage with the example 'Interrogate information in Group.vi objects' in the folder of the example 60870-5.

    You shouldn't need to do anything to respond to a command of the interrogation. The station will automatically answer. I hope that I did not cause you too much confusion on this point.

  • Order the questions in the FAQ module

    I'm trying to settle questions of FAQ Business Catalyst module.

    He puts them in alphabetical order by default so I have numbered the. But once he arrives at 10 he's obviously out of order.

    And the customer does not want to put a letter on the front. IE A, B, C

    Any ideas on how to achieve this?

    Thanks in advance.

    I just look at the "other Options" section of the FAQ and found "Weighting" option. This is the solution. The higher the number, the greater the weighting. So if you're not sure how much FAQ you'll start 99.

  • Question list access

    Hello

    I have a question on the application of an external interface access list (I know it sounds a bit silly, but since I use on a deadline, I thought that it was preferable to order my question on this forum). This is for a router on which users can dial-in.

    I have defined an access list that is extended with a permit number.

    In the documentation that I found on the net, I noticed that there seem to be two ways to apply the access list to the interface.

    One way seems to be using the Dialer group command on the interface (and later Dialer list to link the access list for the Dialer group).

    A second way (I think :-), the normal way is to use the ip to the interface group-access command.

    My problem is that I do not understand the difference in implementation. What is the difference? Is there a documentation available on the matter (of course I could just be implemented with the command "ip access-group name in", but I would like to know why this is the right way to do it (or not)).

    Any help would be appreciated.

    Kind regards

    Ronny

    Hello

    The dialer list's composition by the Protocol or by a combination of a control protocol. It is used to grant or deny the composition of certain criteria.

    You probably ip group-access control to allow or deny traffic with certain criteria.

    Hope that helps

    Roger

  • Question of VMA preview concept.

    Hello

    Is it true that the VMAusage is common to vCenter, rather than using VMA we can actually control the ESX / I hosts instead of using vcenter?

    Kind regards

    AWT

    You can use VMA for orders of questions for the ESX host, individually (without a vCentre), but you lose all management functions which carry the vCentre.

    VMA will never be a replacement for a VC - your hosts will remain stand-alone hosts.

  • Captivate 5: reading random Questions in a Quiz

    Hi all

    I know it is possible to mix the answers to a quiz, but is it possible to mix the issues? I would like to mix my questions so that users are presented with quiz questions in a random order.

    Thank you!

    Brittany

    Next, you will have the chance would be to use the Question Pools and have many questions of variation.  Change the order of questions is not really effective.  Change the real issues is a much better way to test participant knowledge.

  • Where do you find the descriptions of the Terminal command options?

    Hello everyone

    OS X Terminal displays help if you add the option - help and introduction to the Shell script gives details of each Terminal command I find useful:

    https://developer.Apple.com/library/Mac/documentation/opensource/conceptual/Shel lScripting/CommandLInePrimer/line of command...

    However, none of them tells you the function of each of the options such as '-f' and '-I ' to 'rm' command

    If someone knows where are the descriptions of the command options, please send the url?

    Thank you in advance,

    E

    Type in 'man' followed the order in question, without the quotes or options. The index can be found by clicking here.

    (143223)

  • Can I use Ctlref in a structure of the event with a mouse to an event?

    I have a large number of controls on a front panel. I use a structure of the event that triggers the movement of a given motor when you press the corresponding button. However, I would like to avoid creating events for identical most of N, so I relied on the use of a mouse down on the front panel event, then retrieve the reference command using the Ctlref node (with gives 'Reference to the control on which the event occurred', according to manual labview) and analyze an array of references to know which engine is supposed to move. However, it seems that this node is not (contrary to what the manual said).

    I found other ways to do what I need (I thought using a table containing details of my controls and the coords in the structure of the event node), but I wanted to know why I can't find this node (that is displayed for the event "value change" for example). I'm using Labview 2013.

    No luck for you. Mouse down on the Panel does not have the refnum control because it does not work on a control. Mouse down on a control has it, and since you can configure the mouse down events on multiple controls in the same case of event, it also provides a refnum of control so that you can still use the order in question.

    This is probably also the question that Jeff might have seen. When you set up multiple events for the same frame that LabVIEW displays only the terminal event that are present in all of these events. Terminals that do not exist in at least a specific event of the multiple events for this image are more selectable.

  • I started checkdisc in SafeMode with elevated privileges, but does not

    Rebooted to get the utility will, but he will not normal boot, safe mode, but once again. only way to reboot click on the button and let the F8 to take me to normal windows.

    System32 seems to work hard, but not the process of 45 minutes for checkdisc, others talk about disk check who need 45 minutes. I did not comment on whether if the disc is dirty or not; as you can see I've already gotten so that it starts without any to happen

    My goal is to get an extra speed in my system.

    I also ran: ccleaner, System Restore, system boot update minimum tool, Malware, preparation and get a copy of my registry

    Using Vista Business 32-bit

    Thank you

    Hello

    This is how to run and different orders in question:

    "How to run the check disk at startup in Vista or Windows 7"

    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    See you soon.

  • SMO NetApp ORA-00119 (Local_Listener) ORA-00132: Net syntax error / name

    Hello

    I myself have killed on it for days and have searched the forum after forum without results. Here is the configuration:

    (1) a production of database Oracle running 10.2.0.5 with a listener running on the Port of 1690. Solaris 10 Sparc.
    (2) NetApp Oracle Manager Snap 3.2
    (3) two Snap index Repository Manager on a separate binary install of Oracle 10.2.0.5 listens on ports 1521 and 1522. (Same host)

    Orders and questions.

    I was able to create the repositories very well and was able to take snapshots of databases all three. When it came time to run a preview of a Snap Restore, both instances of repository provided to ports 1521 and 1522 on other respective databases to get a restoration plan. It worked if the bodies were facing upwards or downwards. The listeners were obviously upward. Two repositories share the same TNS_ADMIN and ORACLE_HOME - separate spfiles and data files.

    When the time came to get a glimpse of the restoration of the production database, he showed the right plan, when the database has increased. The listener has increased and it showed JDBC hit once. When the production database is down, the preview has tried to knock three times the production database with JDBC and failed to make a [STARTUP NOMOUNT]. The TNS_ADMIN is not shared with the repository databases. Here is the command and the error.

    SMO backup restore - profile NDDB-FULL-SNAP-label F_A_20121107112828CST-complete - controlfiles - recover - terrababdelhak-overview

    [ERROR] SMO-13032: cannot perform operation: overview of backup restore. Root cause: ORACLE-20001: error trying to change the State Started for the NDDB database instance: ORACLE-00001: SQL error: [STARTUP NOMOUNT;]. The command returned: ORA-00119: invalid specification for the system LOCAL_LISTENER parameter
    ORA-00132: error syntax or network name not resolved "LISTENER_NDDB."

    [ERROR] SMO-13048: Restore overview status of the backup operation: FAILURE
    [2c9204103ae5e3d5013ae5e3e6950001] ID card operation failed. Error: SMO-13032: cannot perform operation: overview of backup restore. Root cause: ORACLE-20001: error trying to change the State Started for the NDDB database instance: ORACLE-00001: SQL error: [STARTUP NOMOUNT;]. The command returned: ORA-00119: invalid specification for the system LOCAL_LISTENER parameter
    ORA-00132: error syntax or network name not resolved "LISTENER_NDDB."

    The production database is in place for six years and has no problem when connecting as sysdba so I don't think it is quite the problem. There must be something simple. It works * * when the database is running, but not when it is stopped. It should work.

    Published by: user11377518 on November 9, 2012 09:13

    What are your production server tnsnames.ora entries. I missed those?

    The error means generally you attach to use a friendly name for local_listener in the boot parameters, but to have not configured in the tnsnames file.

    Another option is to not use name friendly and instead the full entry.

    ALTER system set local_listener = '(ADDRESS = (PROTOCOL = tcp) (HOST = test-NDDB) (PORT = 1690))' scope = spfile;

    Rebound of the instance

    Edited by: damills on November 9, 2012 14:51

  • SQL script

    I want to retrieve the records below en

    The table contains 'A'
    SVC_ORDER_NO     CIRCUIT_ID
    
    C8794500                  DD2BL4437037/DD2BL4437084
    C8794500A     DD2BL4437037/DD2BL4437084
    C8794500B       DD2BL4437037/DD2BL4437084
    C8796836                    DT2CV44G0553/DT2CV44G0780
    C8796836A     DT2CV44G0553/DT2CV44G0780
    C8796836B                      DT2CV44G0553/DT2CV44G0781
    After the svc_order_no (8digit) ' a / b ' represents the version # for the same svc_order_no... The Circuit_id must be the same for the same svc_order_no

    In the documents above, the subscription circuit_id contains svc_order_no "C8796836B" "DT2CV44G0553/DT2CV44G0781". If its bad record... I have wnt to retrieve the records that it wrng circuit ID in the corresponding svc_order_no

    The C8794500 is a becsaue good identity circuit everything has the same value in all C8794500/C8794500A/C8794500B

    938973 wrote:
    I use oracle 10g... If it is not wrking in my PB. Are there any other keyword rather than listagg

    3 options:

    1. use the min/max function to get at least 2 values to work later with

    2. use the subquery retreve all records in the orders in question:

     select * from A
    join (
      select substr(SVC_ORDER_NO,1,8) as SVC_ORDER_NO_BASE
      from A
      group by
      substr(SVC_ORDER_NO,1,8)
      having count(distinct CIRCUIT_ID) > 1
    ) SVC_ORDER_FAILURE
    where substr(A.SVC_ORDER_NO,1,8) = SVC_ORDER_FAILURE.SVC_ORDER_NO_BASE
    

    3. change your data model to make this impossible inconsistency.

    I would go for the latter.

    Good bye
    DPT

  • Any means of re - run jobs all failed?

    DB: 10 gr 2
    OS: Win2k3

    I was able to interview all the tasks that failed by:
    Select log_date, job_name, to the status of dba_scheduler_job_log
    where owner = 'xyzx.
    log_date desc order

    My question is, is there a quick and painless way to run a script or something that will be re - run all jobs failed? If someone has written a script, please enlighten me.

    Thanks /.

    Sorry for misleading (i.e. When you don't test...), the script should actually be:

    begin
    for i in (select job_name from dba_scheduler_jobs where enabled='TRUE' and failure_count > 0) loop
    dbms_scheduler.run_job(i.job_name);
    end loop;
    end;
    / 
    

    Nicolas.

  • Question about pre-ordered Album, (first time)

    For my birthday my sister gave me a $ 25 Itunes gift card and I went and pre-ordered the new Album of Metallica Deluxe, (The Set 3 disc) and I confirmed my purchases of 14.99 and my question is,.

    Has paid for the entire album in full, or each track when you click on the pre-ordered button? I am responsible for the 1.29 for the first single and again here second single, (two songs)

    Will need me even more money or the 14.99 will always cover the entire album?

    Will need me even more money or the 14.99 will always cover the entire album?

    14.99 + tax will cover it.

    When you pre-order, you pay for the titles as they become available and then pay the balance when the full album is available.  In the end, you have the complete album for the price of the correct album.

  • you forgot to answer the secret questions on APP Store too, I lost your e-mail account in order to find the answers

    I forgot to answer the secret questions on APP Store also, I lost my email account in order to find the answers

    You have to ask Apple to reset your security questions. To do this, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.

    (136721)

  • Question of operation sequence - order of execution of events

    Hello

    Im a VI to measure the current and the voltage across a writing device.

    To do this, I increment the tension, and for each increment, I measure voltage and current.

    I send SCPI commands to feeding and the meter with GPIB.

    My question is: in looking at my code, it seems that there is no dependence on the data between 'writing of power' (top left)

    and "write meter", while doing everything first?

    The program works fine, but I want to make sure that it is not out of pure luck.

    I am a beginner and I would appreciate more your help and comments.

    Thank you

    Nicolas

    Miguel_F wrote:

    Hi htnicolas,

    Two possible options to control the order of execution are:

    (1) use the structure of the sequence. (I guess it's preferable)

    (2) pass a parameter of a Subvi to another. Not sure whether it is advisable or not, but I spent one Subvi to another error to control the front execution order.

    Hope that helps a little.

    Actually the structure of the sequence is the least preferred method to apply the operation.  Data dependence is preferred (using the error string)

    LabVIEW is a language of stream - for you new guys this means that a block of code can if run as soon as all its inputs are available it does not matter what block which is a sub.vi, a business structure, a loop of what anyone with a boundrary that you can wire an input value.  Without dependence of data there is no easy way to determine what is happening in what order and LabVIEW will even go up to run a greater number of them AT the SAME TIME that you have available cores.  (Multithreading is easy in LabVIEW)

    It has been that the code would run from the back to the front, but many things have changed with the new compiler and optomizer, so this is true if the code is changed during compilation.

Maybe you are looking for

  • Re: Battery sinks

    I had the laptop a month now and notice that when I have a fully charged battery when I turn off, her stockings. It is Ok with my computer or I would return it?

  • Satellite L350-H20 HDD / SATA-Controller Driver

    Hello yesterday, I tried to reinstall Windows 7 x 64 (and/or Windows 8) on my laptop. When I got to the screen where you can select the partition / drive to install the OS on, I wanted to delete all them were leaving (C: and D :) and recreate them fo

  • trying to connect HP lp2065 with video cable check hp 2133

    Hello I'm trying to connect the hp lp2065 monitor to my hp mini 2133 laptop. When connected, he said CHECK the VIDEO CABLE and then to sleep. pls help... I have windows vista, have tried to download the drivers but the hp site has them for xp and win

  • Wallpaper of error

    I have a 32 bit OS with Windows Vista home premium gateway.  I have all the equipment and original software.  I am able to put my wallpaper with personal photos.  However, when I try to apply a wallpaper on the internet like a Peyton Manning wallpape

  • What are the limits, as a developer?

    As a developer, I can access the environment no ModernUI? Can I make the changes and tweaks harmless? (such as increased sensitivity to touch and sensitivity to the touch cover)