Column subsetting example

The Oracle documention says that column subsetting is possible with the replication. Does anyone have an example ?
-- Daniel

I'm just curious-- is there a reason that you're
using CREATE_SNAPSHOT_REPOBJECT rather than
CREATE_MVIEW_REPOBJECT? I realize that they do the
same thing, but the fact that you're referring to an
old procedure name makes me concerned that you may be
referring to some older documentation which may be
doing things in an older and more complicated
fashion.
If it's not a multimaster environment, why not just
create the materialized view on the remote system,
toss it in a refresh group if necessary, and call it
a day?
Can you post the exact SQL you used in your steps?
The error generally means that some of the
parameters you specified in one or more of the
earlier steps are in conflict, so we need to see
exactly what you're doing.
JustinJustin, I use CREATE_SNAPSHOT_OBJECT because it's the command generated by the deployment templates. However, rest assured that I use the lastest documentation. Here is a script that reproduces the problem :
SQL> -- CONFIGURE MASTER SITE
SQL>
SQL> CONNECT REPADMIN/REPADMIN@D012
Connected.
REPADMIN@D012>
REPADMIN@D012> CREATE TABLE DEMO (ID NUMBER, COLUMN1 VARCHAR2(30), COL_TO_DROP VARCHAR2(30),
2      CONSTRAINT PK_DEMO PRIMARY KEY (ID));
Table created.
REPADMIN@D012>
REPADMIN@D012> CREATE MATERIALIZED VIEW LOG ON DEMO;
Materialized view log created.
REPADMIN@D012>
REPADMIN@D012> BEGIN
2      DBMS_REPCAT.CREATE_MASTER_REPGROUP(gname => 'DEMO_REPGROUP');
3
4      DBMS_REPCAT.CREATE_MASTER_REPOBJECT (
5                gname => 'DEMO_REPGROUP',
6                type => 'TABLE',
7                oname => 'DEMO',
8                sname => 'REPADMIN',
9                use_existing_object => TRUE,
10                copy_rows => FALSE);
11
12      DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT(
13                sname => 'REPADMIN',
14                oname => 'DEMO',
15                type => 'TABLE',
16                min_communication => TRUE,
17                generate_80_compatible => FALSE);
18
19      DBMS_REPCAT.RESUME_MASTER_ACTIVITY(gname => 'DEMO_REPGROUP');
20 END;
21 /
PL/SQL procedure successfully completed.
REPADMIN@D012>
REPADMIN@D012> -- CONFIGURE MATERIALIZED VIEW SITE
REPADMIN@D012>
REPADMIN@D012> CONNECT REPADMIN/*****@XE
Connecté.
REPADMIN@XE>
REPADMIN@XE> CREATE DATABASE LINK D012.WORLD CONNECT TO REPADMIN IDENTIFIED BY REPADMIN USING 'D012.WORLD';
Database link created.
REPADMIN@XE>
REPADMIN@XE> CREATE MATERIALIZED VIEW DEMO_MV
2      REFRESH FAST WITH PRIMARY KEY FOR UPDATE AS
3      SELECT ID,COLUMN1 FROM [email protected];
Materialized view created.
REPADMIN@XE>
REPADMIN@XE> execute dbms_repcat.create_snapshot_repgroup(gname=>'DEMO_REPGROUP',gowner=>'"PUBLIC"',master=>'D012.WORLD',propagation_mode=>'SYNCHRONOUS');
PL/SQL procedure successfully completed.
REPADMIN@XE> execute dbms_repcat.create_snapshot_repobject(generate_80_compatible => FALSE,type=>'SNAPSHOT',sname=>'REPADMIN',oname=>'"DEMO_MV"',gname=>'DEMO_REPGROUP',gowner=>'"PUBLIC"');
BEGIN dbms_repcat.create_snapshot_repobject(generate_80_compatible => FALSE,type=>'SNAPSHOT',sname=>'REPADMIN',oname=>'"DEMO_MV"',gname=>'DEMO_REPGROUP',gowner=>'"PUBLIC"'); END;
ERROR at line 1:
ORA-23459: flavor must contain "DEMO_MV"."COL_A_DROPPER"
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 5920
ORA-06512: at "SYS.DBMS_REPCAT_SNA", line 82
ORA-06512: at "SYS.DBMS_REPCAT", line 1332
ORA-06512: at "SYS.DBMS_REPCAT", line 1307
ORA-06512: at line 1

Similar Messages

  • Questions on Column Fromatting example.

    Hi Tech Gurus,
    I am trying to implement "Column Formatting" example from Oracle XML Publisher - User Guide(PartNo: B13817-03) pdf. It is working fine and could able to get similar kind of output.
    When all the columns are displayed, the table in output occupies certain amount of size in the page. When I try to hide one column out of three, the width/size of the table is coming down. Size of the table in second output is not big as in the first output.
    My requirement is, table size should not vary accordning to the number of columns. The table size should be the same and two columns should share the total table length equally or as per the giving settings.
    How I can achieve this.
    Need urgent help on this.
    Regards,
    Chandra.

    925896 wrote:
    Hi
    Interviewer asked me this question.
    Why do we need an alias for column and is it improving query performance?
    I said
    if we select columns with same name from different table, alias is useful but no way related to query performance.
    is it correct? Please explain me on alias topicYou are correct, alias is not related to performance..

  • Flat File Import, Ignore Missing Columns?

    The text files I'm importing always contain a fixed set of columns for example total number of full set of columns is 60, or a subset of those columns (some csv contain 40 columns, some contain 30 or 20 or any other number.) .  I would like to import
    these csv based on the column header inside the each csv, if it is a subset of full column set then the missing columns can be ignored with null value.
    At the moment in SQL 2012, if I import a subset of columns in the csv file, the data doesn't import...I assume because the actual file doesn't include every column defined in the flat file source object? 
    Is it possible to accomplish this without dynamically selecting the columns,  or using script component?
    Thanks for help.
    Sea Cloud

    If the columns coming are dynamic, then you might have to first get it into staging table with a single column reading entire row contents onto that single column and parse out the column information using string parsing logic as below
    http://visakhm.blogspot.in/2010/02/parsing-delimited-string.html
    This will help you to understand what columns are present based on which you can do the insertion to your table.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Columns adjustment in one row

    Hello,
    I hope some1 can help me for these.
    I am using apex 3.1.2 ver
    My first question: how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?
    e.g
    aaaaaaaaaaaaaaa( ) bbbbbbbbbbbbbb ( ) ccccccccccccccccc ( ) ddddddddddd( )
    second question?
    how can i display second column value based on first column value before saving the page?
    e.g. aaaaaaa(1) bbbbbbbb(should display text value based on first column)
    for example 1 - abc
    2 - def
    3 - ghi and so on.
    last question? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?
    Many thx.
    kind regards,

    Irha10 wrote:
    how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?In item property change "Begin on new Line " to "Yes"
    Irha10 wrote:
    how can i display second column value based on first column value before saving the page?01. You have to create a branch to same page
    02. Submit the page using any event (such as button press or something). So when you enter details to first item and then press button then page will submit and reload the same page.
    03. In the page create a before region process and check whether second item is not null and third item is null then populate third item. Then first item is not null and second item null then populate second item.
    Irha10 wrote:
    ? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?You can use a java script and enable and dissable item based on any condition such as value of another item
    Example
    if ($x('P16_YYY').value !='SOME VALUE')
      $x('P16_XXX').disabled = true;
    }else
      $x('P16_XXX').disabled = false;
    }

  • How to find a specific word (from a list) in a sentence located in a different table, and build a column that contains the name

    Hi all, 
    I have 2 tables:
    1) Lookup table- "Names"- which contains ID# and product description (~100 names that can change).
    2) Data table- "Data"- which contains a column with sentences and within lies also the description. In addition, there is a quantity column.
    Example:
    Names table-
    ID
    Name
    1 Glass
    2 Paper
    3 Alum'
    4 Metal for construction
    100 Hydro therapy products
    And Data table-
    Description
    Qty
    Someone went to use the machine. 1.80 cm, Alum', for the rest of the day
    6
    Metal for construction is the major component in our system
    7
    <gs class="GINGER_SOFTWARE_mark" ginger_software_uiphraseguid="ba668f16-4de8-41d9-af39-d1b17422d6fe" id="ae5b76e8-6897-46c8-823b-86a382087f83">Kandoo</gs>, Delgado,
    Glass 17
    Greece needs more paper, 200 ft.
     45
    *there is no order where the lookup value can be found in the sentence*
    My purpose is to import the Data table while performing a calculation, that <gs class="GINGER_SOFTWARE_mark" ginger_software_uiphraseguid="1941bde7-1595-40eb-9d64-c2e3b9fabdef" id="b60549fc-5b92-46ea-abc6-72cc8c4c093b">checks</gs>
    for each row what is the suitable lookup value and then add it to a new column "Name". 
    Meaning, this table should be the new data after import:
    <gs class="GINGER_SOFTWARE_mark" ginger_software_uiphraseguid="f5d9da98-3ff6-4022-920d-8965a15730ee" id="580f945f-7822-4035-9b5b-542c74eff605">Description</gs>
    Qty                        
    Name
    Someone went to use the machine. 1.80 cm, Alum', for the rest of the day
    6 Alum'
    Metal for construction is the major component in our system
    7 Metal for construction
    <gs class="GINGER_SOFTWARE_mark" ginger_software_uiphraseguid="365dd7f8-7ffc-4ef3-95bf-9bf03421c90d" id="c9ba8515-3dba-4a6b-929e-650510f70844">Kandoo</gs>, Delgado, Glass
    17 Glass
    Greece needs more Paper, 200 ft.
     45 Paper
    Appreciate all support! 
    I lost hope and I want to avoid macros as much as possible.
    Thanks!
    עמית

    Hi Amit,
    I updated the file. The solution uses the following query formula:
    let
    Source = Excel.CurrentWorkbook(){[Name="DataTbl"]}[Content],
    #"Added Custom" = Table.AddColumn(Source, "Custom", each IndexTbl),
    #"Expand Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Scope"}, {"Scope"}),
    #"Filtered Rows" = Table.SelectRows(#"Expand Custom", each Text.Contains([Description], [Scope])),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Topic", "Component Code", "Project", "Date", "TotalQty", "TotalQtyActual", "ID", "SOW #", " SOW#(lf)Rev", "Scope Driver", "Scope Source", "Scope Source #", "Cost Code", "Type", "Bdg", "System Code", "IMF Number", "IMF Description", "WG", "C or NC", "C/e", "LLE", "Dwg Ref", "Comments ", "Description", "Size", "Qty", "Unit", "Materials Cost/Unit ", "Sub-Total per Unit €", "Unit Rate ", "Total", "DIV Code", "SYS Code", "HelperForDynfilter"}, {{"Scope", each Text.Combine([Scope], " | "), type text}})
    in
    #"Grouped Rows"
    It is based on two queries. The first is the import from table of "IndexTbl", the second is the import of "DataTbl' which is then extended according to the expression above.
    Hope this helps.
    Gil

  • Row total percentage of Column

    Have a request to display both the row and column totals in a pivot table, no problem. But what about also including a the percentage that each row total represents of the column total:
    Example:
    orders
    Item jan feb march total % of total
    a 1 3 5 9 40%
    b 2 2 3 7 33%
    c 3 1 2 6 27%
    total 6 6 10 22 100%
    Thanks.....

    In the pivot table view click on the measures and "Duplicate" the measures column and display the total as percentage of the row or column based on your requirement. That way you will be able to display both the toals and percentages together
    hope it helps
    Thanks
    Prash

  • Master-detail list - how to spread over multiple columns

    I am using the master-detail functionality to create a image viewer.
    I have a long list of master thumbnails, and rather than having them go down the page in one column, I would like to make them spread over 2 or 3 columns before the detail column. 
    (example of format I am trying to achieve - http://www.franbainbridgephotography.com.au/gallery.html (I dont mind whether master thumbnails are on right or left of detail photo))
    You can see my problem on http://www.wcwra.com/webpages/images.php
    Is this possible with the master-detail functionality?
    Thank you!

    The brilliant David Powers has fixed this for me on the main forum (vw2ureg was v close).  David's answer is :
    There is no way of making a single dataset repeat in multiple columns, because it's simply one element being repeated over and over.
    However, with a little out of the box thinking, you can do it quite easily with thumbnails. Instead of putting the master column repeat region in a block level element, use an inline element, <span>. Images are treated by browsers as inline elements, so this should work just fine. Change the following code from this:
    <div spry:region="dsPhotos" class="MasterContainer">
        <div class="MasterColumn" spry:repeat="dsPhotos" spry:setrow="dsPhotos"
        spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Caption}</div>
    </div>
    to this:
    <div spry:region="dsPhotos" class="MasterContainer">
        <span class="MasterColumn" spry:repeat="dsPhotos" spry:setrow="dsPhotos"
        spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Caption}</span>
    </div>
    In your CSS, set the width of the MasterColumn class to the width of your thumbnails, and the width of MasterContainer so that it's wide enough to accommodate two or more thumbnails. The thumbnails will flow into the column two or three abreast.

  • How to delete number (00) in a SQL Server column ?

    how to delete number (00) in a SQL Server column ?
    example :
    column :        Births       before                     Births 
        after                          
                       199900                            
            1999
                       198200                               
         1982
                       200400                               
        2004
    help query

    You use REPLACE function to selectively replace text inside a string in SQL Server. The REPLACE function is easy to use and very handy with an UPDATE statement.
    SELECT Replace(births, '00', '')
    or
    update .....
    Also you can use STUFF()
    This function can be used for delete a certain length of the string and insert a new string in the deleted place.
    Select STUFF ('199900', 5, 2, '')
    --result 1900,1982,....
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • Add a new column and the value

    I want to add a new column to a table with a single value for all rows of this column. for example, add a new column called 'sid' with the value of 'dbp'. can I use this statement?
    alter table ... add sid varchar(8) 'dbp';
    or I have to add first then update?

    SQL> alter table blah add (sid varchar2(8) default 'dbp');
    Table altered.
    SQL> select * from blah;
                    COL1 SID
                       1 dbp
                       2 dbp
                       3 dbpMessage was edited by: SomeoneElse
    (used OP's column name)

  • How to find columns in a table ?

    Hi
    I want a sql query to find a columns in specfic table
    all i hav in hand is the name of the table and a value which i know is in the columns but dont know which column
    for example i know there is table named student with 15 columns and a value of a column is 'ABC' but i dont have the name of the column
    how to find the table using SQL query
    Thanks in Advance
    Bala

    SELECT column_name,
      table_name
       FROM user_tab_cols
      WHERE table_name IN ('<yourtablenamehere>')
    AND extractvalue(dbms_xmlgen.getxmltype('select ''Found'' col from '|| table_name ||' where rownum=1 and ' || CASE WHEN data_type IN
          ( SELECT DISTINCT data_type FROM user_tab_cols WHERE data_type NOT LIKE 'TIME%' AND data_type != 'DATE' )
        THEN column_name ELSE 'to_char('||column_name||',''DD-MM-YYYY HH24:MI:ss'')'  END
      ||' = ''<yourcolumnvaluetobefound>'' '),'//COL')='Found';Fill <yourtablenamehere> and <yourcolumnvaluetobefound> in the above query and get the result.
    Ravi Kumar

  • Null Index Error When Sorting Standard Report Column

    I have a page in one of my application that contains three reports in three seperate regions within the page. You only see one report at a time, however, and control which one you see based on a sidebar table containing links that call javascript functions to toggle the hiding/showing of each region.
    The problem stems from trying to use the standard column sort on any of the columns. When I click the column header in any of the the reports, the page submits the request to sort the column (for example: request="fsp_sort_6", etc...), and then the page refreshes with all three reports displayed. The report for which you actually 'clicked' a column header will be sorted. However the other two will display with an error (code ORA-06502) saying that the report cannot parse the query because of a null key index value in one of the corresponding tables being queried.
    The weird thing is - this only happens on other computers - not when I'm on my workstation developing in my apex workspace/schema. I've even given each of the three reports a seperate static ID attribute so that I can identify each using those unique IDs.
    I have to say - I am stumped. Any help would be much appreciated. If you need more details, feel free to respond to this thread.
    Thanks!

    What version of APEX are you using? This was supposed to be fixed in 3.1 however it isn't because we still experience it sometimes, we just have never been able to re-create it in order to raise an SR. Getting to the bottom of this would be fantastic for us as it's the one thing which makes me extremely nervous of implementing new applications which are production-critical. The only workarounds are to flush the SGA or edit the report in production so the query is different (usually just fetch back null somewhere and then hide the column). This clearly isn't acceptable however without a reproducable test case there isn't much which can be done! :(

  • How to design crystal report multi column

    how to design crystal report multi column
    for example
    id              1001             id                 1002     
            id            1003
    name        dinesh          name            dk                 name       
    dkn
    address   kota             address       jaipur             address     delhi
    pin          3260356        pin              546332            pin       
    675942
    id              1004             id                 1005       
               id            1006
    name        dinesh1       name            dk1                     name       
    dkn
    address   kota1           address       jaipur1                 address     delhi
    pin          32606           pin                546345                pin       
    675942
    and so on....................

    DN
    I am afraid you have come to the wrong place.  MS does not support Crystal reports except for
    "Microsoft supports setup and installation for the Crystal Reports products shipped with the Professional and Enterprise Editions of Microsoft Visual Basic for Windows versions 3.0, 4.0, 5.0 and 6.0."
    For other support you need to contact
    For other Crystal Reports support, please do not contact Microsoft. Please contact Crystal Decisions (formerly Seagate Software), which now owns and supports Crystal Report Writer.
    http://support.microsoft.com/kb/100368
    Wanikiya and Dyami--Team Zigzag

  • Report Column Sorting problem

    I have a report based on a view. For some reason some of the columns are not being sorted correctly. After pressing the column header to sort date columns the underlying data is not sorted properly (it’s out of order) or it’s not sorted at all.
    Can you please let me know if there is a known bug causing that?

    I think I'm having the same problem.
    I have a report with data columns, several "not shown" columns, and several column links. I've noticed that any columns in the query after a certain point, will not sort the correct column. If I show all the columns and allow them all to sort, then some of the columns will sort the data in another column. (for example clicking on the header/sort link for column x sorts the table by column y and clicking on the sort link for column z sorts column x, etc).
    I've noticed that I can move columns around in my select query and no matter how they are arranged, after the 7th or 8th column in the select statement, none of the columns following that will sort properly. I've tried all kinds of things, changing my select query around, enabling and disabling sorting, adding additional null columns in, setting and unsetting the default sort order, changing the order of the columns in the report. I don't have an order by in my query or anything weird besides some where clauses (most of which are from the default search functionality).
    Has anyone found a solution to this problem? We just upgraded from HTML DB 2.2 to APEX 3.0 and the problem remained the same.
    Thanks,
    Greg

  • Check on spatial column

    I have a table Entity2 with two spatial attributes (ghost and geometry) and I want add a topological constraints between them. Why does the following sql string do an error?
    ALTER TABLE Entity2 ADD CHECK (SDO_GEOM.RELATE(ghost,'inside+coveredby',geometry,0.005));

    This is an area I have been looking into a lot recently and am putting the final touches together on a "white paper" on this topic to be hosted on my website.
    The Oracle documentation says:
    Conditions of check constraints cannot contain the following constructs:
    1 Subqueries and scalar subquery expressions
    2 Calls to the functions that are not deterministic (CURRENT_DATE, CURRENT_TIMESTAMP, DBTIMEZONE, LOCALTIMESTAMP, SESSIONTIMEZONE, SYSDATE, SYSTIMESTAMP, UID, USER, and USERENV)
    3 Calls to user-defined functions
    4 Dereferencing of REF columns (for example, using the DEREF function)
    5 Nested table columns or attributes
    6 The pseudocolumns CURRVAL, NEXTVAL, LEVEL, or ROWNUM
    7 Date constants that are not fully specified
    Now 1 is allowed in the SQL92 standard (ie CHECK constraints with SubQueries or via ASSERTIONS) but Oracle does not support them.
    2 is a problem because sdo_geom.relate is not deterministic as can be seen from:
    SELECT object_name,
           procedure_name,
          deterministic
      FROM all_procedures
    WHERE owner = 'MDSYS'
       AND object_name = 'SDO_GEOM'
       AND procedure_name = 'RELATE'3 means you can't create your own function around this whose return type would be deterministic. Even if SDO_GEOM.RELATE was deterministic you can't use it because it is still classed as a user-defined (MDSYS user) function (try it with one of the SDO_GEOM deterministic functions etc SDO_MBR() IS NOT NULL to see that this is the case).
    The others don't affect this discussion.
    The only way that I can see that you can do this is to create a trigger.
    create trigger entity2_bi before insert
    on entity2
    As
    begin
    IF sdo_geom.relate(:new.ghost,'inside+coveredby',:new.geometry,0.005) <. 'TRUE' THEN
    raise_application_error(020000,'GHOST is not inside or covered by GEOMETRY',true);
    END IF;
    End;
    Hope this helps
    regards
    S

  • Is there a way to find out how to get the index of a column?

    Hello,
    I want to know the index of a column for example the column at the first position in a jtable is 0 so how can i get this index?
    for example: the column called "surname" is index 0 but the user can move the column. So the name stays the same but the index of the column changed. I search for a method like
    table.getColumnIndex("surname");

    I think it really depends on what the OP is trying to do. I think the program
    below offers up the possible choices pretty well.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableColumnIndexDemo extends JFrame {
         private JTable table;
         private String[] names = new String[]{ "One", "Two", "Three", "Four", "Five" };
         public static void main( String args[] ) {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new TableColumnIndexDemo(); }
         public TableColumnIndexDemo() {
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              DefaultTableModel model = new DefaultTableModel( names, 1 );
              table = new JTable( model );
              JButton button = new JButton( "Print indices" );
              button.addActionListener( new ActionListener() {
                   public void actionPerformed( ActionEvent e ) {
                        printIndices();
              getContentPane().setLayout( new BorderLayout() );
              getContentPane().add( button, BorderLayout.NORTH );
              getContentPane().add( new JScrollPane( table ), BorderLayout.CENTER );
              getContentPane().add( new JLabel( "Move columns around then print indices" ), BorderLayout.SOUTH );
              setSize( 300, 150 );
              setVisible( true );
              printIndices();
         private void printIndices() {
              TableColumnModel columnModel = table.getColumnModel();
              TableModel model = table.getModel();
              StringBuffer sb = new StringBuffer();
              System.out.println( "Visible order");
              for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( k ).append( " " ).append( columnModel.getColumn( k ).getIdentifier() );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "By name using getColumnIndex(TableModel,name)" );
              for( int k = 0; k < names.length; k++) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( getColumnIndex( model, names[k] ) ).append( " " ).append( names[k] );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "By name using columnModel.getColumnIndex(name)" );
              for( int k = 0; k < names.length; k++) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( columnModel.getColumnIndex( names[k] ) ).append( " " ).append( names[k] );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "Model index by visible order");
              for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
                   if ( k > 0 ) sb.append( ", " );
                   TableColumn column = columnModel.getColumn( k );
                   sb.append( column.getModelIndex() ).append( " " ).append( column.getIdentifier() );
              System.out.println( sb );
         public static int getColumnIndex(TableModel model, String name) {
             for(int i = 0; i < model.getColumnCount(); i++) {
                 if( model.getColumnName(i).equalsIgnoreCase(name) ) {
                     return i;
             return -1;
    }

Maybe you are looking for