How to display the results in order by based on search value

Hi All,
how to display the results in the below order.
CREATE TABLE TEST( SONGID  NUMBER, TITLE   VARCHAR2(200))
INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)');
INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)');
INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK');
INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA');
INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)');
INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)');
INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA');     
INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI');
INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE');
SELECT *FROM  TEST WHERE INSTR (TITLE, 'MADONNA') > 0
output:
SONGID     TITLE
10     AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
11     CICCONE, MADONNA (CA)
12     DALLIN, MADONNA LOUISE/STOCK
13     MADONNA
14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
15     MADONNA (CA)
16     MIRWAIS AHMADZAI, MADONNA
17     MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
18     MADONNA (CA),CICCONE
Expected output :
13     MADONNA
14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
15     MADONNA (CA)
18     MADONNA (CA),CICCONE
...if user searches with 'MADONNA' , I have to display the results like title starts with 'MADONNA' first then rest of the records.
Please let me know is it possible to display the results in that order.
Regards,
Rajasekhar

This may be a bit more accurate:
SQL> SELECT *
  2  FROM   TEST
  3  WHERE  INSTR (TITLE, 'MADONNA') > 0
  4  ORDER  BY INSTR (TITLE, 'MADONNA')
  5           ,TITLE
  6  ;
              SONGID TITLE
                  13 MADONNA
                  14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
                  15 MADONNA (CA)
                  18 MADONNA (CA),CICCONE
                  12 DALLIN, MADONNA LOUISE/STOCK
                  11 CICCONE, MADONNA (CA)
                  17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
                  16 MIRWAIS AHMADZAI, MADONNA
                  10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)

