How to fetch the records which matches a partial value?

Hi,
I have a table called Employee which contains the following value in Category column
ID Value
1 Student,Staff
2 Staff
3 Parent,Student
4 Member,Staff,Student
I wanted to fetch only 1 and 3rd and 4th record since it matches the value Student.
basically looking for the exact pattern matched with student separated by comma.
how to perform this query. it would be great, if i get the query in MS Sql also.
Edited by: Pannar on Nov 1, 2009 7:08 PM

Hi,
I'm sure the regexps will pass by, but here's a way (no idea if this will run in MS SQL, I'm not familiar with that):
HO%xe> with employee as ( --generating your sample data:
2  select 1 id, 'Student,Staff' category from dual union all
3  select 2, 'Staff' from dual union all
4  select 3, 'Parent,Student' from dual union all
5  select 4 ,'Member,Staff,Student' from dual
6  )
7  --
8  -- Actual query:
9  --
10  select id
11  ,      category
12  from   employee
13  where  category like '%Student%'
14  and    instr(category, ',')>0;
       ID CATEGORY
        1 Student,Staff
        3 Parent,Student
        4 Member,Staff,StudentYou can use UPPER or LOWER as well, if you want to be case-insensitive.
edit
Something like:
MHO%xe> with employee as ( --generating your sample data:
  2  select 1 id, 'Student,Staff' category from dual union all
  3  select 2, 'Staff' from dual union all
  4  select 3, 'Parent,Student' from dual union all
  5  select 4 ,'Member,Staff,Student' from dual union all
  6  select 5, 'Student' from dual union all
  7  select 6, 'Student,' from dual
  8  )
  9  --
10  -- Actual query:
11  --
12  select id
13  ,      category
14  from   employee
15  where  regexp_like(category,',Student|Student,');
        ID CATEGORY
         1 Student,Staff
         3 Parent,Student
         4 Member,Staff,Student
         6 Student,Might work as well.
Edited by: hoek on Nov 1, 2009 2:50 PM

Similar Messages

  • How to get the records which has a specified x/y coordinates

    Hi,
    How to get the records which has a specified x/y coordinates. I have a table which has street data. And another table has a point data. Now I just want to get the records from street data which includes the points in the point data table. Can any one give your suggestions
    Thanks and Regards
    Aravindan

    Aravinda,
    If you want to find the line segments which intersect the given
    set of points, you can do that with SDO_RELATE.
    siva

  • How to get the records which contains single quotation.

    Hi All,
    I am having one table which contains the name like D'ales,D'silva.
    I have have one filter in APEX as "Name".
    I need to filter it like D' % this . How can i do in apex, the replace command is working in SQL but not in Apex.
    My filter is like this.
    IF :P136_NAME IS NOT NULL THEN
    STR := STR||' AND UPPER( replace(name,'''','''''')) LIKE '''||UPPER(:P136_NAME)||''' ';
    END IF;
    very urgernt
    Thanks in Advance,

    Hi,
    You can use:
    STR := STR || ' AND instr(upper(NAME), upper(nvl(:P136_NAME, NAME))) > 0';Andy

  • Should not fetch  the records which has tran_efct_dte more than 550 days

    I have a table BRKG_TRA AND below is the structure of the table
    BRKG_ORDER_ID     VARCHAR2(15 BYTE)
    BRKG_ORDER_ID_CNTX_CDE     VARCHAR2(10 BYTE)
    BRKG_ACCT_SIDE_CDE     CHAR(1 BYTE)
    TRD_FTR     NUMBER(15,9)
    PGM_ORIG_TRAN_ID     VARCHAR2(6 BYTE)
    BRKG_OPT_OPEN_CLOS_CDE     VARCHAR2(5 BYTE)
    BRKG_ORDER_QTY     NUMBER(17,4)
    TRAN_ID     VARCHAR2(20 BYTE)
    TRAN_CNTX_CDE     VARCHAR2(10 BYTE)
    CRTE_PGM     VARCHAR2(50 BYTE)
    CRTE_TSTP     DATE
    UPDT_PGM     VARCHAR2(50 BYTE)
    UPDT_TSTP     DATE
    DATA_GRP_CDE     VARCHAR2(10 BYTE)
    TRAN_EFCT_DTE     DATE

    select * from <table name> where <dt_field> > sysdate - 550

  • How to edit the records value fetched by select statement query in sqldever

    How to edit the records value fetched by select statement query in sqldever 2.1.1.
    EX-
    SELECT * FROM emp WHERE ename like 'Jaga%'
    Edited by: user9372056 on Aug 31, 2010 2:16 AM

    Hi,
    Although some forum members may be using that tool, there is still a dedicated forum for SQL Developer.
    SQL Developer
    Maybe your chances are better there.
    Regards
    Peter

  • My iPhone 4s is recording video in 1920 x 1080 which is over the natural sensor resolution ' how to impost the recording resolution to 720

    How to impost the recording resolution of the video camera recording on iPhone 4s?
    The current resolution is to high (1920 x 1080) and does not corespond to the video sensor harware resolution which is 1080 x 720, my question is how to impost the iphone4s to record with the natural resolution or even lower (1080 x 720  or 720 x 400 ) which is more conviniant way of manipolating video files.
    Is there some feutcher like this in the new arriving iOS6 ?  Since the video camera into the i phone is replasing  a large sort of other video recoding devices, it is logicali to have the feutcher incorporated into the iOS. 
    With other words - Please give the user the possibility to choose the resolution to use for Photo and Video...!!!!!

    apple.com/feedback

  • How can we restrict the other user to change the record which has been entered by particular user in MDS

    I have created Product entity in MDS. It's having the following values:
    Name  Code  Owner
    Bike    1      ABC
    Car      2     XYZ
    Cycle   3     RRR
    owner XYZ can change the record of RRR. But if owner XYZ or any other owner in this entity tried to update the ABC's record, access should be denied. That means, no one should have the permission to change the records which are entered by ABC.
    For this i have executed this code
    CREATE TRIGGER mdm.party_trial_readonly ON mdm.tbl_1042_1278_EN AFTER UPDATE, DELETE AS
    IF EXISTS (SELECT * FROM deleted WHERE readonly = 1)
    BEGIN
       ROLLBACK TRANSACTION
       RAISERROR ('Attempt to change a read-only row', 16, 1)
       RETURN
    END;
    After executing this code i couldn't edit any of the records.
    Please help me out in this.

    I have created 2 entities called Party and Owner.  Party has following columns (name, Code, Owner (Domain Based Attribute)) Owner has following columns (name, Code) And I have Created one Derived Hierarchy.
    From user and Group Permision Section, Hierarchy Members tab I have given read only permision to me (administrator of the Model). When I gave the permision I have selected users and Inherited from group in permission tab. And I'm not the part of any group.
    Now I'm not able to see my model except the explorer area. And I'm not able to delete the permission from the user. As per the admin guide we need to delete permission from group.
    Though I'm not the part of any group, I'm not able to proceed further to delete the permission.
    Please help me out in this regard. Thanks!

  • How to fetch the data records in summary format based on previous day

    drop table T1;
    create table T1(Class, Fees_Collected, Submit_Date) as select
    'MBA', 100000, '7/30/2012' from dual union all select
    'Btech', 20000, '7/10/2012' from DUAL union all select
    'MBA', 45000, '8/1/2012' from dual union all select
    'Btech', 55550, '7/31/2012' from DUAL union all select
    'BBA', 250660, '7/30/2012' from dual union all select
    'MBBS', 44556000, '7/31/2012' from DUAL union all select
    'BDS', 420050, '8/1/2012' from DUAL union all select
    'BBA', 30450, '7/30/2012' from DUAL union all select
    'MBBS', 120450, '7/31/2012' from DUAL union all select
    'BDS', 45950, '7/30/2012' from DUAL union all select
    'MBA', 252450, '8/1/2012' from DUAL;My requirment is to fetch the records based on summary format to display the data with following columns -
    Class |Prev Day Traded Value |Prev Day % of Total |Prev Day % MBA
    Note - Previous Day definiton (Buisness Day) = calendar days - (weekends + US Holidays)
    Kindly help me, as i want to keep it customized so that without specifying the hard coded dates ( Previous Day) it runs through and provide me the resultset....
    All of your help and time is highly appericated.

    You mean business days I guess ?
    I use a function (I had to write it myself) <tt><b> next_business_day(p_start_date in date,p_days_count in number) return date </b></tt>
    where I loop forward/backward from p_start_date according to the sign of p_days_count the required number of steps skipping weekends and holidays as the absolute value of p_days_count is mostly under 30 for the rest (at least around here) Oracle's <tt><b> add_months </b></tt> gets it done.
    Regards
    Etbin
    Edited by: Etbin on 6.8.2012 17:55
    Year till date: <tt><b> your_date between trunc(sysdate,'year') and sysdate </b></tt> is it ? http://en.wikipedia.org/wiki/Year-to-date ?
    Edited by: Etbin on 6.8.2012 18:27
    NOT TESTED!
    function next_business_date(p_start_date in date,p_count_days in number) return date is
      steps  number := abs(p_count_days);
      retval date := p_start_date;
    begin
      if p_start_date is null or p_count_days is null then
        return to_date(null);
      end if;
      while steps > 0
      loop
    /* skipping weekends and (yet to be implemented) holidays */
        while to_char(retval,'dy') in ('sat','sun') /* or is_holiday(retval) */
        loop
          retval = retval + sign(p_count_days);
        end loop;
    /* retval contains a business day now */
        retval = retval + sign(p_count_days);
        step := step - 1;
      end_loop
      return retval;
    end;

  • How to do the Record Level commit in DB Adapter

    Hi,
    I am using Oracle JDeveloper 11.1.1.6.0 and SOA server 11.1.1.6
    Problem Description_
    I am fetching multiple records using File Adapter in BPEL process, After Fetching I am writing those records in Database using Database Adpter.
    If any error records comes the database adpater rollback the complete transaction and none of the records is inserted into the Database.
    **Can anyone please tell me how to do the record level commit in Database Adapter so that All the success records can be inserted into the database except the Failure record*.*
    I dont want to call the Database adpater in loop multiple times to insert each record as it hampers the performance.
    Thanks in Advance
    Sunil

    I believe you are polling a file and inside the BPEL, inserting the records into the database using the database adapter.
    so according to your requirement you can do any one of the following things...
    1. Instead of using the database adapter for inserting the record, you can call a Stored Procedure which it takes the record fields as input and it inserts the record into the table and does a commit at the end. when you follow this approach, make sure your data source is defined as Non-XA, otherwise you will face some errors.
    2. If you are using the database adapter insert operation only, inside the BPEL, for the partnerlink of the database adapter, go to the properties and for the property "idempotent", give a value of false.
    by doing this, what happens means, after calling the database adapter from BPEL through the invoke activity, the transaction is committed and from the next activity i mean after the invoke, a new transaction will be started but it will use the same thread though
    3. If you are using the database adapter insert operation only, inside the BPEL, for the partnerlink of the database adapter, go to the properties and for the property "NonBlockingInvoke", give a value of true.
    by doing this, what happens means, the database adapter insert operation will happen in a separate transaction and it will be committed, inside the BPEL after the invoke activity, a new thread and transaction will be started
    4. Also, if you are using the database adapter insert operation, don't follow the steps as mentioned in either 2 or 3, you can simply put a dehydrate activity after the invoke activity.
    According to your requirement, all the four approaches works. But my personal feeling, don't go for 4, instead 1 is better, 2 or 3 is also good.
    Hope this helps,
    N

  • How to get the records of the particluar day when delta laod failed (Urgent

    Hello  BW Gurus,
    We are  facing one serious issue. Here is the scenario.
    1st time the Delta was init and for next consective two  loads delta ran sucessfully... then next time delta got failed and the status is in red..... even though system started next delta loading and it has fetched the records and status is in green but not activated ,,,,,its happening  still past one month so almost there are 20 requests which are to be get activatetd.
    How to resolve this issue.
    <b>And how to get the records of the partilcular day when the delta got failed.
    </b>
    Anyone have come across with this strange issue then help me out and i will rewarrd the points.
    Urs,
    Raki.

    Hi
    Can you provide more details about your extractor and data targets.
    Are you loading delta to an ODS ??
    If you are loading to an ODS, The only solution i can see is to get the missing delta records via FULL UPDATE. Because if you delete the error request from ODS it will also delete the 20 successful requests above it.
    Cheers
    Praveen
    null

  • How to edit the records in error stock.

    Hi Experts,
                 i have error records in error stack and the remaining records are loaded successfuly . here my doubt is how to edit the records in error stack because its not giving the edit option .
    i want to get the edit option means i need to delete the request in target r wt ?
    and there are two more targets is there below this process .
    Advance Thanks.
    Regards
    SAP

    HI
    If you have less number records in this request(which you extracted now), delete that request from all the targets and reload again with option Valid records update, reporting not possible.
    this is the option which is recommended.
    follow the below 2 docs as well.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80dd67b9-caa0-2e10-bc95-c644cd119f46?QuickLink=index&overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/007f1167-3e64-2e10-a798-e1ea456ef21b?QuickLink=index&overridelayout=true
    Regards,
    Venkatesh
    Edited by: Venkateswarlu Nandimandalam on Jan 24, 2012 4:35 PM

  • How to delete  the record  of saved HRA Details...

    Hi Experts,
    I have put the details of HRA Correctly.But while updating HRA In 0008 Infotype i wrongly updated the wagetype,How should i change the Wagetype.
    When i m trying to delete it is showing  RECORD CAN NOT BE DELETED (TIME CONSTRAINT 1).
    How can delete the record.
    Thanking u .
    Sai

    Hi
         Hope doing well ........ No need to delete any infotype but u can go to PA30 and in change mode their u can delete the wagetype which is wrongly entered
    Rajeshk

  • How to fetch the payment details in to report

    Hi,
    I have the MIRo number, How to find the payment document number and check number so and so.
    What are the transactions like: F053,FB03.
    Let me know the process of payment after MIRO.
    What are the documents we need to raise, how to find those documents, what is the link.
    How to find the accounting document for payment and check details (from which tables).
    What are the table names and field names. What we can get from PAYR table.
    I want to create a report for MIRO with payment details.
    How to fetch the business area field value in to report.
    What is the table name. I verified it is storing in structure. Which is the right table for fetching that value with reference to MIRO.
    With regards
    Lakki
    With regards
    Lakki

    Hi,
    For Creating MIRO Document,
    We have to create PO Me21n,
    then Do GR - MIGO using PO Reference,
    then we have to do MIRO Using then same PO. so the link is basically the PO. Then the Payment for the MIRO document is done in F-53/F-58 refering the MIRO  document. the check number will be generated once we do the Check  Print in
    FBZ5.
    You can  assign the check number to the F-53 document either in Assignment Field or the Reference field Using FCHU.
    Once you do this you can view all the Vendor Bill using Doc Type RE, KR & Vendor Payments Doc Type KZ.
    You can use the Std Report FBL1N / FK110N
    Hope its useful. Assign points if found use ful
    Regards,
    R.Ramakrishnaraj

  • How to fetch the Reqd. Quan & Result Quan for a Z-report w.r.t. tcode CS15

    Hi Group,
    I have a requirement to develop a Z-report depending on the o/p of the tcode CS15.
    The result should be same as that of the CS15 with the a few additions:
    (1)Providing option to accept multiple Materilal Numbers
    (2)Filtering out the selection criteria on the fileds MRP Controller, Profit Center and etc.,
    my queries are:
    (1)In the Standard report, I was getting the fields Required Quantity and Result Quantity in the output. Whereas for me
        I was using a fm 'CS_WHERE_USED_MAT' to fetch the BOM items but whereas in the return parameter (STPOV) does not
       contain these fields(Result Quan and Reqd. Quan). 
    (2)I have to show the Material Type in the output. But when I fetch the records from the above FM, I was getting the Component
        details but not the Materials.  - the user wants the Material Type to be shown for each record.
    Kindly provide me inputs on the above queries.
    Regards,
    Vishnu.

    Hi,
    You can refer my wiki which i posted long back.
    link:[Inverse BOM Explosion|http://wiki.sdn.sap.com/wiki/display/Snippets/InverseBOMExplosion-ABAP] . Please note that the coding is not so good. If its today i could have wriiten it better
    In case of quantities you will not get it directly . filrtering the material type is really  easy comparing the result with MARA-MTART.

  • Fetch the records from cache

    say i have emp table
    eno ename sales
    1 david 1100
    2 lara 200
    3 james 1000
    1 david 1200
    2 lara 5400
    4 white 890
    3 james 7500
    1 david 1313
    eno can be duplicate
    when i give empno is 1
    i want to display his sales i.e 1100,1200,1313
    first time i will go to database and fetch the records
    but next time onwards i dont go to database; i will fetch the records from cache;
    i thought doing it using hashmap or hasptable ;both those two don't allow duplicate values(empno has duplicate values);
    How to solve this problem.

    Hi,
    Ever considered splitting that table up. You are thinking about caching thats a
    very good idea. But doesnt it make it vary evident that the table staructure that you have
    keeps a lot of redundant data. Specially it hardly makes a sense to have sales
    figures in a emp table. Instead you can have Emp table containing eno and
    ename with eno as the primary key and have another table called sales with eno
    and sales columns and in this case the eno references the Emp table.
    If you still want to continue with this structure then I think you can go ahead with
    the solution already suggested to you
    Aviroop

Maybe you are looking for

  • How can I disconnect my old iphone from my account?

    how can I disconnect my old iphone from my account?

  • Material cost estimate using recursive BOM

    Hello everybody. I want create material cost estimate (CK11N) using a recipe with recursive BOM. When I execute the transaction CK11N the following message is display Costing of cycle 00001 does not converge Do you know what is missing? Thanks in adv

  • Cfchart shows different output in 7.0.2 and 6.1

    We had a upgrade of CF MX server from 6.1 to 7.0.2 recently in an AIX platform. After the upgrade, CFCHART output is different than the one from the previous version. Please see the code below. BAR chart is shown as lines in new version that too with

  • Consolidation Unknown Error

    After consolidation, i check messages, find many errors. I don't know why. Error Code:{4BAFAE85-A9EF-403B-B91A-6F2DB4E67D5B} System Message Summary Config consolidation muliti dimension data set. An unknown error has occurred in the HsvDSData2 object

  • ECC No. in Outgoing Excise PLD

    hi all, I want to show ECC no. of Customer in Outgoing Excise Invoice PLD,on Report footer. from where to get that ECC No. I tried to get it from CRD7 table but when linking that field ,no data is displayed on that report. how to do this. Thanks, Nee