The arbitrary order?

Mark dba_constraints, I could end with a 'order by constraint_type. " But that means now that unique constraints are listed after the foreign key as 'R' sorts before 'U '. If I run the query to generate the SQL code to recreate the constraints, I get a lot of failures because foreign keys are supposed to reference primary or unique columns are limited and unique constraints have yet been created. It is not good, ordering me to constraint_type desc, either, because then I'll try to create foreign keys before that primary keys are created, as 'R' would be sort before 'P '. What I really need, it's all the main constraints, then all the unique visitors and all foreign keys, the Red Lantern.

So my question: is it possible to order by a column in an arbitrary manner, user-defined? Where you say, for example, "order by constraint_type ('P', 'U', 'C', 'R').

A bit like the list partitioning, when you get to define this as "coerced" a record for the partitcular partition, but this time, you get to set your command sequence.

Another example: I want to sort the EMP table in order of number of Department, but the order I want is "20, then 10, then 40 then 30", for some weird reason business you could imagine.

Feasible in a simple (or not so simple) request? I can see how four separate union queries could do it... wonder if there is nothing more elegant and which could spread easily to a lot more than 4 separate ordering values.

Decode the type constraint and the order of the decoded column.  In SQLPlus, you can even NOPRINT the command column.

SQL> create table hkc_test_90 (table_name varchar2(30), col_name varchar2(30), constraint_type varchar2(1));

Table created.

SQL> insert into hkc_test_90 values ('T_A','C_1','P');

1 row created.

SQL> insert into hkc_test_90 values ('T_A','C_3','U');

1 row created.

SQL> insert into hkc_test_90 values ('T_B','C_1','P');

1 row created.

SQL> insert into hkc_test_90 values ('T_B','C_2','R');

1 row created.

SQL> insert into hkc_test_90 values ('T_C','C_1','P');

1 row created.

SQL> insert into hkc_test_90 values ('T_C','C_4','R');

1 row created.

SQL> commit;

Commit complete.

SQL>
SQL> select table_name, col_name, constraint_type, decode(constraint_type,'P',1,'U',2,'C',3,'R',4) ctype_no
  2  from hkc_test_90
  3  order by ctype_no, table_name;

TABLE_NAME                     COL_NAME                       C   CTYPE_NO
------------------------------ ------------------------------ - ----------
T_A                            C_1                            P          1
T_B                            C_1                            P          1
T_C                            C_1                            P          1
T_A                            C_3                            U          2
T_B                            C_2                            R          4
T_C                            C_4                            R          4

6 rows selected.

SQL> col ctype_no noprint
SQL> select table_name, col_name, constraint_type, decode(constraint_type,'P',1,'U',2,'C',3,'R',4) ctype_no
  2  from hkc_test_90
  3  order by ctype_no, table_name;

TABLE_NAME                     COL_NAME                       C
------------------------------ ------------------------------ -
T_A                            C_1                            P
T_B                            C_1                            P
T_C                            C_1                            P
T_A                            C_3                            U
T_B                            C_2                            R
T_C                            C_4                            R

6 rows selected.

SQL>

Hemant K Collette

Tags: Database

