Is it possible to create a column in  runtime?

Hi,
I created a application that connect with Access database. I just wonder is it possible for user to create a column in runtime, because the application need this kind of interaction.
Many thanks,
Ann

Here's code to do that
     static void addColumn(Connection dbConn, String cname)
          Statement ins;
          String sql = "ALTER TABLE TestTable ADD "+cname+" CHAR(20)";
          try
               ins = dbConn.createStatement();
               ins.executeUpdate(sql);
               ins.close();
          catch (SQLException se){fail(se);}
     }The rest of my TestODBC example can be found at
http://forum.java.sun.com/thread.jsp?forum=31&thread=453376

Similar Messages

  • Is it possible to create a Column with Conditional Mandatory with another Column?

    Is it possible to create a Column with Conditional Mandatory with another Column?
    For example
    In a Table we have column A, B, C.
    A is Primary Column.
    B is Optional
    C is Conditional Mandatory.
    A B
    C
    12345 ABC
    OK
    12346 NULL
    NULL
    12347 ABC
    OK
    Only if the B Column has the value then only C column should be mandatory

    I guess you can't create a condtional mandatory column directly. However, you can use check constraint to on the column
    create table YourTable
      A int primary key,
      B char(3),
      C int,
      constraint ch_con check(
                                B
    is not null
    or C is null

  • Is it possible to create a column in the runtime?

    Hi,
    I created a application that connect with Access database. I just wonder is it possible for user to create a column in runtime, because the application need this kind of interaction.
    Many thanks,
    Ann

    Cross-post:
    http://forum.java.sun.com/thread.jsp?
    forum=31&thread=453860&start=0&range=15#2066833

  • Will possible to create lov,recordgroup on runtime?

    Hi all,
    Is it possible to create lov,recordgroup on runtime. If so, please explain step.
    Kanihs

    Documentation:
    Record Group Type Property
    Description
    +Specifies the type of record group, either Static or Query: Static Specifies that the record group is constructed of explicitly defined column names and column values.
    The values of a static record group are specified at design time and cannot be changed at runtime.
    Query Specifies that the record group is associated with a SELECT statement, and thus can be populated dynamically at runtime.
    When you select this option, enter the SELECT statement in the multi-line field provided, then choose Apply.+
    Francois

  • Is it possible to create a column in run time?

    Hi,
    I created a application that connect with Access database. I just wonder is it possible for user to create a column in run time, because the application need this kind of interaction.
    Many thanks,
    Ann

    Code that does it is here:
    http://forum.java.sun.com/thread.jsp?forum=48&thread=453846&tstart=0&trange=15
    MOD

  • Is it possible to create editable columns in report output?

    Hi guys,
    I want to create a column in report output displayed using Write statement as editable such that User can change the value at the output after display.
    Let me know the possible solutions.
    Thanks,
    GURU

    hi,
    use this statment
    WRITE: num1 INPUT
    After entering or changing the value
    MODIFY LINE 1 FIELD VALUE num1 FROM num1
    this Line 1 may differ according to ur prigram
    Reward points if helpful
    Regards,
    priya

  • How to create adf columns at runtime

    Hello
    I want to crete a component which will display results of arbitrary sql command.
    for that purpose I created 'declared component' with custom component class which obtains SQL query from passed attibute and executes it.
    so in my component I have
    public List<String> getColumnNames() {
    if (!loaded) {
    loadData();
    return columnNames;
    public List<List<Object>> getData() {
    if (!loaded) {
    loadData();
    return data;
    and in compDef.jspx following:
    <af:table value="#{component.data}" var="row">
    <af:column headerText="No">
    <af:outputText value="#{row}" />
    </af:column>
    <af:forEach items="#{component.columnNames}" var="col" varStatus="colStatus">
    <af:column headerText="#{col}">
    <af:outputText value="#{row[colStatus.index]}" />
    </af:column>
    </af:forEach>
    </af:table>
    query execution is ok and component.columnNames contains several columns (checked this with af:iterator)
    but it shows only 1 column (with header 'No').
    If I use
    <af:iterator value="#{component.columnNames}" var="col" varStatus="colStatus">
    <af:column headerText="#{col}">
    <af:outputText value="#{row[colStatus.index]}" />
    </af:column>
    </af:iterator>
    it shows 4 columns instead of 2 (and doesn't show any text - that is headerText is empy and all cells are empy too)
    So, can anybody tell me how is it ment to be ? Or where is the mistake ?
    Version: 11g TP 4.

    Thank you for your reply.
    Well, if I set headers to
    xx #{col} xx idx: #{colStatus.index} :idx
    it shows only static text and no EL values.
    (So in output I have 4 headers with text "xx xx idx: :idx")
    Actually if I use suck mix of af:table and af:forEach in usual jspx file (not in component's one) - it works as expected
    that is
    code
    <af:table value="#{Query1.data}" var="row">
    <af:column headerText="xxxxx">
    <af:outputText value="#{row}" />
    </af:column>
    <af:forEach items="#{Query1.columnNames}" var="col" varStatus="colStatus">
    <af:column headerText="#{col}">
    <af:outputText value="#{row [ colStatus.index ] }" />
    </af:column>
    </af:forEach>
    </af:table>
    where Query1 JSF bean performs the same functionality (executes arbitrary SQL query and stores results in data and columnNames)
    works OK.
    (colStatus.index is written in brackets - don't know how to disable its transformation to link, how to write preformatted code here ?)
    Another point that behaviour in component's jspx is a bug - the amount of columns.
    It produces 4 columns instead of 2. And I can't figure why because it doesn't show any information neither in var 'col' nor in varStatus 'colStatus'.
    And if I the query returns 3 columns - number of columns in generated table is 9.
    UPD. Specified behaviour is for af:iterator in the component's jspx. af:forEach produces no columns at all.
    Edited by: olegk on Mar 26, 2009 11:05 AM

  • Is it possible to create column chart in WAD

    Hi All,
    I would like to know if it is possible to create WAD -column chart  in BI
    Regards,
    Sampda.

    Though Arun has almost answered your query, gues this might also be helpful to you.
    You can create and here is how to do it SAP recommended way:
    http://help.sap.com/saphelp_nw04s/helpdata/en/c9/08533b97037963e10000000a114084/content.htm
    Cheers.
    Ray.

  • Is it possible to create an invoive that keeps a running total in one column and in another column keep total of monies spent from a starting amount of funding?

    Is it possible to create an invoive that keeps a running total in one column and in another column keep total of monies spent from a starting amount of funding?

    Hi Sara,
    Many thanks for your reply.  We just brought Adobe Acrobat XI Pro complete
    with Adobe Forms Central, My manager asked whether I could use the forms
    part to create a summary tracking sheet for all of our contracts.
    Having looked at it I could see how to create a table that in the first
    column deleted costs from a starting fund, and in the last keeps a running
    total of all monies spent.
    I agree, Excel does seem to be much better suited to the task.  I was try
    trying to comply with her request
    Regards,

  • Is it possible to create many primary key for a table?

    hello sir/mam.
    i am selva, i am new to abap,
    is it possible to create many primary key for a table?
    please guide me.

    Hi Selva,
    Many Primary Keys = Composite Key.
    i.e some set of columns will enable you to identify a unique row from a set of rows in the table.
    This can be achieved by checking the primary key check box in se11.
    Hope it helps.
    Regards,
    Maheswaran.B
    Message was edited by: Maheswaran B

  • Is it possible to create a generic report that accepts the SQL as a param

    Is it possible to create a generic report that accepts the FULL sql statement as a paramater and returns variable results based on this?
    We have a requirement to have a generic export routine to spit out csv's from clicking on a web page hyperlink, which would need to accept a "new" sql statement for every run, each containing different columsn etc that would be needed in the output.
    I was hoping could have a generic Oracle report, exporting delimited data format (and as such not using a layout) and somehow pass in the "new" sql statement as a parameter at run time - each sql statement would be different with different columns etc.
    Is this possible with oracle reports ?
    thanks

    If you need a simple dump of data you could try writing a report with a simple query such as
    select 'Report title or column headers'
    from dual
    &data_query
    then your &data_query parameter could be
    union select col1||','||col2 from data_table
    If you are outputing a comma separated data dump the you can concatenate together your data into a single text field.
    This would allow you to have a simple heading followed by the actual data. I guess you could extend this so that the 'Report title or column headers' from the first query was also a parameter to output your row headings i.e.
    select :column_headings_text
    from dual
    &data_query
    Give it a go and good luck

  • Is it possible to create a dynamic(with a select) check constraint?

    create table a (col_to_be_coded_fora number);
    create table b (col_to_be_coded_forb number);
    create table c (col_name varchar2(20), col_code number, col_desc varchar2(20));
    insert into c values ('col_to_be_coded_fora', 1, 'active');
    insert into c values ('col_to_be_coded_fora', 2, 'de-active');
    insert into c values ('col_to_be_coded_fora', 3, 'pending');
    insert into c values ('col_to_be_coded_forb', 10, 'school');
    insert into c values ('col_to_be_coded_forb', 20, 'hospital');
    insert into a values ( 1); -- meaning 'active' for table a, column col_to_be_coded_fora, can go in
    insert into a values (10); -- meaning nothing for table a, column col_to_be_coded_fora, must give error
    insert into b values ( 1); -- meaning nothing for table b, column col_to_be_coded_forb, must give error
    insert into b values (10); -- meaning 'school' for table b, column col_to_be_coded_fora, can go in
    I know i can handle this problem with dividing table c into to tables and creating foreign key relationship.
    in this demo case i have only a and b, 2 tables but i want to encode thousands of tables with a table like c.
    &#304;s it possible to create a dynamic check constraint on a table which selects c table for the inputs that have permision?
    Or do i have to use after insert, update triggers on table a and b to ensure this functionality?
    Is there a smarter implementation for this need, may be a design change?
    Thank you,
    Kind regards.
    Tonguç

    Hi Tonguç,
    A small design change makes it possible to do this with simple foreign key constraints.
    I would do something like:
    ual303@ORKDEV01> CREATE TABLE c (
      2    col_name VARCHAR2(20),
      3     col_code NUMBER,
      4     col_desc VARCHAR2(20),
      5     PRIMARY KEY (col_name, col_code)
      6  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> CREATE TABLE a (
      2    col_to_be_coded_fora NUMBER PRIMARY KEY,
      3     col_name VARCHAR2(20) DEFAULT 'col_to_be_coded_fora' CHECK (col_name = 'col_to_be_coded_fora'),
      4     FOREIGN KEY (col_name, col_to_be_coded_fora) REFERENCES c
      5  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> CREATE TABLE b (
      2    col_to_be_coded_forb NUMBER PRIMARY KEY,
      3     col_name VARCHAR2(20) DEFAULT 'col_to_be_coded_forb' CHECK (col_name = 'col_to_be_coded_forb'),
      4     FOREIGN KEY (col_name, col_to_be_coded_forb) REFERENCES c
      5  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 1, 'active');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 2, 'de-active');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 3, 'pending');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_forb', 10, 'school');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_forb', 20, 'hospital');
    1 rij is aangemaakt.
    ual303@ORKDEV01> -- meaning 'active' for table a, column col_to_be_coded_fora, can go in
    ual303@ORKDEV01> insert into a(col_to_be_coded_fora) values ( 1);
    1 rij is aangemaakt.
    ual303@ORKDEV01> -- meaning nothing for table a, column col_to_be_coded_fora, must give error
    ual303@ORKDEV01> insert into a(col_to_be_coded_fora) values (10);
    insert into a(col_to_be_coded_fora) values (10)
    FOUT in regel 1:
    .ORA-02291: integrity constraint (UAL303.SYS_C0033537) violated - parent key not found
    ual303@ORKDEV01> -- meaning nothing for table b, column col_to_be_coded_forb, must give error
    ual303@ORKDEV01> insert into b(col_to_be_coded_forb) values ( 1);
    insert into b(col_to_be_coded_forb) values ( 1)
    FOUT in regel 1:
    .ORA-02291: integrity constraint (UAL303.SYS_C0033540) violated - parent key not found
    ual303@ORKDEV01> -- meaning 'school' for table b, column col_to_be_coded_fora, can go in
    ual303@ORKDEV01> insert into b(col_to_be_coded_forb) values (10);
    1 rij is aangemaakt.
    ual303@ORKDEV01>Cheers,
    Colin

  • Is it possible to create a formula that converts a resource hours into full time units in project server 2010

    Hi
    Is it possible to create a formula that converts a resource available hours into full time equivalent units in project server 2010? Say a resource has 160 available hours for any given month this will translate into 1 FTE for this month. If it is 80 hours
    for that month then it will be 0.5 FTE and so on and so forth.
    Thanks,
    -Maurizio

    Maurizio,
    It's a bit late, but there are two OLAP cubes that can provide you with this information in a pivot table in Project Server 2010.
    "MSP_Portfolio_Analyzer" and "Resource Timephased" contains capacity measures that be used to provide calculated measures when the cube database is generated. You change OLAP cube configuration in "Server Settings -> Database Administration -> OLAP
    Database Management". In either of the aforementioned cubes, use "Calculated Measures" to create two measures:
    Member Name
    MDX Expression
    Available (FTE)
    ([capacity]-[work])/[capacity]
    Work (FTE)
    [Work]/[Capacity]
    These two fields will appear in the pivot table field list as "Values", and when combined with a "Time" column, can give you a picture of FTE usage and availability.
    I prefer the portfolio version since it contains project/assignment data and resource data, letting you see just  how resources are being utilized.
    One thing I have not been able to get around is getting ""Maximum Units" for a resource factored into the measure. A common practice is to allocate more that "100%" to generic resources to represent teams for planning purposes. The OLAP measures will show
    only 0.0 to 1.0 FTE for any resource, even if a resource represents more than one body.
    If you have an SSRS query you could share, I would appreciated it!
    Hope this helps!
    JTC
    JAckson T. Cole, PMP, MCITP

  • How to create  hidden column in Oracle Table

    Hi folks
    i have one doubt regarding hidden column creation in Oracle Table..
    Let me briefly explain my requirements.
    I have one table called UWRMC_MAST is table contain the following columns
            RMC_N_ID           NUMBER(10)                    NOT NULL,
           COB_N_ID           NUMBER(2)                      NOT NULL,
           SUBCOB_N_ID     NUMBER(2),
           RMC_C_CODE      VARCHAR2(10 BYTE)         NOT NULL,
           RMC_C_NAME      VARCHAR2(100 BYTE)       NOT NULL,
           CREATED_N_BY   NUMBER(10)                     NOT NULL,
           CREATED_D_DT   DATE                              NOT NULL,
           MODIFIED_N_BY  NUMBER(10)                     NOT NULL,
           MODIFIED_D_DT  DATE                              NOT NULL,
           RECORD_N_STS   NUMBER(1)                      NOT NULL,
           RMC_C_REMARKS VARCHAR2(256 BYTE),
           EFFECT_D_DT     DATE                           NOT NULL
    RMC_N_ID is primary key
    i want to create one column like Old_EFFECT_D_DT as virtual column
    when ever i update the effective date that date should be insert into Old_EFFECT_D_DT i.e., Virtual Column
    For example
    SQL> select RMC_N_ID, COB_N_ID, SUBCOB_N_ID, RMC_C_CODE, EFFECT_D_DT from uwrmc_mast;
      RMC_N_ID   COB_N_ID SUBCOB_N_ID RMC_C_CODE EFFECT_D_
            46          1          74 PCTMOTR    02-FEB-11
    Below i update the effective date(01-feb-2011
    SQL> update uwrmc_mast
      2  set EFFECT_D_DT = '01-apr-2011'
      3  where rmc_n_id =46;
    1 row updated.
    But i want a result like below
    SQL> select RMC_N_ID, COB_N_ID, SUBCOB_N_ID, RMC_C_CODE, EFFECT_D_DT from uwrmc_mast;
      RMC_N_ID   COB_N_ID SUBCOB_N_ID RMC_C_CODE EFFECT_D_   OLD_EFFE
            46          1          74 PCTMOTR    01-APR-11   02-FEB-11Is this possible to do in oracle , kindly give a solution for my requirement
    Regards
    Arun

    Arun wrote:
    Hi Mr.David_Aldridge
    Am having the doubt that's why i posted my quires in oracle forums.. just i want to know whether my requirement suit for VIRTUAL COLUMN in Table.
    Regards,
    ArunWell, I'm not sure exactly what your requirement is.
    If you want to audit changes to the records of that table then it would be better to use Oracle's auditing facility. If this previous change date is really a required part of your actual application functionality then you might use the application itself to maintain the previous date as a column in the table, as you say, or if you need to maintain the history of changes then add a new table so you can keep track of multiple changes.

  • Is it possible to create materialized view log file for force refresh

    Is it possible to create materialized view log file for force refresh with join condition.
    Say for example:
    CREATE MATERIALIZED VIEW VU1
    REFRESH FORCE
    ON DEMAND
    AS
    SELECT e.employee_id, d.department_id from emp e and departments d
    where e.department_id = d.department_id;
    how can we create log file using 2 tables?
    Also am copying M.View result to new table. Is it possible to have the same values into the new table once the m.view get refreshed?

    You cannot create a record as a materialized view within the Application Designer.
    But there is workaround.
    Create the record as a table within the Application Designer. Don't build it.
    Inside your database, create the materialized with same name and columns as the record created previously.
    After that, you'll be able to work on that record as for all other within the Peoplesoft tools.
    But keep in mind do never build that object, that'll drop your materialized view and create a table instead.
    Same problem exists for partitioned tables, for function based-indexes and some other objects database vendor dependant. Same workaround is used.
    Nicolas.

Maybe you are looking for

  • My MAC is crashing more frequently after installing Mountain Lion. Any Suggestion. Following is my Crash Report

    Interval Since Last Panic Report:  550031 sec Panics Since Last Report:          23 Anonymous UUID:                    20C4822E-0DE2-FAD7-CF78-0590B81FA4CC Tue Jan 29 22:45:33 2013 panic(cpu 0 caller 0xffffff7f97fa8b25): NVRM[0/1:0:0]: Read Error 0x0

  • VPN tunnels for multiple sites

    Hi, i am building new vpn tunnels for multple sites using 2 ASR 1004, and 100 remote devices cisco 2800 routers. I am thinking of using getvpn to do it, am i thinking correct ????? can i use DMVPN ???? what is else there ??? thanks 

  • Mail troubles

    Mail has been very unresponsive as of late. It just spins and it is loading plain messages very slow. I have to force quit several times a day. Is there any fix to keep mail running smooth?

  • VIDEO FORMATS -- iPhone4 to DVD

    I've got lots of short videos shot on my iPhone4, but I'm having trouble converting them to an "acceptable" format to play on a standard DVD player connected to a TV.  All I want to do is burn to DVD RW disks to give me the ability to interchange vid

  • Problem accessing Infosets using Query with SQL

    Hi, I have Lumira desktop version 1.18.0. Using the Query with SQL connection, I successfully connected to SAP R/3 6. I was able to view the User Groups under CATALOG_VIEW, but it seems I cannot go beyong this point and select an Infoset. When I clic