How to achieve the order base on my input?

Hi all,
I have the following query
select column_name,column_id from user_tab_columns
             where table_name = 'ITEM_GROUPS'
               And column_id in (Select to_number(column_value) from The(Select cast(str2tbl('25,26,31,32,24') as mytabletype) from dual))I passing the input to str2tble function like the above examble ('25,26,31,32,24'). But when i run the above query,
i receiving the following output.
1     TYPE       24
2     MOC1     25
3     MOC2     26
4     SIZE1     31
5     SIZE2     32But i need the output based on the my input order. like
1     MOC1     25
2     MOC2     26
3     SIZE1     31
4     SIZE2     32
5     TYPE             24Please help me how to achieve this.
kanish

Off topic, but why aren't you just doing this:
select column_name,column_id
from user_tab_columns
where table_name = 'ITEM_GROUPS'
  and column_id in (25,26,31,32,24)If you want a guaranteed order, then you will have to specify and ORDER BY.
For instance this one (though I don't expect that this is what you are looking for).
order by
  case column_id
   when 25 then 1
   when 26 then 2
   when 31 then 3
   when 32 then 4
   when 24 then 5
  endYou might try this (not tested):
select c.column_name,c.column_id
from user_tab_columns c
     ,(select to_number(column_value) as col_id
             ,rownum as rn
       from The(Select cast(str2tbl('25,26,31,32,24') as mytabletype) from dual) x
where c.table_name = 'ITEM_GROUPS'
  and c.column_id = x.col_id
order by x.rnEdited by: Toon Koppelaars on Apr 27, 2011 12:53 PM

Similar Messages

  • How to achieve the results by Query ??

    Hello Guys,
    I have couple tables which I need to join to get the result....This is what is in the tables...
    CList Table
    CID, Name
    A, ABC
    B,CDE
    C,JFK
    JList Table
    JID, Name
    1, Something
    2, Another
    3, Else
    4, Should be something
    JOb_2_Courses
    JobID, CourseID
    1,A
    1,B
    2,C
    Employee Table
    EID, Job_ID
    1A, 1
    2A,1
    3B,1
    2C,2
    23D,3
    CStatus Table
    StatusID, Desc
    1,Completed
    2,Pending Approval
    3,Declined
    4,Scheduled
    5,Register
    Now user can only register the course which are related with their job....NO course else.....
    When they register it is moved to temp_course_registration and then once completed to COURSE_HISTORY
    For Example : So Employee : 1A will see two courses to register A and B...
    Say he registers A....it makes an entry in temp_course_registration table with the course id, employeeid and date....
    With further steps once that status is updated to '1'.....the course is deleted from temp_course_registration and is moved to course_history........
    Now to show to the user...I need to include all my tables in the query and on the basis of status, show necessary things to the user....
    Output :
    Course_ID, Status.............
    Say if they completed the course will come from course_history, if in the process will come from temp_course_registration.....if nothing is in the tables for the specific employee...this means status is '5' and they need to register everything...
    Can someone let me know, how to achieve the results....
    Thanks,
    Harsimrat

    Hello
    I'm off home now so I can't look at the query, but for future reference, if you want to improve your chances of getting help, you need to provide simple create table statements, and test data to go with it. I've done that with what you provided and hopefully someone else will be able to help. Also, you were asked if you could provide this in your other thread...
    CREATE TABLE CList(CID varchar2(1), Name varchar2(3))
    insert into clist values('A', 'ABC');
    insert into clist values('B','CDE');
    insert into clist values('C','JFK');
    CREATE TABLE JList(JID number, Name varchar2(30))
    insert into jlist values(1, 'Something');
    insert into jlist values(2, 'Another');
    insert into jlist values(3, 'Else');
    insert into jlist values(4, 'Should be something');
    CREATE TABLE JOb_2_Courses(JobID number, CourseID varchar2(1))
    insert into job_2_courses VALUES(1,'A');
    insert into job_2_courses VALUES(1,'B');
    insert into job_2_courses VALUES(2,'C');
    CREATE TABLE Employee (EID varchar2(3), Job_ID number)
    INSERT INTO employee VALUES('1A', 1);
    INSERT INTO employee VALUES('2A',1);
    INSERT INTO employee VALUES('3B',1);
    INSERT INTO employee VALUES('2C',2);
    INSERT INTO employee VALUES('23D',3);
    CREATE TABLE CStatus(StatusID number, Descr varchar2(30))
    insert into cstatus values(1,'Completed');
    insert into cstatus values(2,'Pending Approval');
    insert into cstatus values(3,'Declined');
    insert into cstatus values(4,'Scheduled');
    insert into cstatus values(5,'Register');HTH
    David

  • How to change the order of the fields in the queryoutputnode in OVS.

    How to change the order of the fields in the queryoutputnode in OVS.

    The actual requirment is to re-arrange the elements of the queryoutput node, to look more organised
    say for ex.
    Seq 1:
    c code                            company name                          g/l ac                g/l ac description  
    Seq2 :
    g/l ac description             c code                                       g/l ac                company name  
    Seq 1 way of representation is more organised that Seq2. How can we achieve this re-arranging of ordering in the queryoutputnode.

  • How to calculate the quota base quantity in quota arrangement?

    Hi all,
    As we all know, when a new supplier is added in the quota arrangment, we take the help of quota base qunatity so that the new supplier does not get any unfair advantage over the existing suppliers. Would you please help me on how to calculate the quota base quantity or on what basis the quota base quantity is calculated?*
    Regards,
    Ranjan

    Dear,
    Quota arrangement divides the total requirements generated over a period of time among the sources of supplied by assigning a quota.
    Quota u2013 quota is equal to a number and its represents the proportionate of requirements. Total quota of all the vendors is equal to 100% of requirements.
    This quota arrangement is also specific to material and plant level.
    Quota rating = quota allocate quantity + quota base quantity / quota.
    Quota based quantity used only when a new vendor introduced.
    In the as on date situation, the minimum quota ratings will considered as preferred vendor.
    The 2 vendors has 2 same quota rating, the vendor who is having the highest quota will considered first.
    In the running quota, a new source of supply is included. (In situation of short supply) including a new source not means to reduce the quota for existing.
    Regards,
    Syed Hussain.

  • How to change the order of albums iOS 8?

    I recently upgraded from an iPhone 5 to a 6 Plus. Everything is fine except for the fact that some of my music is in the wrong order. There are some groups that released multiple albums in the same year, and I would like them to be in the order of when they were released. On my 5 I was able to put them in the right order by going on a computer, changing the sorting, then update iTunes Match to have it change on my phone as well. (example; group came out with album "1" and "2" same year and it defaults to "2" first, then "1." I was able to change it on the iPhone 5 to be in the right order by changing how they are sorted from my computer but that doesn't work on the 6 Plus.) I would like to order it where it goes top to bottom, with the newest on top going down. How would I do this?
    Thanks

    Hi Jason,
    How to change the order of tables within sheets
    Make a table active by clicking in it once to select that table, then drag it by the 'bullseye' (top left, I have placed a red circle to show the bullseye):
    After dragging the table down:
    Table 1 is now below Table 2.
    The blue line is an Alignment Guide
    Two types of Guide:
    1. Menu > View >Show Rulers. Drag Alignment Guides from a ruler to where you want them.
    2. Menu > Numbers > Preferences > Rulers > Alignment Guides. Turn on (tick) both guides. That allows you to align objects with *each other* (as well as with the ruler guides). These guides help to align objects left, middle, right, top, bottom.
    Alignment Guides do not show unless you are moving an object.
    to drag/move table to another sheet in the one file
    Not possible in Numbers 3. The Sheets Pane has gone. Instead, select the entire table (click once in the table to make it active, then click on the bullseye). Copy (or Cut if you are brave). Go to another Sheet and Paste.
    Also can you change the size of sheet tab width on tab toolbar, so I can see more sheets at once??
    No. Let's hope this will be added in future updates. However, you can drag a Sheet tab left or right to reorder them.
    Another tip: each Sheet tab shows the contents of that Sheet, with some options such as Duplicate and Delete:
    Regards,
    Ian.

  • After the new project by importing PPT release, how to achieve the release of the demo mode SWF, but not now only Click to continue?

    After the new project by importing PPT release, how to achieve the release of the demo mode SWF, but not now only Click to continue?
    Note:Captivate 5.5
    Thks

    通过导入PPT新建的项目发布后,如何实现发布演示模式的SWF(自动播放),而不是交互模式的SWF(只能点击才能继续)?

  • How to get the order for these decoration​s?

    hello,
    I want to programatically resize all the controls, indicators and decorations on the front panel.
    I am getting the references of all the controls and indicators and able to resize them, as each n every control and indicator has a tabbing order set to it.
    I am also getting the references of all the decoration used on the front panel but not able to get the order.
    how to get the order for these decorations?

    The order of the decorations is the same as the back to front order. So you
    can change it by bringing decorations to front, or sending them to the back.
    It has been suggested many times that decorations should have labels as well
    as controls, but at the moment there is no way to tell which reference
    belongs to which decoration (besides position and order).
    Regards,
    Wiebe.

  • How to organize the orders of audio files in ipod?

    Hey guys, I'm having a problem in organizing the audio files on my ipod, I wish you could help me out. I transferred some language lessons to my ipod, however they are not in order. If they are just songs it's OK, but for language lessons you really want them to be in order. Anybody can teach me how to arrange the order of audio files on ipod? Thanks a lot!
    ipod video 30GB

    Thanks for the reply, Chris. Are you talking about how to change the file name on itune or on ipod? I couldn't find the way to edit any info of the audio files on itune. And the file names were already in order (i.e. French001,French002...) but they appear on itune & ipod in different order.
    Thanks again.

  • How to change the order of the icons in the dock with Lion?

    Hello
    since I've installed Lion on my Mac I cannot change the order of the icons used for quick launch.
    Any idea how I customize the order of the icons?
    Thanks
    Mac-Fanatic

    I suspect you'd get a very prompt reply in the Lion forum:
    https://discussions.apple.com/community/mac_os/mac_os_x_v10.7_lion

  • How to change the order of users in appearance of login screen?

    Hello!
    Because we often switch to a user,
    which is listed last in login screen,
    we want move them to the second place.
    How to change the order of users in appearance of login screen?
    Thank you for a tip
    Erhy

    The order users show up on the login screen is the way they are ordered under the
    C:/Users directory. This is usually alphabetical, AFAIK there is no other way to change the order other than to change the username to something that starts with a letter that will be higher alphabetically.

  • How to achieve the project is obligatory entry when creating transport requ

    Hello
    How to achieve the project is obligatory entry when creating transport request

    In T-code SE03, under Administration -> Display/Change Request Attributes
    Select "SAP_CTS_PROJECT" and hit the change button and then change the value of "Default for All Clients" to Mandatory
    Hope this helps.
    Thanks,
    Naveed

  • How to achieve the best quality when doing a narration?

    Hello,
    I'm trying to figure out how to achieve the best possible narration in a documentary I'm doing using the FCP voice over tool, a USB mic, and Final Cut Studio's audio filters. Am I on the right track? How do I clean up an average voice over narration? Do I need additional equipment? Any advice would be appreciated.
    Thanks,
    Jordan

    The best thing you can do is to record it properly in the first place - if you want it to sound good. The environment you record in is VERY important as is the choice of mic you use ... most of the consumer USB mics aren't all that great in terms of quality.
    Record in an acoustically flat room with good sound dampening. Even a clothes closet will do in a pinch. Record through a mixer so you can monitor the VO artist as they record. I've found it better to record to tape (camera or VTR) with a pro mic than to use FCP's voice over tool.
    -DH

  • How to achieve the fatest Digital IO write speed?

    How fast can I write to a digital IO port?How to achieve the fatest write speed? For test purpose, after config port, using DIO Port write.vi in a whileLoop by 6024E board,repeatly write1-2(01 and 10bin), i can only get a speed about 10kHz,i.e. every 106 us write a byte, can that be faster? how? software solution and hardware solution? Thanks!

    Hey Yfayne,
    It is very hard to say how fast you can write the digital lines on an E-Series device, because it is completely software and computer dependent. The exact same DAQ device with the exact same code will execute completely different on a 233MHz machine when compared to a 2.4GHz machine, because it depends on how fast the computer can execute the loop. If your program slows down to perform another task like opening another program or surfing the web it will slow the rate the computer can execute the loop and mess up the timing.
    In addition, the digital lines on the E-Series use the DAQ-STC chip that was never designed for high speed. If you need a high speed hardware time device I would suggest using the PCI-6533 or PCI-6534. The devices were desig
    ned for high speed digital applications and can easily exceed the 10 kHz rate consistently.
    Here are a few links that you will find useful.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/467ed254f3a30b1286256a6f00720951
    http://sine.ni.com/apps/we/nioc.vp?cid=1104〈=US
    I hope this helps out.
    Joshua P.
    Application Engineering
    National Instruments

  • How to achieve the from and to date range in report builder 3.

    I AM TRYING TO CREATE ONE REPORT FROM REPORT BUILDER 3.
    WHERE I AM UNABLE TO DEFINE THE DATE RANGE.
    HOW TO ACHIEVE THE DATE RANGE IN REPORT BUILDER.
    NEED FROM DATE AND TO DATE FILTER IN REPORT BUILDER FOR PK DATE.

    Hi Ganesh,
    According to your description, you create a report in Report Builder 3.0, and create two parameters FromDate and EndDate, now you want to use the parameters in your MDX query, right?
    If in this case, here is a sample query for your reference.
    select
    {[Measures].[Internet Sales Amount]
    } on columns,
    {[Date].[Date].members} on rows
    from(
    select
    STRTOMEMBER("[Date].[Date].&["+@StartDate+"]"):STRTOMEMBER("[Date].[Date].&["+@EndDate+"]")
    ) on columns
    from [Adventure Works]
    Reference:STRTOMEMBER
    Regards,
    Charlie Liao
    TechNet Community Support

  • Can't remember how to reverse the order of the tracks in a playlist ~ can anyone help  me out?  Thanks.

    Can't remember how to reverse the order of tracks in a playlist.....can anyone help me out?  Thanks.

    Were you able to figure it out?

Maybe you are looking for

  • In general settings many apps are not accessible

    In general settings i cannot access to the social network settings. Neither face time, icloud and others. Thay are all greyed out. Why?

  • Unique Transfer/Merge problem

    Hi to all, I have an iMac which has all of my music automatically copied into itunes when dragged there, meaning my itunes folder contains all my itunes music. It is taking up a large portion of my HD and I have an additional 500MB external HD which

  • Pie chart issue with WAD

    Hi Experts, When I try to execute a query through Web Application Designer with a form of Pie chart, its not working properly. All I'm getting in web dash board is just a circle with blue color. Its similar to the first picture in the below image. ht

  • Add an SRID that Oracle does not have?

    Hi all, I am trying to import a 3D image file with SRID: 3401 however my Oracle Spatial db (11.1) does not have it. (ORA-13249: SRID 3401 does not exist in MDSYS.CS_SRS table). This is the SRID information: http://spatialreference.org/ref/epsg/3401/

  • My MacBook Pro has become sluggish since installing Mavarick.

    I installed the new Mavericks OSX on my MacBook Pro the day after it came out.  From that day, my computer has become sluggish, especially if I have muliple windows open and/or apps running.  I originally thought that perhaps I had a virus, so I ran