Dynamic creation of column in database table

Can I create columns in a database table dynamically?
Let's say I have two columns in a table. Users requested to have dynamic columns in the table. They wanted to create any no. of fields in the table dynamically. We can't alter the table every now and then. Is there any solution for this. Please let me.
Your early response is highly appreciated.
Thanks

I can't use "Alter" statement every time. User may need to insert any no.of columns dynamically. There is no fixed columns. Right now there are two columns which are static. Somebody said it is durable through XML. Can you please let me know in detail. I haven't not done anything using XML.
Thanks for the response.

Similar Messages

  • Check which column in database table is updated without hard code

    Hi ,
    I have a requirement to detect if there is a particular column in the database table is updated , and this column name is found in mapping table ( business logic ) , it will do an insertion to another special table.
    My idea is to introduce a trigger before update or delete on this table
    However , i would like to make it as dynamic as possible
    i dont want to use things as below in trigger if possible
    1. if ( old.name <> new.name ) then {
    if( 'name' is inside the mapping table ) {
    // do some insertion
    I want things like
    2. if ( there is a column updated on this table ){
    1. select column name and updated value that is updated
    2. if the column name that is updated is inside the mapping table {
    // do some insertion
    I am not really sure if the pseudo code listed in no 2 is achieveable in oracle using simple pl/sql or sql ?
    if possible , how to do it ?
    Thanks

    Hi,
    Check the link given below
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm
    and search for
    IF UPDATING THEN*009*

  • How to insert message style text columns in database tables

    Hi All,
    i have two pages.
    in first page segment1 lov is their.once u select the segment1 and click on the create button its navigate to next page.
    and display the releted segment1 details(these columns are message text input fields but read only columns).
    plz help me those columns are insert into database tables.
    its very urgent
    Thanks
    Latha.

    Hi Anil,
    plz help me still i am faceing the problem
    so plz help me because i dont know java.
    i wrote below code and i got the below error.
    if(pageContext.getParameter("Submit")!=null)
    String projnumber=pageContext.getParameter("ProjectNO");
    //String projectnumber=pageContext.getParameter("Projectnumber");
    String oldoperationid=pageContext.getParameter("EmployeeNumber");
    String newManagerName=pageContext.getParameter("NewManagerName");
    String ProjectID=pageContext.getParameter("ProjectID");
    String OldOperationName=pageContext.getParameter("OperationsManager");
    String OldOperationID=pageContext.getParameter("OldOperationID");
    OAMessageTextInputBean projnumberbean =webBean.findIndexedChildRecursive("ProjectNO");
    String projnumber=null;
    if(bean!=null)
    projnumber = (String)projnumberbean.getValue(pageContext);
    Serializable[] params = {projnumber,oldoperationid,newManagerName,ProjectID,OldOperationName,OldOperationID};
    am.invokeMethod("xxinsertpagelogic",params);
    and i wrote import also.
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
    my errors are
    Error(64,78): incompatible types; found: oracle.apps.fnd.framework.webui.beans.OAWebBean, required: oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean
    Error(65,13): duplicate definition of variable projnumber in method processFormRequest(oracle.apps.fnd.framework.webui.OAPageContext, oracle.apps.fnd.framework.webui.beans.OAWebBean)
    Error(66,9): variable bean not found in class wnsgs.oracle.apps.pa.projectinfo.webui.ProjectInfoCreateCO
    plz help me.
    its very urgent
    Thanks
    Edited by: Latha on Jan 4, 2012 9:57 PM
    Edited by: Latha on Jan 4, 2012 10:00 PM

  • NULL COLUMN ON DATABASE TABLE

    HELLO AGAIN TO EVERYONE AND TO EVERY ONE WHO IS BEEN REPLYING MY MESSAGES,
    I AM STIL HAVING PROBLE WITH MY JSP AND FORM(HTML).
    THE PROBLEM IS , THE NAMECOLUMN OF MY DATABASE REMAINS NULL WHEN I QUERY IT AFTER ENTERING DATA THROUGH THE FORM.COLUMN TYPE IS A VARCHAR . THE DATA ENTERED IS BEEN ENTEREDTHROUG THE request.getParameter() method OF THE JSP I DONT SEEM TO FIND ANY ERROR WITH MY CODE.
    THE CODE ARE PROVIDED BELOW.CAN ANYONE TELL ME WHAT IS HAPPENING BEHIND THE SCENE ON THE NAME COLUMN .I AM NEW TO JSP.
    jsp code
    try{
    Class.forName("com.mysql.jdbc.Driver");
    conn= DriverManager.getConnection("jdbc:mysql://localhost/school","barth","barth");
    // stat = conn.createStatement();
    // String name1 = request.getParameter( "name ");
    //int idnum = Integer.parseInt( request.getParameter("id") );
    //int age2 = Integer.parseInt( request.getParameter("age") );
    PreparedStatement stat = conn.prepareStatement(" INSERT INTO student " +
    " VALUES( ?, ? ,?)");
    stat.setInt(1,Integer.parseInt( request.getParameter("id") ));
    stat.setString(2, request.getParameter( "name "));
    stat.setInt(3,Integer.parseInt( request.getParameter("age") ));
    stat.executeUpdate();
    conn.close();
    catch(Exception e)
    {e.printStackTrace();}
    sample of database table column.
    *******************************************************************************mysql> select * from student;
    | id | name | age |
    | 10 | NULL | 76 |
    | 10 | NULL | 76 |
    | 9 | NULL | 34 |
    | 11 | NULL | 45 |
    | 12 | NULL | 23 |
    14 rows in set (0.13 sec)
    mysql>

    First of all, don't use all CAPS when typing, it gets difficult to follow your text! Also try putting your code in [ code ] -tags in the future, it's so much easier to follow code that way.
    Looking at your database it appears as if name isn't holding a value when you use it in your database call.
    Verify that it *IS holding a value, you can do that by printing it to the console, i.e.
    System.out.println( request.getParameter("name")  );

  • Change Date Column in database table format from mm/dd/yyyy to dd/mm/yyyy

    Hi I use Jdeveloper 11G with an Oracle Database.
    My table is empty currently but I am importing some excel columns into it and the dates in them are throwing errors because you have some dates like 14/09/2012 which would mean the month is out of range even though its not.
    This seems like a simple thing to do but I was unable to find how online.
    Please Help

    I'm not sure I understand COlumn Type is DATE
    There is no Simple Date type. This is DATABASE, has nothing to do with Entities and Views etc. This is straigh in the Database Table.
    Edited by: Dino2dy on Nov 6, 2012 5:47 AM

  • How to map single input value to Two columns of Database table using format file of Bulk Copy Process

    Hi All,
    Am using OPENROWSET to load the file data into table, here the problem is i need to map same input value to two different columns of table, As format file doesn't allow the duplicate numbers am unable to insert same value to two columns, please help me to
    find a solution for this. 
    i can use only OPENROWSET because i need to insert some default values also which come based on file. only the problem is how to map same input value to two different columns of table. please give me the suggestions.
    Thanks,
    Sudhakar

    From what you say:
       INSERT tbl(col1, col2)
          SELECT col1, col1
          FROM   OPENROWSET(....)
    But I guess it is more difficult. You need to give more details. What sort of data source do you have? What does your query look like? The target table?
    Erland Sommarskog, SQL Server MVP, [email protected]
    Hi Erland,
    Thanks for your response
    my source file is text file with | symbol separate for ex:
    1002|eTab |V101|eTablet|V100|Logic|LT-7|Laptops|SCM
    Database table have columns like
    column1,column2,column3...etc, now i need to insert same value from input file into two columns for ex:
    the eTab value from text file has to be insert into column2 and column3 of
    table
    we cannot change format file like below one
    for the above situation how can we insert eTab into column2 and column3
    Thanks,
    Sudhakar.

  • Dynamic Number of Column in a table

    Hi guys,
    I have a requirement that needs dynamic number of column in a tale.
    It is possible to do this in Adobe forms.
    Thanks,
    Chirantan

    Hello. It of course is possible in Adobe.
    You need to write a simple script using JavaScript or FormCalc to hide or show columns according to some special value. You will work with the presence attribute of the object. E.g. MYFIELD.presence = "visible" or "hidden" or "invisible". You will need to change your subforms content to flowed.
    Use these guides:
    http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_basics.pdf
    help.adobe.com/en_US/livecycle/es/FormCalc.pdf
    Hope this helps, good luck, Otto

  • How to automate creation of MS Access databases/tables/records

    Can someone point me to some examples that automate the creation of MSAccess database files and tables?
    Can I do this with a bat file? If not, a ps1 file?
    I bing searched and could not find an example.
    I want to test the existence of a mdb (or accdb) file and if it does not exist, create it.
    Then I want to see if that mdb (or accdb) file contains a table named "parts".
    If it does not contain that table named "parts", create the table.
    If that table does not contain any records, than add some sample data, presumably with some SQL "INSERT" statements.
    What is the preferred API for this? I was thinking we should use the ADO.NET/OleDB API. I did find a few examples of queries of MSAccess databases with the old ADO API.
    ADOX seems very old for creating databases. Is there any thing more modern?
    Is powershell the easiest scripting language to do this?
    Thanks
    Siegfried
    siegfried heintze

    This blog post should have most (if not all) of what you need:
    http://blogs.technet.com/b/heyscriptingguy/archive/2009/02/16/how-can-i-use-windows-powershell-to-create-an-office-access-database.aspx
    One thing to watch out for is the db provider for the connection string.  The "Jet Engine" has been superseded by
    ACE.

  • Dropping unused columns from database table

    I have an existing table called TUSER. I have mapped some fields, but not
    all fields, as some are inserted by other applications and for reporting
    purposes.
    I am using JDK 1.3.1_02, Windows 2000, SQL Server 2000 database, Kodo
    JDOEE 2.2.6 and JBoss 3.0.0.
    When I refresh the datastore it drops all columns that are not mapped
    (note that these colums can contain null values):
    [java] [ connection: 2961925; statement: 2766626; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER ADD Job_Title_ID VARCHAR(255)
    [java] [ connection: 2961925; statement: 1582473; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MAILUSERID
    [java] [ connection: 2961925; statement: 5237832; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PHONENUMBERS
    [java] [ connection: 2961925; statement: 2191491; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMPLOYEENO
    [java] [ connection: 2961925; statement: 894443; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MDATE
    [java] [ connection: 2961925; statement: 531758; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN STATUSCHANGETIME
    [java] [ connection: 2961925; statement: 5899013; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN FINISHDATE
    [java] [ connection: 2961925; statement: 8146001; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDMBOARD
    [java] [ connection: 2961925; statement: 7756310; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN DEL_FLG
    [java] [ connection: 2961925; statement: 6817858; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_CD
    [java] [ connection: 2961925; statement: 7754670; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDREQUESTER
    [java] [ connection: 2961925; statement: 7332084; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MSG_SERVER
    [java] [ connection: 2961925; statement: 1691809; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN AUTORUN
    [java] [ connection: 2961925; statement: 5253969; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN REG_DATE
    [java] [ connection: 2961925; statement: 4977422; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_LST
    [java] [ connection: 2961925; statement: 4343712; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN ALLOWREPL
    [java] [ connection: 2961925; statement: 7104150; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMAIL
    [java] [ connection: 2961925; statement: 4395840; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MANAGERSTATUS
    [java] [ connection: 2961925; statement: 2417379; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MD5_DIGEST
    [java] [ connection: 2961925; statement: 2865120; time: Thu Jul 04
    15:33:25 JST 2002 ] ALTER TABLE TUSER DROP COLUMN SMTPADDRESS
    15:33:25 JST 2002 ] INSERT INTO JDO_SCHEMA_METADATAX(CLASSNAMEX) VALUES
    ('com.gulfnet.g
    roupcast.data.User')
    Is this meant to happen? I am guessing not. Is there a way to tell the
    schematool to not remove existing columns?
    Thanks in advance.
    Kam

    You can in fact tell the schematool not to drop columns it doesn't know about. When you run the schematool, use the "add" action rather than "refresh". Then it will only add columns, never drop them. See the documentation for details:
    http://www.solarmetric.com/Software/Documentation/2.2.5/manual.html#schema_manipulation

  • Auto Increment column in database table

    Hello experts, I am using oracle 11g database at windows 7.I have to create a sequence object and a table with an auto increment ID column.For this I have created a trigger before insert to select next sequence from a sequence object. It works well but Now I have the current sequence is 7 and there are 6 records inserted in table. Now I delete two records.Thus I have only 5 records in table but my current sequence is still 7.So if I put it in id column then a new record will be inserted in table with 7 ID number after 5th ID number.I want this record should be inserted with 6 Id number. For this I tried to not use sequence object.I tried a pl/sql trigger before insert, which will count the all records in table and after increment i put it in ID column to insertion....Is this a professional way..? thank You regards aaditya

    979801 wrote:
    Hello experts, I am using oracle 11g database at windows 7.I have to create a sequence object and a table with an auto increment ID column.For this I have created a trigger before insert to select next sequence from a sequence object. It works well but Now I have the current sequence is 7 and there are 6 records inserted in table. Now I delete two records.Thus I have only 5 records in table but my current sequence is still 7.So if I put it in id column then a new record will be inserted in table with 7 ID number after 5th ID number.I want this record should be inserted with 6 Id number. For this I tried to not use sequence object.I tried a pl/sql trigger before insert, which will count the all records in table and after increment i put it in ID column to insertion....Is this a professional way..? thank You regards aaditya
    Sequences only guarantee unique numbers.  You cannot (and should not) attempt to create gapless sesquences.  That's not how oracle works and will not scale to a multi user application.
    Imagine two people try to insert records at the same time (and have yet to commit), the trigger you create will count the number of records and determine there are 5 records, so assign the next number of 6, for both people who are inserting records.  The first person to commit will get their data saved, and assuming you have a unique constriaint on that id, the second person will raise a duplicate key on insert or suchlike error.
    Gapless sequential numbers are not appropriate to multi-user environments.  Such requirements are often given by managers or business people who do not understand the technology.
    Think of it in terms of a real world office, but with people using a paper system instead of a computer.  The only way you can try to guarantee people get the next number and also re-use numbers that have been deleted is to have a single place where each person in the office goes to, to fetch the next number, and they have to queue up behind each other to get the next one off the list.  But if someone has removed an old record, they've got to wait in the same queue to go and put that number back in the pot for someone else to use.  It just doesn't work, even in a manual system.  Yes, people can guarantee that they're only getting unique numbers that nobody else is using, but they cannot guarantee that they are reusing and filling gaps etc.  It's an unrealistic expectation.

  • Dynamic Creation of Columns based on Date from variable screen

    Hi Experts,
    Is it possible to create the Columns dynamically?
    My requirement is,
    for eg if the user selects the dates from 23Aug2008 to March2010 in variable screen, then in the output I should be able to drilldown and see the individual months data i.e., from Aug2008 to March2010 (20 columns).
    If the user selects March2009 to November2009 (9 columns)
    Is it possible to display in output like this?
    Is it possible to create columns dynamically(based on the period selected) in the output?
    Kindly help.
    Thanks,
    Guru
    Edited by: hi2guru on Aug 3, 2010 12:07 PM

    Hi Shanthi,
    Thanks for replying.
    And sorry If i havnt elaborated my requirement.
    I used a new structure->new selection with 0CALDAY restricted by 0I_DAYS periodFrom/to variable in Columns.
    Its displaying the total of the selected period in a single column.
    My requirement is to drilldown the same into individual months values in seperate columns.
    If the selected period has 8 months, then 8 columns. if the selected period has 15 months, then 15 individual columns.
    Pls help me.
    Guru
    Edited by: hi2guru on Aug 3, 2010 12:24 PM

  • Dynamic creation of Poplist in Advanced Table

    Dear All,
    I am very new to oaf.
    I have a requirement where based on a value returned by vo, the values of poplist(one of the column) in advancedTable should change. I need this property in PR.
    Appreciate your inputs.

    Hi Keerthi,
    Nope. I am developing a search screen. Based on previous page parameter value, the advancedTable in my current search page should load with VO details.
    While mapping VO attributes with advancedTable columns i have mapped one of the value as formValue. Based on this formValue(where clause attribute of poplist vo) the poplist column in the advancedTable should be dynamically rendered.
    So onload ie., in processRequest i have to make sure the poplist values in each row is rendered based on formValue in each row of advancedTable.
    Can you please provide some input with sample code?
    Thanks,
    Senthil

  • Based on input file i need to update default values to some columns of database table using bulk copy process

    Hi Team,
    Am using BULK INSERT Format file option to load data into table from .txt file here am facing an issue i.e ibased on input file i need to insert default values to some columns of table so we can not declare it on table level, Can we give default values in
    format file ? if we can give how it is ? or Any alternate possibilities to this scenario instead of BULK INSERT ?
    Thanks,
    Sudhakar

    Thanks for your response, here i don't have any rights to change table structure the table is created by different team, my work is to load data from file to table. Is there any chance to supply default values by*XML* format file instead of *.fmt* file
    please let me know the possibility.
    Again, no. If you want to supply default values that are not present in DEFAULT constraints in the table definition, you will need to write your own code. There are plentyfull of options, and I have mentioned some already.
    Here are some more:
    *  Table-valued parameters, see here for examples:
    http://www.sommarskog.se/arrays-in-sql-2008.html
    *  Use BULK INSERT to load data to a staging table, and then apply the default values when you copy from staging to target.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Insert direct column from database table and function value into a table

    Hi All,
    Please resolve this query for me....
    Suppose my select query is like this
    Select empno from EMP; (simple select)
    Select fun_dept(empno) from dual;(function)
    i want both the output of the select query to be written into a table like this....
    Suppose out of the First Select query is ..... 45009
    Output for the Second Query is...................ECE
    i want to insert this output into a table...like
    something like this
    XX:
    Empno Dept
    45009 ECE
    how to do this..??
    Thanks in Advance,
    Regards,
    Gita

    My exact query is like this.
    create or replace function fun_sal(v_rno number,v_year number,v_period number)
    return number as
    cursor s is
    select salary from emp where eno=v_rno and eyear=v_year and eperiod=v_period;
    begin
    open s;
    loop
    exit when s%notfound;
    fetch s into v_sal;
    if v_sal<1000 then
    sal:=v_sal*1555;
    else
    sal:=0;
    return sal;
    end if;
    end loop;
    close s;
    end;
    create or replace procedure pro_act(v_rno number,v_year number,v_period number) as
    v_eno number(10);
    v_ename varchar2(10);
    cursor c is
    select eno,ename from emp where eno=v_rno and eyear=v_year and eperiod=v_period;
    begin
    open c;
    loop
    exit when c%notfound;
    fetch c into v_eno,v_ename;
    insert into master(empno,empname,rev_salary)values(v_eno,v_ename,"*****function fun_sal value has to come here*******");
    commit;
    end loop;
    close c;
    end;
    how to do....

  • Database Table Fields Display - Alpha only?

    When you are working with dynamic sites, and have the
    database tables interface open.. if you click a table, the fields
    come up in alphabetic order, rather than table order. This is very
    different than most tools. Is there a way to disable the
    alphabetizing and just show the table fields in table order (i.e
    keys first, etc) ??
    Thanks/

    Hi Swarna
    Try this code.
    DATA:
    T_ITAB LIKE TABLE OF ZTABLE,
    FS_ITAB LIKE LINE OF T_ITAB,
    WA_ITAB TYPE ZTABLE-REVIEW_CYCLE .
    SELECT * FROM ZTABLE INTO TABLE T_ITAB.
    SORT T_ITAB DESCENDING BY REVIEW_CYCLE .
    READ TABLE T_ITAB INTO FS_ITAB INDEX 1.
    MOVE FS_ITAB-REVIEW_CYCLE TO WA_ITAB.
    LOOP AT T_ITAB INTO FS_ITAB.
      IF FS_ITAB-REVIEW_CYCLE EQ WA_ITAB.
        WRITE:/
           FS_ITAB-REVIEW_CYCLE ,
           FS_ITAB-REVIEW_STEP,
           FS_ITAB-GUID.
      ENDIF.
    ENDLOOP.
    Regards
    Hareesh Menon

Maybe you are looking for

  • MB5B shows different opening quantity when we select diffferent Stock Type

    Dear All, I am trying to run report MB5B - Stock on posting date with 2 different Stock Types: - Storage Loc/Batch Stock - Valuated Stock But the report shows different opening quantity,total receipt, total issue, but closing quantity is ok. Could yo

  • 'insert picture' is not working

    hi i'm trying to insert a picture (logo) into report: Main menu -> Insert -> Picture... -> then i click somewhere in the report and i get browser dialogue where i choose .bmp file. After that a rectangle appears with a line by it's diagonal in my rep

  • Xperia z2 dead , red light blinking when connected to usb charging cable

     My phone is totally dead, i cant do anything power button + volume up button , force restart button near the sim , and nothing happens , also when i connect to a usb charger the red light is blinking all the time . Please HELP ME i need my xperia z2

  • Infotype 0008 - Wrong Salary Calculation

    Hello, We are having a problem with Infotype 8 annual salary calculation in 4.7. We have 173.33 working hours per month and Capacity utilization level 100%. The way It is calculating annual salary below.. Monthly Salary = 5000 It's multiplying workin

  • MacBook Pro 2011: Inconsistent cycle count for battery

    hi folks, i observed some strange behavior of the cycle count reported by the system. when i got the machine the count was at one. after loding the system twice the count was already at 6 cycles. (i really attached the power cord only twice and the s