Is it possible to search only one column in a multi column data store?

Assume I create a context index using a multi column datastore for the columns first_name, middle_name, and last_name.
Then I can search all of the columns in the index using contains().
Is there any way to use contains() to just search one of the columns in a multi column datastore - just last_name for instance?
In some cases a want to search all of the columns, in other cases just one of the columns.

Yes, see the doc:
http://download.oracle.com/docs/cd/B14117_01/text.101/b10730/cdatadic.htm#i1006391
If you use the default behaviour, then your column data will be separated by XML-like tags.
<first_name>John</first_name><middle_name>Peter</middle_name><last_name>Doe</last_name>
You would then need to EITHER define each of these as sections, or use "auto_section_group". You can then search on them using
... contains (col, 'peter within middle_name') >0
See example:
SQL> drop table t;
Table dropped.
SQL> create table t (first varchar2(20), middle varchar2(20), last varchar2(20));
Table created.
SQL> insert into t values ('John', 'Peter', 'Doe');
1 row created.
SQL> insert into t values ('Peter', 'Frederik', 'Smith');
1 row created.
SQL> exec ctx_ddl.drop_preference('my_mcds')
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.create_preference('my_mcds', 'multi_column_datastore')
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.set_attribute('my_mcds', 'columns', 'first,middle,last')
PL/SQL procedure successfully completed.
SQL> create index ti on t (first) indextype is ctxsys.context
  2  parameters ('datastore my_mcds section group ctxsys.auto_section_group');
Index created.
SQL> select * from t where contains (first, 'peter')>0;
FIRST               MIDDLE            LAST
John               Peter            Doe
Peter               Frederik            Smith
SQL> select * from t where contains (first, 'peter within middle')>0;
FIRST               MIDDLE            LAST
John               Peter            Doe