Similar Questions

  • I'm looking for the third order intercept point

    How to find the point of interception of third order of my iphone 6? There is a sheet with all the technical specifications in relation to the my phone gsm modem. Thank you

    No, Apple does not publish or release this level of technical specifications to the public.  Since the 3rd order intercept is a purely mathematical concept for such low power as a smart phone device, I imagine that these kinds of data are unknown outside of Apple's own engineering group (or Foxconn I guess)?

  • Hear an album after another in the natural order

    In iTunes, there is an 'Album of the artist' option which allows me to listen to the tracks of each album in the natural order, one album after another. This seems not possible on my iPod Nano (6th). Does anyone have a suggestion? Classical music lover I find it confusing to have a concert mixed movements. BTW, there is a function to play all the tracks of all the photos in alphabetical order, but it's also discomforting

    Create a smart playlist that includes all the songs in your iTunes library.  I have a window Edit smart playlist list that looks like this

    This playlist has ALL your songs.  If this selection is too large to fit on your iPod nano, you can add additional rules to the smart, such as playlist

    Kind is classic  (all songs from the classical music should have entry kind of 'classical' music)

    The artist is [artist name] (create a separate smart playlist for each favorite artist)

    You can also use the points to Match only checked box, in order to limit the smart playlist of songs that are archived in the library.

    NOTE: You can use normal playlist instead and add songs manually.

    See the playlist in iTunes and use the sort order of the artist Album .  Set up synchronization for include the playlist.  If you synchronize library of ensemble music, it is included automatically.  Sync the iPod.  When you use your iPod, play songs in this playlist (with iPod a play in-order).

  • When I include photos from a folder in the Photos app in the dock, and I have created an album for them, their changes. It is important for me to keep them in the same order that they were in the file. (It's a numerical order). Any solution?

    Recently, I switched from PC to Mac, and I transferred all my files photo. Now I am their integration in the Photos app in the dock (by dragging the file etc). But when I include photos from a folder in the Photos app in the dock, and then create an album for them, their order in the album change of what it is in the file. It is important for me to keep them in the same order that they were in the file. (In the file it is in numerical order). Any solution?

    You can drag and drop to any order in your albums.

  • Keep the build order when replacing image?

    Hi guys this problem has plagued me for a while.

    I create a video model in Keynote. The intro slide has a video file (locked) followed by an (unlocked) image and finally another video file (locked). The three of them follow a specific build order with delays, which in turn creates the complete animation.

    I want that the user don't just replace this the Middle image on the slide with one of their choice.

    The problem is, once replace it user order image, positioning of the image and delay in construction are lost. Unfortunately I don't think users are sophisticated enough to follow instructions on how to set the build order, then replace the timing delay, the image needs.

    Is there anyway someone (with a limited understanding of Keynote) can replace the Middle image without compromising the build order?

    Thank you!

    Use an image placeholder:

    • Add a picture to the slide in the format (vertical or horizontal)
    • position and size according to the needs
    • Add a formatting required (picture frame, shadow, etc.)
    • Select the image then: Inspector > Format > advanced > define as media placeholder

    users drag and drop any image on the support of the place that adopts the formatting of the placeholder and keep the animation settings

  • Cannot complete the order after the iPhone booking 7 during the pre-order?

    Not sure if this is the appropriate place to ask... but did anyone encounter this problem with their iPhone 7 pre-order?

    After that I tried to place an order for the iPhone 7 more during the pre-order, I received an email from the Apple Store saying that my iPhone had been reserved and provided me with a reservation number. They said that they send an email when they were able to reach the carrier systems so I could place my order. Very quickly after I got a follow-up email confirming the booking number and was told that I could now go ahead and place my order. I have connected to the Apple Store, who acknowledged my reservation number, almost all of the screens orders went through, but when I hit continue to confirm the pricing plan that I had selected, the next screen shows the page of 'the page you are looking for is not found' dreaded.

    E-mail with the reservation told me that I don't have that until 4 PM PDT 9/10 to complete this order. Everyone knows this! I tried through the app store of Apple, Safari, and Chrome... and always get the same question. I've been on hold with Apple now for 45 minutes trying to get through, and they don't take chat requests. I'm so frustrated! Help!

    The site is probably hammered with requests for pre-order. I'll try again later if I were you.

  • How can I make my iPod Nano (7th generation) read albums in the correct order?

    I just bought a new Ipod Nano (7th generation) and synchronized my entire library.

    Now I want to listen to an album, but it seems that this system is unable to sort the pieces by number.

    Some are in good order, while other aren´t and when you listen to an album, it's really the most

    annoying as I ve ever had with any mp3 player.

    I looked for a possible system behind this and everything that I could find was, which instead of the title number the

    titles are sorted by add date. Is it possible to fix it?

    In addition, a way to contact support directly without having to CALL them?

    Sorry, but with a system that I had to pay € 150, this shouldn´t certainly happen...

    For a general context, see grouping of tracks in albums . Albums play in the wrong order when metadata numbers or sort of disk are set inconsistently. Playlists in iTunes can also be set to play in a different order than shown that can sometimes be confusing. Album by artist upward is usually the most sensitive order and can be copied to the reading order by right-clicking on the name of the playlist in the sidebar once you have set up.

    TT2

  • How can I change the sort order in the finder / media / photos?

    When I want to open a photo in an application I can access photos via the media / photos. The sort order is ascending. I want that the descending sort order. Where can I do this? Thanks for the reply! Christian

    You can click right in the grid of thumbnails and choose to display it as a list. You can then sort the columns by clicking on them.

    I don't know of a way to get to another level by default.

  • What is the sort order used Finder?

    I did a little research on this issue and found that (unless I'm missing something), the sort order of the Finder is not what it is supposed to be.

    The only requirement that I found is this note archived tech how Finder lists items that are sorted by name (Mac OS X) from 2012.

    In fact, almost everything what he described how Finder behaves, with the exception of the note at the bottom:

    Technically speaking, the Finder sort is based on the Unicode snack Algorithm, defined by the Unicode Consortium. This standard provides an order for all characters in Unicode sorting complete and unambiguous

    And that complicates matters, since (for example) the underscore character (officially called "bass line"), which sorts upwards and so before all alphanumeric value Unicode of U005F, which lies between the uppercase and lowercase Latin letters: 'Z' is U005A and 'a' corresponds to U0061.

    The reason I ask is because I would like to find a character that sorts after all Latin characters.  Many sort to before, including < space >, stress / < low line > and (my favorite for folders) < pointing right angle double quote > (i.e. "'").

    If it was really sort by Unicode, then it would be simple to use the selector of characters to insert a Unicode character value, such as U25B9, which is "▹.  "But we sort after space <>, < low line >, and" ' ", but before all Latin characters.

    I found an abstract character who works here for this, but I am helpless about the why.  U1400 is the Unicode section called "Unified Canadian Aboriginal syllable", and U1433, the "Canadian syllable Po", is a character who appears in the Finder as a very big plus of symbol: "ᐳ." (More than the symbol is ' > ' for comparison.)

    Yes WHY?

    Why think the Finder that's good (partial) order:

    U0020 "" (space)

    U005F '_' (bass line) < underscore >

    "U00BB '" ' (pointing to the right angle double quote)

    U005C "------" (Reverse Solidus) < backslash >

    U25B7 "▷" (white triangle pointing to the right)

    U0041 "A".

    U007A 'z '.

    U1433 "ᐳ" (Canadian syllable Po)

    Note: I see that note technical I linked to refers to the "Unicode snack Algorithm", which could indicate the answer somewhere in its depths.  If this is the case, then I guess this raises the question of why the Unicode coalition choose such an unexpected algorithm.

    Your "Note" has the answer.  Sorting of Unicode is not determined by the values of code as such point, it is determined by the algorithm.  This can be quite complex, but I think an easy way of having things to sort after Latin is to use a Greek character as µ (m option).

    http://Unicode.org/charts/collation/

  • Can't change the quantity ordered

    I try to order several copies of prints that I took to a local Little League. Here's the original order:

    When I click on + or enter the amount I get this:

    Any ideas?

    This problem lasts for several months.

    Currently, it is not possible to order several copies.

    The Print Store products support former users to send the order of an element, and then to update the order on the order status page or use the 'report a problem' link for the order.   http://www.Apple.com/shop/help/print_products

  • Try to update 3.6.28 to 27, the imported bookmarks, library displays all the files in the proper order, but 99% are not at all in the toolbar.

    Jscher and Cor - el tried to help me a few years back, without success.
    Try again to spend 3.6 (XP) to 27 (Win7).
    3.6 has been exported as HTML file (also have json) and imported in 27.
    The last time, I never "found" most of my favorites in 27 FF. Especially not the files.
    This time, I tried the library view and it seems that everything is there, records, underwater, in order etc.
    BUT... Unlike in 3.6.28, I still only see the contents of a folder in the pane on the right at the same time.

         I can't work like that.
    

    THEN, maybe, I can access ALL my favorites another way (not via library)? Via a toolbar maybe?
    But for some reason, the collection in the toolbar doesn't resemble loosely organized collection, I see in the library. Virtually no record and in the chaotic order. A lot of absent it appears. If the content of the library was reflected in the toolbar (using AIOS), I was good to go. Should I wait? What can I try?
    Thank you!!!

    If the bookmark that should appear in the folder of Bookmarks Toolbar are not in this folder, but is perhaps in a second Bookmarks Toolbar folder in the folder Menu bookmarks then you can move (copy / paste) them yourself to the correct folder in the library.

  • What should I do when iTunes post TV episodes in the wrong order

    I know it seems like an easy task. But what I do when iTunes TV post TV episodes in the wrong order.  I know that this seems to be a first world problem of the same (and it is) but showing bad episodes out of order is so infuriating.  And I paid $ first world over it.  Apple iTunes Australia displayed the 6 episodes of the ITV television series "Lewis" - twice MORE than two episodes 5 and 6.  I know now who is the murderer - I don't know who was murdered. I paid for the series. And I paid for it in the right order.  And... I saved these episodes so that I could enjoy together.  Now my night was ruined.  And you are right - no one died (except in the series, of course), but I don't want to let this pass.  The issue of small things. My annoyance issues!. He does.  And I paid for a product that I did not.  I called Apple support, not because personally, I want to get repair, but because no one should have to have the same experience that I had, and it should fix it, quickly, not in another 24 or 48 hours when someone (for the content provider fix it because according to apple, it's their fault) gets finally around him. When is watching a murder mystery - when the murder is solved before the murder.  VERY ANNOYING. I'm certainly not alone?

    You can try to contact iTunes Support via https://ssl.apple.com/emea/support/itunes/contact.html

    Or leave comments via http://www.apple.com/feedback/

    Or contact the TV company/holder of rights

  • How to change the sort order of the items sought for the last element of this research first. I DON'T want to say the order search engines, but the existing research by arrow down

    I want to be able to change the sort order of the items, I already looked in the search box. I want to be able to hit the arrow key down and see my previous searches in order of last search showing the first. For the moment, I don't know how it is sorting and it is very annoying to have to re - enter a query that I typed 5 minutes earlier, but because I typed in another 10 since it's lost somewhere in the list. Is it possible, I Googled, but did not find the topic anywhere. Just to clarify, I DON'T mean of the order of the search engines (which is what appears in google), I mean that the text typed into which has been registered in the drop-down list.

    Thank you

    'Form filling' uses a "frecency" algorithm, frequency + recency, similar to the list of AutoComplete address bar.

    I found an extension that seems relevant, but critics are old, so I'm not sure it's still working: Searchbar Autocomplete Order.

    But... is the AutoComplete does not? I expect that typing a few characters of the previous query would be to filter the list so that you can easily select? Or is the problem that the list does not remember quite who looking for?

  • iTunes has changed the order of songs on an album. How to restore the original order?

    I have a classic album. iTunes has changed the order of the songs. How to restore the original order?

    Order of songs is controlled by the number of drive and the beaches. Set them accordingly.

    TT2

  • Titles not in the right order

    I have an album on mu iPod, where the tracks are listed:

    Song 2

    Song 3

    The song 4

    Song 5

    Song 6

    7 song

    The song 1

    In iTunes, the track order is correct, but I've tried everything to fix and can't find the reason: I deleted the album, synchronized, and then added to the album back, synced again, but the first track always ends up at the end...

    No reason for it?

    It is probably incompatible use of the disc no. for detailed advice, see grouping of securities in albums .

    TT2

Maybe you are looking for