Similar Messages

  • How to display the result of  excutions(insert/update/delete rows)

    Hello.
    Does anyone know how to display the result of scenario executions just like a scenario executions tab of package (insert/update/delete rows) in other screen (in the intergated operating platform for operators using http)
    In additional, I also like to show the hierarchy of scenario in the same view.
    So, I need the query using the information of the ODI repository.
    If it is possible, I also like to have the decription of the tables in the ODI repository.
    Can anyone tell me how can I get the information of the counts of excution?
    Thanks in advance.

    Hi,
    You can get that information from the API getPrevStepLog. Does it work for you?
    Download the last API reference manual from:
    http://www.oracle.com/technology/products/oracle-data-integrator/10.1.3/htdocs/1013_support.html#docs

  • How to display the results of the grouping horizontally

    Hello,
    I still cannot understand what am I doing wrong when trying to display the results of the grouping horizontally. Here is the original thread: How to group report vertically
    In the Section expert, for Detail section, I check the box Format with Multiple columns. Under the Layout tab, I check Format groups with multiple columns and set the width of the column at 3.3 in. This should give me 3 columns for Landscape orientation.
    Now if I select Printing direction Down then Across, I just have the regular vertical grouping.
    If I check Across then Down, then I do get 3 columns, but all the records in the Detail section are also spread across first instead of staying in the column.
    There should be something else that I should do to get the display like this:
    Header1    Header2    Header3
    record11   record21   record31
    record12   record22   record32
    record13   record23   record33
    etc.            etc.            etc.
    Thank you.

    I'm not at all sure columns are gonna help here, as there is no way that I am aware of to tell Crystal to start a new column.
    The only way that I can think of to achieve what you are trying to accomplish is to do something like this:
    In your group header's Suppress formula, keep track of the first (/ next) three groups that you want to print, using something like (basic syntax):
    global grouplist(3) as string
    global groupcount as number
    groupcount = groupcount + 1
    grouplist(groupcount) = {db.GroupingField}
    ' The NextIsNull below implies End-of-Data...
    if groupcount = 3 or NextIsNull({db.GroupField}) then
      formula = false  ' print the group header
    else
      formula = true  ' suppress the group header
    end if
    Then, create three formula fields to get each value in grouplist().  The group header format will then show the three formula fields.  Underneath these three formula fields, add subreports, which will show the details for one specific group.  The subreports should have a parameter for which group's details to show.  Use the three formula fields as the link to the three subreports.
    In the group footer, clear out the grouplist() array, and set groupcount to zero.
    This report will take a while to run, because having three subreports next to each other makes it difficult for Crystal to determine page formatting.
    HTH,
    Carl

  • How to display the result of  Intermedia  text in html

    After defining the following statments:
    begin
    ctx_ddl.create_preference('COMMON_DIR','FILE_DATASTORE');
    ctx_ddl.set_attribute('COMMON_DIR','PATH','c:\temp');
    ctx_ddl.create_section_group('XML_GROUP','xml_section_group');
    ctx_ddl.add_zone_section('XML_GROUP', 'Order', 'Order');
    ctx_ddl.add_zone_section('XML_GROUP', 'currencyType', 'currencyType');
    create index myindex on xmltable(xml_text)
    indextype is ctxsys.context
    parameters ('datastore COMMON_DIR section group XML_GROUP');
    end;
    then I run the following SQL statement:
    select id,xmltext from xmltable
    where contains(xmltext,'156 within currencyType')>0;
    by the way the table xmltable is defined as :
    create table xmltable(id number primary key,xmltext CLOB);
    Now I want to display the querying result in html ,what should I do???

    If the query returns all of the information you require and it is (as the data model would suggest) in XML format, the obvious choice is to use an XSLT Style Sheet to render the XML data to a HTML document.
    There is plenty of information on XML and XSLT in the standard Oracle documentation but be warned, whilst XSLT is a reasonably well defined standard, it is a little complex and can take time to get used to. You will find a lot of books available on the subject.
    Dean

  • TESTING A PROCEDURE, How to display the result????

    my procedure is correct, my test statement processed but I want it to display the desc like 'Cancelled';, or no status available How?????
    ---below is my procedure--
    CREATE OR REPLACE PROCEDURE status_sp
    (p_basket IN bb_basket.idbasket%TYPE,
    p_date OUT DATE,
    p_desc OUT VARCHAR2)
    IS
    CURSOR cur_status IS
    SELECT idstage, dtstage
    FROM bb_basketstatus
    WHERE idbasket = p_basket
    ORDER BY dtstage DESC;
    lv_stage_num bb_basketstatus.idstage%TYPE;
    BEGIN
    OPEN cur_status;
    FETCH cur_status INTO lv_stage_num, p_date;
    IF lv_stage_num = 1 THEN
    p_desc := 'Submitted and received';
    ELSIF lv_stage_num = 2 THEN
    p_desc := 'confirmed, processed, sent to shipping';
    ELSIF lv_stage_num = 3 THEN
    p_desc := 'Shipped';
    ELSIF lv_stage_num = 4 THEN
    p_desc := 'Cancelled';
    ELSIF lv_stage_num = 5 THEN
    p_desc := 'Backordered';
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT_LINE('No Status Available');
    end;
    DECLARE
    lv_state DATE;
    lv_dt VARCHAR2(20);
    lv_txt VARCHAR2(20);
    BEGIN
    status_sp(5,lv_state,lv_dt);
    dbms_output.put_line(lv_txt);
    end;
    Statement processed.
    0.07 seconds

    dbms_output.put_line(lv_txt);And where and when did you put a value into lv_txt?
    Maybe you want
    dbms_output.put_line(to_char(lv_dt, 'dd.mm.rrrr hh24:mi:ss'));
    dbms_output.put_line(lv_state);
    ...and don't forget to turn on serveroutput:
    set serverout on

  • How to display the result in red

    **Report Builder 10.1.2.0.2**
    **ORACLE Server Release 10.1.0.4.2**
    **Oracle Procedure Builder 10.1.2.0.2**
    **Oracle ORACLE PL/SQL V10.1.0.4.2 - Production**
    **Oracle CORE     10.1.0.4.0     Production**
    **Oracle Tools Integration Services 10.1.2.0.2**
    select a.sr_no,to_char(a.sr_date,'DD.MM.YYYY') sr_date,a.sr_time,d.priority,d.location,c.so_no,to_char(c.so_date,'DD.MM.YYYY') so_date,c.so_time,
    regexp_replace(NUMTODSINTERVAL ( ABS ( ( TRUNC (c.so_date)+ TO_DSINTERVAL ('0 ' || c.so_time))- ( TRUNC (a.sr_date)+ TO_DSINTERVAL ('0 ' || a.sr_time)))
         , 'DAY'), '([+|-])0+(\d+)', '\1\2 days ') diff
    from sr_request1 a,so_trade b,so_order c ,service_requests d
    where a.id=b.SR_REQUEST1_ID
    and b.id=c.SO_TRADE_ID
    and a.sr_no=d.SR_NO
    and a.SR_DATE >= to_date(:date_from,'dd.mm.yyyy')
    and a.sr_date <= to_date(:date_to,'dd.mm.yyyy')
    SR NO SR DATE SR TIME LOCATION PRIORITY SO NO SO DATE SO TIME DIFF
    SR058339 28.01.2010 09:14:18 UPTOWN 5 2 SO058894 28.01.2010 09:15:25 +0 days 00:01:07.000000000
    hi iam having a report with the above query and when i generate i get the above result
    now what i have to do is i need to check the above result diff value(+0 days 00:01:07.000000000 ) with the priority_hdr table, the structure looks like this
    PRIORITY_TYPE PRIORITY_NUMBER LOG_LOCATION1
    Service Request 3 30
    Service Request 2 20
    if priority is 2 and diff (+0 days 00:01:07.000000000 ) is greater than 20 mins (LOG_LOCATION1 )than that row should display in red
    if priority is 3 and diff (+0 days 00:01:07.000000000 ) is greater than 30 mins (LOG_LOCATION1 )than that row should display in red
    like that it has to work out. how to do this process,where i need to place formula column for this. pls guide me

    function F_round_ABS_TO_DATE_c_so_time_ return boolean is
    begin
         if <priority is 2 and diff (+0 days 00:01:07.000000000 ) is greater than 20 mins (LOG_LOCATION1)>
    then
    srw.set_foreground_fill_color('red');
    srw.set_fill_pattern('solid');
    end if;
    return (TRUE);
    end;
    when i try this i am getting this error
    Error 103 at line 3, column 5
    Encountered the symbol "<" when expecting one of the following
    [ + - case mod new not null <an identifier>
    < a double quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute for all merge time timestamp interval date
    < a string literal with character set specification>
    <a number><a-single quoted sql string> pipe
    < an alternatively quoted string literal with character set specification>
    <an alternatively quoted sql string>
    function F_round_ABS_TO_DATE_c_so_time_ return boolean is
    begin
    if :priority = 2
         then
    srw.set_foreground_fill_color('red');
    srw.set_fill_pattern('solid');
    end if;
    return (TRUE);
    end;
    when i tried this it's woking out fine for :priority = 2 but i need to check the condition for diff whether it is greater than 20 mins how to write the code for it
    Edited by: user9093689 on Feb 11, 2010 6:06 PM

  • Display the result of a query in descending order.

    Hello Experts,
    How can I display the result of a query in descending order?
    Thanks much in anticipation.
    Regards.

    Hi Kumar,
    If you want to display char in descending order, in the query designer set the sorting setting as desceing for that particular characteristics, or if you want to see the KF in descending order, create a condition on that KF and set as TOP N and set N as 999999, that would display your KF in descending order.
    - Danny.

  • How to display the search result without reloading the whole page

    HI,
    I have separate fragments for Search Box to enter keyword and Search Result to display the result. Also I have different sections within the page to put these fragments. So how could I display the results without reloading the whole page.
    Also if I have next button in my search result area, how could I display the search results in next page without reloading all other sections present in our page. Please let me know if any service or idoc function present such that result could be shown in search result section without reloading whole page.
    Please let me know how to restrict page reload for every action within a page.
    Thanks,
    Ramesh
    Edited by: Ramesh_Est on May 27, 2010 3:14 AM
    Edited by: Ramesh_Est on May 27, 2010 8:39 PM

    This is default behaviour of the template of your space. You can create a new page template and than you can create a region for the search results.
    Or you can create a custom taskflow were you use the webcenter taskflows to search for the space.
    Take a look at this white paper:
    Extending webcenter spaces: http://www.oracle.com/technology/products/webcenter/pdf/owcs_r11_extend_spaces_wp.pdf
    and this one:
    Customizing site templates: http://www.oracle.com/technology/products/webcenter/pdf/owcs_ps1_site_template_wp.pdf
    Edited by: Yannick.O on 13-Apr-2010 02:32

  • How to display the details of particular order when click on button in sapui5

    Hi Experts,
        How to display the details of particular order when click on button in sapui5?
    I Have a requirement that is i want display all the list of orders coming from backend as shown in image below
    then in that i have a button when i press the button  it need to display the details of particular order as shown in image below
    Please help me .
    Thanks & Regards
    chitti

    Does anyone know how to display the index of current desktop?
    Brute force - - I have written the number of the Desktop directly onto the wallpaper picture I am using for each Desktop  (easy to do with Preview).
    All Desktops are using different wallpaper photos, so they are easily recognized by the color scheme, and in the upper left corner is the number.
    Regards
    Léonie

  • DbGetQuery = How to get the results to display?

    I am using the following
    sqldata <- dbGetQuery(con," select sysdate from dual")
    How do I get the result to display?
    summary(sqldata) displays the values
    if I do dbSendQuery then fetch show the results
    help(dbSendQuery) and help(dbGetQuery) go to the same page! dbSendQuery
    The documentation says dbGetQuery will connect, get the records and clear; maybe the clear happens before the display?!

    Hello Amin,
    Here is the way to display the result from the query you provided:
    Assign the result of the query to object 'sqldata':
    R> sqldata <- dbGetQuery(con," select sysdate from dual")
    Type the object name at the R prompt:
    R> sqldata
                  SYSDATE
    1 2014-04-28 14:45:14
    Sherry

  • How to Read the one Source Column data and Display the Results

    Hi All,
         I have one PR_ProjectType Column in my Mastertable,Based on that Column we need to reed the column data and Display the Results
    Ex:
    Pr_ProjectType
    AD,AM
    AD
    AM
    AD,AM,TS,CS.OT,TS
    AD,AM          
    like that data will come now we need 1. Ad,AM then same we need 2. AD also same we need 3. AM also we need
    4.AD,AM,TS,CS.OT,TS in this string we need AD,AM  only.
    this logic we need we have thousand of data in the table.Please help this is urgent issue
    vasu

    Hi Vasu,
    Based on your description, you want to eliminate the substrings (eliminated by comma) that are not AD or AM in each value of the column. Personally, I don’t think this can be done by just using an expression in the Derived Column. To achieve your goal, here
    are two approaches for your reference:
    Method 1: On the query level. Replace the target substrings with different integer characters, and create a function to eliminate non-numeric characters, then replace the integer characters with the corresponding substrings. The statements
    for the custom function is as follows:
    CREATE FUNCTION dbo.udf_GetNumeric
    (@strAlphaNumeric VARCHAR(256))
    RETURNS VARCHAR(256)
    AS
    BEGIN
    DECLARE @intAlpha INT
    SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric)
    BEGIN
    WHILE @intAlpha > 0
    BEGIN
    SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, '' )
    SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric )
    END
    END
    RETURN ISNULL(@strAlphaNumeric,0)
    END
    GO
    The SQL commands used in the OLE DB Source is like:
    SELECT
    ID, REPLACE(REPLACE(REPLACE(REPLACE(dbo.udf_GetNumeric(REPLACE(REPLACE(REPLACE(REPLACE([ProjectType],'AD,',1),'AM,',2),'AD',3),'AM',4)),4,'AM'),3,'AD'),2,'AM,'),1,'AD,')
    FROM MyTable
    Method 2: Using a Script Component. Add a Derived Column Transform to replace the target substrings as method 1, use Regex in script to remove all non-numeric characters from the string, add another Derived Column to replace the integer
    characters to the corresponding substring. The script is as follows:
    using System.Text.RegularExpressions;
    Row.OutProjectType= Regex.Replace(Row.ProjectType, "[^.0-9]", "");
    References:
    http://blog.sqlauthority.com/2008/10/14/sql-server-get-numeric-value-from-alpha-numeric-string-udf-for-get-numeric-numbers-only/ 
    http://labs.kaliko.com/2009/09/c-remove-all-non-numeric-characters.html 
    Regards,
    Mike Yin
    TechNet Community Support

  • How to access oracle in javabeans and display the result in jsp

    In my project ,i use the javabean to access the database and do the calculations and i display the result in the jsp page,,,
    any body can help me with your precious codes
    kodi...

    any body can help me with your precious codesStepped in the wrong place, try reading something on JDBC.

  • Custom Search portlet : how to sort the result in sequence (Portal 10.1.4)

    With a Custom Search portlet how to Sort the Result By Sequence. i.e. by respecting arrangements of the items in the page of contents?
    Actually the Results Options "Order By" are : Create Date, Author, Creator, Date Updated, Display Name, Last Update by, Publish Date, Score.
    Is there an action to add the "Sequence" Order By result Option?
    Great thanks for your kind help.
    Best regards

    No, I agree that it is functionality that should be added to the product, but it
    is not a bug because it was not written to do this.
    It is a short coming of the product.
    Cheers,
    Ersan

  • Custom Search Portlet : How to Sort the Result By Sequence (Portal 10.1.4)

    Customer request: With a Custom Search portlet how to Sort the Result By Sequence. i.e. by respecting arrangements of the items in the page of contents?
    (Like it's possible in MyOracle)
    Actually the Results Options "Order By" are : Create Date, Author, Creator, Date Updated, Display Name, Last Update by, Publish Date, Score.
    Is there an action to add the "Sequence" Order By result Option?
    Great thanks for your kind help.
    Best regards

    No, I agree that it is functionality that should be added to the product, but it
    is not a bug because it was not written to do this.
    It is a short coming of the product.
    Cheers,
    Ersan

  • How to display the data according to the search criteria

    Hi ,
    I want to display the order data in my application.
    I have certain search criteria in my application like
    ordernumber , date etc.
    If I click the submit button without giving any criteria , all the data is getting displayed properly in the table.
    But,If I want to display the data according to the order number, all the orders present are getting displayed , but actually it should display the order only for that particular order number.
    The code is  like : onActionSearch()
    wdThis.wdComponentController().executeGetlist_Input();
    Can any one tell me how to display the orders depending upon the search criteria.
    Ideas & suggestions are truely welcome.
    Thanks & Regards
    Neha Mahanty

    Hi Neha,
    Design ur RFC in such a way that it should display the result according to your search criteria.
    If you are making a search on "Order Number" pass some input(search criteria along with some parameter, if order number is not null then pass "X" as parameter) to RFC so that it will return the result accordingly. And same with date also.
    Thanks n Regards,
    Jhansi Miryala

Maybe you are looking for

  • Grub2 with two screens only shows up on one

    I have recently installed Arch, and kudos, everything works almost perfect out of the box so to say. I had few hickups with some hardware, but everything resolved just fine in less than few hours thanks to magic of Google and Arch Wiki. As you probab

  • Importing music into iTunes is taking up a lot of space on both my hard drive and iPod.

    Is there a way to make the files smaller?

  • Trying to build the best system for Final Cut

    IWhat screen would be best suitable to work on Final Cut Pro? 1 screen or 2? 24 or 30 inch? I'm using MacPro (SAS DRIVES).Primarily I am a musician, and my end product is for music and video clip, mostly 3d and abstract art in motion. I'd be collabor

  • SAP Uninstalltion Process

    Dear Sir, I am Student and Learnind SAP Basis. I want to know how to uninstall the SAP from system?

  • IPhoto 8 do IPTC?

    I am curious if iPhoto 8 supports IPTC (http://en.wikipedia.org/wiki/IPTC) metadata. All the fields are there in iPhoto as it stands now. It would be incredibly useful for those doing some editing in PS to have that built in. Less capable programs an