Similar Messages

  • Only one column was record on Trigger

    Dear Experts,
    I've created SQL Trigger, it has five column, but only one column was recorded when Trigger's fired, another filled by NULL value
    please your valuable suggestion & helps
    thank you
    warmest regards

    Triggers are fired by INSERT  not matter how many rows it will generate and it is perfectly possible to have NULLs if columns allow it..
    If you want to prevent from entering NULLs, please examine inserted virtual table to filter out the data which contains NULLs.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Set filter for only one column in tableview

    Hi
    i am using in MVC a htmlb:tableview with filter in only one column of 8.
    This is all working fine, except that the user can enter a searchsting in the filterfield for all columns, but in handle_event (of the controller) ; i only react to a text in the filterfield of column 4 and ignore all other filtertext , which were maybe entered in the other columns.
    My question:
    how can i  enter the filter only for one column, in a way that the user cannot enter any text in the filterfield of the other columns, only in column 4 ?
    my view:
    <htmlb:tableView id             = "requirements"
                     table          = "//model/pdst_reqs"
                     filter         = "APPLICATION"                
                     keyColumn       = "EXTID"
                     iterator        = "<%=model%>"
                     footerVisible   = "FALSE"
                     encode          = "TRUE"
                     visibleRowCount = "<%=model->rowcount%>"
                     width           = "100%"/>
    Best Regards
    Britta

    You can disbale the Filter for the particular column by setting the DISABLE_FILTER in the Iterator method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS. Here is the sample code
    method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS .
      CLEAR p_column_definitions.
      CLEAR p_overwrites.
      data tv_column TYPE TABLEVIEWCONTROL.
      tv_column-COLUMNNAME          = 'FLDATE'.
      tv_column-SORT                = 'X'.
      tv_column-EDIT                = 'X'.
      tv_column-ONCELLCLICK         = 'MyCellClick1'.
      tv_column-title               = 'Date '.
      APPEND tv_column TO p_column_definitions.
      CLEAR tv_column.
      tv_column-COLUMNNAME          = 'PRICE'.
      tv_column-horizontalAlignment = 'right'.
      tv_column-verticalAlignment   = 'middle'.
      tv_column-ONCELLCLICK         = 'MyCellClick2'.
      tv_column-title               = 'Currency'. 
      tv_column-EDIT                = 'X'.
      tv_column-DISABLE_FILTER      = 'X'.    " <-------Like this
      APPEND tv_column TO p_column_definitions.
    endmethod.
    Hope this will solve your problem.
    Raja

  • Access for update only one column in table?

    Hi all,
    My need is to grant access for update only one column c1 in table t1.
    I guess I should use view, could you please give me some example? Maybe other ideas?

    Hi,
    You can grant privileges on individual columns.
    GRANT   UPDATE (c1)
    ON      t1
    TO      grantee_name;Look up GRANT in the SQL language manual. Annoyingly, in recent editions of the manual, GRANT is not indexed, but it's in alphabetic order with all the other statements:
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9013.htm#i2155015

  • EA2: Code is generated for only one column with Domain check constraint.

    I created a Domain with a Value List (Y or N - Yes or No) and used that domain for two columns in the same table. But for only one column (the last one) the check appears in the generated DDL.
    After I enabled the "Use Domain Constraints" both checks appear in the DDL, but one as an inline check constraint and one as an "Alter table add contraint.."
    Once I changed the naming Template for the check constraint, both constraints are generated as an Alter table clause. The inline check constraint is only generated when the name of the constraint (according to the template) is too long. It would be nice if I could choose if I want an inline or a separate check constraint definition.
    Edited by: Roel on Nov 23, 2010 11:55 AM
    Edited by: Roel on Nov 23, 2010 12:02 PM

    I logged ER for that
    Philip

  • Is it possible to Lock just one column value in a row?

    Is it possible to Lock just one column value in a row
    A Java Developer has just asked me if it is possible to Lock just one column value in a row in Oracle
    select ename from emp where empno=7369 for update;
    EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    7369 SMITH      CLERK           7902 17-DEC-80        800                    20
    will lock the entire row with empno=7369.
    But is it possible to lock one column value from this row, like SAL=800 ?
    Edited by: J.Kiechle on Jan 8, 2009 10:45 PM

    J.Kiechle wrote:
    Is it possible to Lock just one column value in a rowNo. Locking granularity is a row.

  • How to make only one column non reorderble

    I want to make only one column (Column 0) of my JTable non reorderble.
    I also want to make the same column non resizable and I want to give it a specific size.
    Please help me on this?

    I have implemented a RowHeaderTable class which displays 1, 2, 3, ... in the first column. The column is in the scrollpane's RowHeaderView, so it is not resizable nor reorderable. But its width can be set in your code. Maybe this is what you need.
    Use the class the same way you use a JTable, except 3 added methods:
    getScrollPane();
    setMinRows(int r);
    setRowHeaderWidth(int w);
    Note: The table works perfectly in skinless L&F, such as the default java L&F. It looks ugly in Liquid L&F because I don't know how to steal column header's UI to use on a JList. If someone can help me on this one, I thank you in advance.
    * RowHeaderTable.java
    * Created on 2005-3-21
    * Copyright (c) 2005 Jing Ding, All Rights Reserved.
    * Permission to use, copy, modify, and distribute this software
    * and its documentation for NON-COMMERCIAL purposes and without
    * fee is hereby granted provided that this copyright notice
    * appears in all copies.
    * JING DING MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
    * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
    * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. JING DING
    * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT
    * OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
    import java.awt.BorderLayout;
    import java.awt.Component;
    import javax.swing.AbstractListModel;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.ListCellRenderer;
    import javax.swing.UIManager;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableModel;
    * @author Jing Ding
    public class RowHeaderTable extends JTable {
      private int minRows = 10;                         // Minimum size of the row header.
      private static final int DEFAULT_WIDTH = 30;
      private JScrollPane jsp;
      // The row header is a JList with the same appearance as the column header.
      private JList rowHeader;
      // Repaint row header whenever the table inserts or deletes rows.
      private TableModelListener tmListener = new TableModelListener(){
        public void tableChanged(TableModelEvent e){
          if(e.getType() != TableModelEvent.UPDATE)
            rowHeader.repaint();
      /** Create a new instance of RowHeaderTable.
       * @param model
      public RowHeaderTable(TableModel model){
        setModel(model);
        initializeHeader();
        jsp = new JScrollPane(this);
        jsp.setRowHeaderView(rowHeader);
      private void initializeHeader(){
        rowHeader = new JList(new AbstractListModel(){
          public int getSize(){ return Math.max(getModel().getRowCount(), minRows); }
          public Object getElementAt(int index){ return "" + ++index; }
        setRowHeaderWidth(DEFAULT_WIDTH);
        rowHeader.setFixedCellHeight(getRowHeight());
        rowHeader.setCellRenderer(new TableRowHeaderRenderer());
      public void setRowHeaderWidth(int w){
        rowHeader.setFixedCellWidth(w);
      public void setMinRows(int m){ minRows = m; }
      public void setModel(TableModel model){
        super.setModel(model);
        model.addTableModelListener(tmListener);
      /**Use this method to get the scrollPane, instead of new JScrollPane(table).
       * @return
      public JScrollPane getScrollPane(){ return jsp; }
      protected class TableRowHeaderRenderer implements ListCellRenderer{
        TableCellRenderer colHeaderRenderer;
        public TableRowHeaderRenderer(){
          JTableHeader header = getTableHeader();
          TableColumn aColumn = header.getColumnModel().getColumn(0);
          colHeaderRenderer = aColumn.getHeaderRenderer();
          if(colHeaderRenderer == null)
            colHeaderRenderer = header.getDefaultRenderer();
        public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean hasFocus){
          return colHeaderRenderer.getTableCellRendererComponent(
              RowHeaderTable.this, value, isSelected, hasFocus, -1, -1);
      public static void main(String[] args){
        try {
          UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
        }catch (Exception e){ e.printStackTrace(); }
        String[] columnNames = {"First Name",
            "Last Name",
            "Sport",
            "# of Years",
            "Vegetarian"};
              Object[][] data = {
                   {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
                   {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
                   {"Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false)},
                   {"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)},
                   {"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)}
        DefaultTableModel dtm = new DefaultTableModel(data, columnNames);
        RowHeaderTable rht = new RowHeaderTable(dtm);
        rht.setMinRows(0);
        JFrame frame = new JFrame("RowHeaderTable Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(rht.getScrollPane(), BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
        dtm.addRow(new Object[]{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)});
        dtm.addRow(new Object[]{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)});
        dtm.addRow(new Object[]{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)});
    }

  • Copy only one column  of the workbook1  and paste it in another workbook 2

    Hello Rishi. Please help me with this how to copy only one column C of the workbook1  and paste it in another workbook 2 in Column D so that When user execute workbook1 . and then execute workbook2 . Column D is automatically populated in Workbook2 based on the data in Column C in workbook 1
    Please help
    Thanks
    Soniya

    Hi Soniya
    As I mentioned earlier, I haven't come across a situation of copying data from one workbook to another. However, for doing some dynamic modifications within the different sheets of the same workbook, you can refer to the following thread:
    Comparing two queries with VBA macro
    Thanks,
    Rishi

  • Would it be possible to export only one response, such as only the highlighted one?

    Would it be possible to export only one response, such as only the highlighted one?

    You can use the "Show details" option in the View Responses tab:
    Once you activated the detail view, you can export the detail view (that contains a single response):
    thanks
    Roman

  • Possible to encrypt only ONE email folder?

    I would really love some help with this; I've been banging my head against the wall trying to achieve something that is seemingly so simple and basic.
    We want to use an Email app that will allow us to encrypt only ONE email folder. Access to the rest of the email should be open to all users of the computer, just the one folder needs to be encrypted or password protected. Apparently this is not possible in Outlook, because in Outlook for Mac all of the folders are now integrated into one database and so cannot be encrypted individually as they can on PC.
    Does anyone have any suggestions of how to achieve this? I am considering using Mac's Mail, but can't find Mail file structure on my Lion machine to see if I can access the individual mailboxes separately. Does anyone know where to find Mail's folder structure? I looked in the Library but found nothing for Mail, as it used to be in previous OSs.
    Am open to third party software work arounds, other email clients, whatever. I would really appreciate any suggestions!

    Does anyone know where to find Mail's folder structure? I looked in the Library but found nothing for Mail, as it used to be in previous OSs.
    It's located in your user Library folder which is now normally hidden in Lion.
    In the Finder hold down the option key to reveal the Library folder and select Go>Library>Mail and you find the Mail files.
    Matt

  • When creating a "lookup" column be able to display not only one column from the other list, but additional columns

    With the lookup technique, it is possible to select an item from another list and display one column of this item
    It is obviously possible to create several lookup columns on the same list and therefore display several columns
    There’s a high risk of not selecting the same item and therefore have inconsistent columns
    The Requirement therefore consist of being able of displaying several columns of the same item from the other list, based on one unique selection
    Example:
    In list(x), define lookup column on list (y), column Title (possible today)
    Then define a “secondary” lookup column on same list, column Code
    The effect would be that when selecting an item from list (X), both Title and Code would show up consistently in 2 different columns of list (Y)
    All possible solutions are welcomed

    If you are using SharePoint 2010, you can retrieve additional columns when adding a Lookup. If you are using 2007, there is no direct OOTB way, but the following two posts provide potential work-arounds:
    https://www.definitivelogic.com/blog/microsoft-sharepoint-2007-pulling-column-data-one-list-another-based-common-list-field
    http://stefan-stanev-sharepoint-blog.blogspot.com/2010/11/sharepoint-2007-associated-lookup.html
    Dimitri Ayrapetov (MCSE: SharePoint)

  • How do I group by only one column in a SELECT statement?

    Hi everyone,
    Here is my novice question:
    I would like to run a query where I select (display) several columns from my table, yet group (categorize) by one of these columns.
    For example:
    SELECT A, B, COUNT(A)
    FROM TableX
    GROUP BY A
    I realize now that this is not valid. My first question is why? Doesn't it make sense that you would want to group by only one of the columns? To me, it seems natural that you would most often want to categorize by one attribute, which is why it seems odd that this is not valid. I realize that I can remove column B, but I do want to display that info. I could also change the last statement to GROUP BY A, B to avoid errors, but this will also not display what I am looking for.
    In addition to understanding why Oracle is set up this way, I guess I also need to know how I can legally accomplish this query, grouping by A but also displaying the values of B.
    Thank you very much for your help!
    Holly

    Hi everyone,
    Thank you for your responses... very interesting and useful. Since I came across inline views in my reading, I tried the approach recommended by g feng, although I am eager to try the other approaches too.
    I ended up using an inner join simply to get more descriptive info. on the column that was being counted. With Y representing this second table, Y.B being the column containing the descriptive info., and A being the common key between X and Y, here is the simple code I came up with.
    SELECT Y.B, V.*
    FROM Y,
    SELECT A AV, COUNT (*)
    FROM X
    GROUP BY A
    ) V
    WHERE V.AV = Y.A
    Does this seem correct... anything I need to watch out for?
    Thanks again to everyone for your help!!
    Holly

  • Select-String to search only first column in .CSV

    Hello all,
    I'm wondering if anyone knows a way to only search the first column of a .CSV file using Select-String. I guess I could probably import-csv and pipe the first column to select-string, but I was wondering if Select-string has this capability within itself?

    Yes, a "large file that I only need a few lines from" is more the issue. And I was also just curious if Select-String had such functionality. For the file I am reading, it has over 23,000 lines (13MB), and there is a significant
    performance increase with using select-string (over %4000 increase) :
    Using Import-CSV and Where-Object: around 5.938 seconds
    Using Select-String: around 0.138 seconds
    Thus, if I have several strings that I want to search the file for, I would prefer to use Select-String. I suppose I could just do the following?
    1. Use Select-string to search the file for each string I need to search for
    2. Once I'm done searching for all strings, I can query the resultant data set to be sure the string is in the first column of each record in the dataset
    3. If the string is not in the first column in the resultant data set, I can just remove the record.
    Am I way off base here?

  • Distinct for only one column

    Hi,
    I want select only distinct column of one column while at the same time displaying the other column attributed to the selected column.
    e.g. select name
    from student
    where name in
    (select distinct name from student)
    and processing_date >= '20070701'
    and processing_date < '20070702'
    this list all the similar rows and the distinct. Please assist. Thanks

    I'm sorry, but I am still a confused. Your current query, as written, is logically equivalent to...
    SELECT name, address
    FROM   student
    WHERE  processing_date >= '20070701'
    AND    processing_date <  '20070702';since selecting the DISTINCT names from the same table will match on every row.
    Are you looking for the DISTINCT names and addresses?
    SELECT DISTINCT name, address
    FROM   student
    WHERE  processing_date >= '20070701'
    AND    processing_date <  '20070702';Or are you looking for output like this?
    Bill Johnson   123 Main Street
                   456 West Lane
    John Doe       222 Hill Stree
                   888 East AvenueAgain, some sample output would be helpful.
    Greg

  • Only one column header in delimited report ?

    Hi!
    Is there a way to put only one line of column header on delimited report?
    (By default the Report builder puts the header in every record line...
    as well the delimited_hdr = no command prompt property is not good, because puts out no header)
    Thanks!
    (I use RB 6i)

    Hello,
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/cmdline/common/bld_delim_hdr.htm
    DELIMITED_HDR command line keyword
    DELIMITED_HDR is used to remove boilerplate text (such as the report header) when running a report with DESFORMAT=DELIMITED or DESFORMAT=DELIMITEDDATA.
    This parameter exists in Reports 6i too .
    Regards

Maybe you are looking for

  • Images not turning out as they look in PS

    Lately I have been having some issues with my processed images.  They look good in PS, and in Windows Image Viewer as well as on Facebook (which is odd because FB generally compresses them bad), but when loaded into a phone, tablet, or uploaded into

  • Error "Acrobat 8 Professional cannot be launched" | CS3

    Hi Everyone, I have a MacBook Pro with 10.7.5 and CS3. My Acrobat 8 Professional won't open and gives the error message "Acrobat 8 Professional cannot be launched at this time. You must launch at least one other suite component (such as Adobe Photosh

  • Creating user through ifsmanager

    Hi, I am creating user through ifsmanager.Only if I make them admin enabled they are able to log in to the ifs. If I dont give them admin privilege they are not able to login into the ifs. I just want to make an ordinary user with no admin privileges

  • 700p + Activesync + AirSAMStateMachine.c 1913 3

    Been trying for weeks. No luck. Have a 700p (Sprint), trying to sync wirelessly over the air with Microsoft Exchange Activesync Server 2003. Has never worked. Sprint and Palm advanced technical support unable to help ... Using Versamail and EAS updat

  • Wintv-hvr850

    IM having problems. I'm triing to stream video from my hard drive..I have wintv-hvr850. In encoder i see my devise in the drop menu on encoder but both screens are blank. i think it has something to do with defualt setting on tv tuner like you said t