Store data in logical column

I am building a report to calculate the following formula:
Weekly Raised = Delta (“total defect for CURRENT week” and “total defect for LAST week”)
Example:
Current week May 24th, “total defect for CURRENT week” = 30
Last week May 17th, “total defect for LAST week” = 20
Weekly Raised = 10
In order for my formula to calculate correctly, I think I would need logical column to store the data that I need
I would need TWO logical columns:
Logical Column number one is to store “total defect for CURRENT week”
Logical Column number two is to store “total defect for LAST week”
The physical column that I'm using to calculate the total defect is (SUM("Defect Facts".BG_BUG_ID))
Can any somebody help me with this?

Hi,
pls refer the below link
http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/bi_admin/biadmin.html#t11
in the link ref the section Creating Time Series Measures which will tell you how to create the two basic measures.
and then right click on the current week measure and go to Calculation wizard.
then select the last week measure in it and in the next page select change or percent change or what ever you want.
after that in this newly created measure set the aggregation as sum.
now you can directly use this newly created measure in your report.
hope this helps.
thanks,
karthick

Similar Messages

  • How To Create Logical column For Lastyear To Till Date

    Hi All,
    I Have to calculate Lastyear to Till Date for Logical Column.
    Ex:I have Time Dime and Fact column and Dimension columns.
    jan 2011 to oct 2012.
    Please Let me know.
    Thanks,
    Abhi

    Looks like you are not reading my messages
    Since you are doing on logical columns getting this error.
    Try this using physical columns then count from aggregate tab
    CASE WHEN "Oracle Data Warehouse"."Catalog"."dbo"."Fact_W_SRVREQ_F_Open_Date"."OPEN_DT_WID" > 20110101 THEN "Oracle Data Warehouse"."Catalog"."dbo"."Fact_W_SRVREQ_F_Open_Date"."SR_WID" END
    The same you can go with your variable
    Or else the same can do by duplicating the existing Fact - CRM - Service Request"."# of SRs" and just add above code.
    or just use the below you dont use sum since already aggregation is happend for # of SRs
    CASE WHEN "Core"."Dim - Date"."Year" = VALUEOf("Warehouse Refresh Date Last Year"."CURRENT_CALENDAR_YEAR_LAST_YEAR") AND "Core"."Dim - Date"."Date" < VALUEOF("Warehouse Refresh Date Last Year"."LAST_REFRESH_DATE_LAST_YEAR") THEN "Core"."Fact - CRM - Service Request"."# of SRs" END
    Hope this works, mark as correct

  • Previous Available date in a column

    I Have a colum date and a amount. If select a date i need to fetch the previous avaialble amount
    In the below case
    WITH table_1 AS
    (select '700' amount,'01/01/2011' date1 from dual union all
    select '800' amount ,'12/23/2010' date1 from dual union all
    select '900' amount, '11/31/2011' date1 from dual
    select * from table_1;
    if my where clause for date = '12/23/2010' then the amount should be '0' as no previous day amount avaialble.
    if my where clause for date = '01/01/2011' then the amount should be '800' as the avaialble previous date is '12/23/2010'
    if my where clause for date = '11/31/2011' then the amount should be '700'' as the avaialble previous date is '01/01/2011'
    Please help
    Edited by: user10285699 on Jan 24, 2011 5:47 PM

    Hi,
    user10285699 wrote:
    ... WITH table_1 AS
    select '1' day, '10' id1,'100' amount,'12/30/2010' date1,'null' amount_pre_day from dual union all
    select '1' day,'20' id1 ,'200' amount , '12/20/2010' date1 ,'null' amount_pre_day from dual union all
    select '1' day, '30' id1, '300' amount, '10/28/2011' date1,'null' amount_pre_day from dual
    select * from table_1;
    The second day i need to calculate the previous AVAILABLE day amount and update another column "amount_pre_day"
    WITH table_1 AS
    (select '2' day, '10' id1,'400' amount,'12/31/2010' date1, '100' amount_pre_day from dual union all
    select '2' day, '20' id1 ,'500' amount ,'12/22/2010' date1,'200' amount_pre_day from dual union all
    select '2' day, '30' id1, '600' amount, '10/31/2011' date1,'300' amount_pre_day from dual
    select * from table_1;
    The tihrd day i need to calculate the previous AVAILABLE day amount and update another column "amount_pre_day"
    WITH table_1 AS
    (select '3' day, '10' id1,'700' amount,'01/01/2011' date1, '400' amount_pre_day from dual union all
    select '3' day, '20' id1 ,'800' amount ,'12/23/2010' date1,'500' amount_pre_day from dual union all
    select '3' day, '30' id1, '900' amount, '11/31/2011' date1,'600' amount_pre_day from dual
    select * from table_1;Thanks for posting the sample data.
    Always post the results you want from the sample data, too, and say what version of Oracle you're using.
    Are those 3 different sets of sample data? I'm very confused by what you want.
    Why is everything a string, including the word 'null'? In particular, it's a really bad idea to store dates in VARCHAR2 columns; you should use a DATE column instead.
    What date is '11/31/2011' supposed to be?
    My best guess as to what you mean is:
    "I have the following table:
    {code}
    WITH table_1 AS
    select '1' day, '10' id1, '100' amount, DATE '2010-12-30' date1, null amount_pre_day from dual union all
    select '1' day, '20' id1, '200' amount, DATE '2010-12-20' date1, null amount_pre_day from dual union all
    select '1' day, '30' id1, '300' amount, DATE '2011-10-28' date1, null amount_pre_day from dual union all
    select '2' day, '10' id1, '400' amount, DATE '2010-12-31' date1, '100' amount_pre_day from dual union all
    select '2' day, '20' id1, '500' amount, DATE '2010-12-22' date1, '200' amount_pre_day from dual union all
    select '2' day, '30' id1, '600' amount, DATE '2011-10-31' date1, '300' amount_pre_day from dual union all
    select '3' day, '10' id1, '700' amount, DATE '2011-01-01' date1, '400' amount_pre_day from dual union all
    select '3' day, '20' id1, '800' amount, DATE '2010-12-23' date1, '500' amount_pre_day from dual union all
    select '3' day, '30' id1, '900' amount, DATE '2011-11-30' date1, '600' amount_pre_day from dual
    {code}
    But I don't actually want to supply the amount_pre_day column; I want to compute that from the amount column of the previous row (where date1 determines what that means) for the same id1."
    If that's what you meant, here's one way to get it:
    SELECT       t.*
    ,       LAG (amount) OVER ( PARTITION BY  id1
                                  ORDER BY         date1     -- or maybe day
                       )               AS calc_pre_day
    FROM       table_1   t
    ORDER BY  id1
    ,            date1
    ;Output:
    D ID AMO DATE1       AMO CAL
    1 10 100 30-Dec-2010
    2 10 400 31-Dec-2010 100 100
    3 10 700 01-Jan-2011 400 400
    1 20 200 20-Dec-2010
    2 20 500 22-Dec-2010 200 200
    3 20 800 23-Dec-2010 500 500
    1 30 300 28-Oct-2011
    2 30 600 31-Oct-2011 300 300
    3 30 900 30-Nov-2011 600 600As you can see, the last column (calc_pre_day) is the same as amount_pre_day.

  • Logical column using data source from 2 generations of same hierarchy

    Hi experts,
    I'm using Essbase as my data source in CEIM physical layer,
    and I have a hierarchy called "Entity" which contains different level of companies,
    in Generation 2 I have only one member called "group totals" and in Generation 3 are 5 members representing 5 different industries,
    I need to use these total 6 members as slider on the top of the view(a Dial),
    and the measure I want to show is scaled in rate, which I can't simply sum up those five members in Gen3 to get Gen2 measurement.
    I tried to create a logical column using Entity-default(the alias table) as datasource, it worked but was not sorted in outline style.
    I tried to sort them using calculate items in selection steps, but calculate items seemed cannot be shown as section or slider.
    So I wonder if I can simply create a logical column that sourced from different generations(in this case, my Gen2 and Gen3) of same hierarchy,
    is it possible to do such things?
    Thanks for reply.

    You could try General Database Discussions the main db foum.
    What are you using to migrate your database? Why is it being mapped from varchar2(8) to varchar2(32). It sounds like someone/something is intervening here.
    Barry

  • Create a logical column with more than one data source

    I'm having a problem to create a logical column with more than one data source in Siebel 7.8.
    What I want to do is the union of 2 physical tables in one logical table.
    For example, I have a "local_clients" table and a "abroad_clients" table. What I want is to have a logical table "clients" with the client data from the 2 tables.
    What I've tried is dragging the datasources I need onto the logical column.
    However this isn't working because it only retrieves the data from the first data source.

    Hi!
    I think it is not possible to do this just by dragging the columns to the logical table. A logical table can have more than one source, but I think each column must have just one direct source column.
    I'm not sure, but maybe you should do the UNION SQL to get the data of the two tables. In the physical layer, when you create a new physical table, it's possible to set the "table type" as a "SELECT". I didn't try that, but it seems that it's possible to have the union table in the physical layer.
    Bye.
    Message was edited by:
    user578388

  • Data contained in Logical Column w.r.t mapped columns

    Hi,
    A logical column (say A) of BMM layer is mapped to two different columns of separate tables (T1 and T2).
    What data will the column A (of BMM layer) contain (data corresponding to column of table T1 or T2) ?
    Regards

    Just bind the data in your data model, then display the table as usual. Here is an example.

  • Store data in excel file in multiple columns

    Hi,
    I am working on a data logger type of project. I have to store data received from serial port into excel file. I have attached images of data I am getting at serial port  ,image of  how I want to store data in excel worksheet and image of VI i tried.
    please note that I know VI   I  built is incomplete. I have mentioned in image, In which part exactly I need help...
    If anyone can suggest more efficient ways to do this that will be very helpful.
    Attachments:
    serial data.png ‏79 KB
    SerialDataLog.png ‏31 KB
    serialDataWithOutNames.png ‏64 KB

    You are not writing to an Excel file -- you are writing a "spreadsheet", which is entirely different.
    It is usually a good idea to write yourself some documentation, as it can help decide how to structure your program.  For example, do you collect all of the data, and then write it all at once?  That suggests three sub-VIs, "Acquire Data from VISA", "Extract Data from Serial String", and "Output Data to Excel".  The output from the first VI could be an array of Strings that look like "XCount: 123   Depth: 456  YCount: 789", the output from the second could be a 2D array whose columns are the XCount, Depth, and YCount values, and the third sub-VI would take this 2D array and use the Report Generation Toolkit to write a true Excel file (.xlsx) with headers XCount, Depth, and YCount and containing the values from the 2D array.  Each of these tasks is relatively simple to do "stand-alone", and it will be much easier to maintain/modify your top-level design if you only have 3 sub-VIs (with maybe some "bookkeeping functions" like getting file names) to worry about.
    On the other hand, if you need to acquire/parse/output a point at a time, this can still be done, but now you have to mix everything together.  Still, conceptualizing it as three sequential tasks (and maybe making three sub-VIs that do "one piece" of each task) might help you develop your algorithm.
    Bob Schor

  • How to change the variable value at run time in logical column in RPD

    for e.g..
    i have used a session variable in logical column in rpd in case statement. now in dashboard prompt i am using that variable to store data which user is passing but the data captured is not getting reflected in the logical column.
    its been always populated with the default value passed through the initilization block..

    resolved myself

  • Accessing logical columns using metadata table

    Hi,
    I have a requirement to store data coming from multiple sources in various format into single table as the number of tables required is not determinable at development phase. Hence I have defined 2 tables,
    1. Metadata table storing the information about logical columns in the incoming data.
    2. Raw generic table where the actual data would be stored.
    While accessible the logical data first I need to access the metadata table to fetch the column details and then access the raw table to provide actual data in those columns. Even though this option is available the code might not remain readable as need to use actual raw table column names in the code.
    I have thought of view based access but again number of views required is not known at development time. Is there any option/feature available which would be able to provide logical view for the raw data?
    thank you in advance.

    Hi
    Firstly, this sounds rather messy and is not something I would consider doing - but I shall give you the benefit of the doubt that all other options have been exhausted.
    A way I can think of is that you could define your metadata a bit like the oracle data dictionary, then you could use something like APEX where you can use dynamic SQL to show a report on the data. Imagine something like this
    DECLARE
    l_sql VARCHAR2(32000);
    BEGIN
    l_sql : = 'SELECT ';
    FOR i IN
    (SELECT column_name
    FROM my_table_data
    WHERE table_name = :TARGET_TABLE)
    LOOP
    IF i = 1
    THEN l_sql := l_sql||i.column_name;
    ELSE l_sql := l_sql||', '||i.column_name;
    END IF;
    END LOOP;
    l_sql := l_sql||' FROM '||:TARGET_TABLE;
    RETURN l_sql;
    END;Obviously you can make stick in predicates etc. if you need to but that would be a starting point?
    Not very pretty though...
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)

  • How can I Move data from one column to another in my access table?

    I have two columns, one that stores current month’s data and one that stores last month’s data. Every month data from column 2 (this month’s data) needs to be moved to column 1 that holds last month’s data. I then null out column 2 so I can accumulates this month’s data.
    I understand how to drop a column or add a column, how do I transfer data from one column to another.
    Here is my trial code:
    <cfquery name="qQueryChangeColumnName" datasource="#dsn#">
      ALTER TABLE leaderboard
      UPDATE leaderboard SET  points2 = points3
    </cfquery>
    Unfortunately, I get the following error:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in ALTER TABLE statement.
    How can I transfer my data with the alter table method?

    I looked up the Access SQL reference (which is probably a
    good place to start when having issues with Access SQL), and
    it suggests you probably need a WHERE clause in there.
    I agree the documentation is a good place to start. But you should not need a WHERE clause here.
    Too few parameters. Expected 1.
    If you run the SQL directly in Access, what are the results? At the very least, it should provide a more informative error message..

  • How to create Measue Logical Column in fact?- urgent

    Hi All,
    In BMM Layer i have 2 Fact Tables with Different Sources .
    Fact - Fact1
    X1
    Fact - Fact2
    Y1
    But now I want to create Logical Column in 'Fact - Fact 2' as follows
    Z1 = X1 + Y1
    But Once aftre cretaion of that Column , from the Report side i can able to see the data only if the report contains Z1 Attribute alone.
    But if the report contains any other attribute along with Z1... that Z1 doesnt have any Data .. its Blank.
    How can i resolve this issue ?

    Have you all conformed dimensions between the two facts?

  • How to retreive soap xml data from clob column in a table

    Hi,
    I am trying to retrieve the XML tag value from clob column.
    Table name = xyz and column= abc (clob datatype)
    data stored in abc column is as below
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:head="http://www.abc.com/gcgi/shared/system/header" xmlns:v6="http://www.abc.com/gcgi/services/v6_0_0_0" xmlns:sys="http://www.abc.com/gcgi/shared/system/systemtypes">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <RqHeader soapenv:mustUnderstand="0" xmlns="http://www.abc.com/gcgi/shared/system/header">
    <DateAndTimeStamp>2011-12-20T16:02:36.677+08:00</DateAndTimeStamp>
    <UUID>1000002932</UUID>
    <Version>6_0_0_0</Version>
    <ClientDetails>
    <Org>ABC</Org>
    <OrgUnit>ABC</OrgUnit>
    <ChannelID>HBK</ChannelID>
    <TerminalID>0000</TerminalID>
    <SrcCountryCode>SG</SrcCountryCode>
    <DestCountryCode>SG</DestCountryCode>
    <UserGroup>HBK</UserGroup>
    </ClientDetails>
    </RqHeader>
    <wsa:Action>/SvcImpl/bank/
    SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq</wsa:Action></soapenv:Header>
    <soapenv:Body>
    <v6:AlertDeleteInqRq>
    <v6:Base>
    <v6:VID>20071209013112</v6:VID>
    <!--Optional:-->
    <v6:Ref>CTAA00000002644</v6:Ref>
    </v6:Base>
    </v6:AlertDeleteInqRq>
    </soapenv:Body>
    </soapenv:Envelope>
    And i want to retrieve the values of tag
    <ChannelID> and <v6:VID>
    can somebody help, i have tried with extractvalue but not able to get the values

    I have used the below two queries but not able to get the expected results. Both queries result into no values.
    select xmltype(MED_REQ_PAYLOAD).extract('//ClientDetails/Org','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" || xmlns="http://www.abc.com/gcgi/shared/system/header"').getStringValue() from ESB_OUTPUT_TEMP where SOAPACTION = '/SvcImpl/bank/alerts/v6_0_0_0/SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq'
    select EXTRACTVALUE(xmltype(MED_REQ_PAYLOAD),'/RqHeader/) from ESB_OUTPUT_TEMP where SOAPACTION = '/SvcImpl/bank/SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq'
    Well, for starters, both queries are syntactically wrong :
    - non terminated string
    - incorrect namespace mapping declaration
    - unknown XMLType method "getStringValue()"
    Secondly, all those functions are deprecated now.
    Here's an up-to-date example using XMLTable. It will retrieve the two tag values you mentioned :
    SQL> select x.*
      2  from esb_output_temp t
      3     , xmltable(
      4         xmlnamespaces(
      5           'http://schemas.xmlsoap.org/soap/envelope/' as "soap"
      6         , 'http://www.abc.com/gcgi/shared/system/header' as "head"
      7         , 'http://www.abc.com/gcgi/services/v6_0_0_0' as "v6"
      8         )
      9       , '/soap:Envelope'
    10         passing xmlparse(document t.med_req_payload)
    11         columns ChannelID  varchar2(10) path 'soap:Header/head:RqHeader/head:ClientDetails/head:ChannelID'
    12               , VID        varchar2(30) path 'soap:Body/v6:AlertDeleteInqRq/v6:Base/v6:VID'
    13       ) x
    14  ;
    CHANNELID  VID
    HBK        20071209013112
    You may also want to store XML in XMLType columns for both performance and storage optimizations.

  • Display values for logical columns with several physical sources

    Hi all,
    I'm enocuntering some strange behaviour with the values displayed for a column (when we want to add it a as a filter, and in the dialogue box select 'Show All' values).
    Basically the logical column is mapped against several physical columns as the base fact table is aggregated to different levels. Additionally, one column in the fact tables has an attribute value, and these vary between the aggregated and non-aggregated table. This is not a problem.
    In the production environment, when we display the all values in the filters prompt for this column we are seeing the values being taken from one fact table. Naturally this means that not all the values possible for this column are being shown (i.e. values from the aggregated fact tables are missing). Now in one of our test environment where those fact tabels have additional data loaded, the values are being taken from one of the other fact tables. Unfortunately it is not necessarily the fact table with less data.
    My questions are:
    a) What dictates which fact table the server will use when the query in Answers doesnt use any dimensions (i.e. we are selecting just this attribute and selecting all the possible values by which it can be filtered)?
    b) Is there a way of obtaining all the values from the differente physical columns? I.e. that the display values shows the values of that logical column across all the physical fact tables? Maybe we would need to model that attribute as a logical dimension just for that attribute? Im not really sure this would work, as at the physical level the join between the dimension and fact would still have to go to only one particular fact table.
    Any info or help is much appreciated.

    Hi,
    Aggregate tables exist at physical level and are created by ETL procedures. Although i am aware that the dimension come into play when the application needs to decide which source aggregate table to use, it is not an issue here as in our query we are not involving dimensions. We are selecting just this one columen, and then the filter option on this column, then in the dialogue box we select 'All Choices', only the values from one of the source tables is being shown.
    This is not a probelm within reports, i think it is a product limitation in that in that option to list all values a user can filter by, it is not possible to display all the values from the different fact tables to which that column is mapped.
    Has anyone else encountered this behaviour?

  • How to create logical columns for current period and prior period

    Hello all.
    Is there any way in obiee to create a new logica column in BMM layer that says "CURRENT PERIOD" AND "PRIOR PERIOD" OR ONE SINGLE COLUMN THAT SAYS "PERIOD".
    In those columns what I need is if it a current period column it shoould have 03/01/2012-03/31/2012 (this month date range)
    and in prior period column I shouldhave 02/01/2012 -02/29/2012(which is previous month date range).These columns I will be using in my reports.
    Please help me if we can create any such columns with these conditions/requirements

    Hi,I have already created he dynamic variables.But I am not getting how to use those variables and create the new logical columns in bmm layer.
    this is what I am trying
    case when VALUEOF("Current Month begin date"."Current Month begin date") ='..' and VALUEOF("Current Month end date"."Current Month end date")
    ='..' then 'current period' end
    I don't really understand what I should write case when VALUEOF("Current Month begin date"."Current Month begin date") ='..'??

  • Store data in mysql after reading from excel files

    i am trying to make o program where i will read the data from excel files and i will store them in a database. I am using eclipse as editor and mySQL. I am using APACHE POI to read the excel files and JDBC for the connection. The excel files have the structure as shown below:
    ID NAME SALARY STREET
    321 TIM 1254 14 avenue
    121 PAUL 1265 28h oktovriou
    432 NICK 4521 papaflessa
    I have of course plenty of such files which contains many more rows and columns. The purpose of my program is to read the data, create table named as the name of the excel file and the fields of each table to be the first rows of the excel file. Afterwards the values will be the rest data of the excel file. In the code below i have managed to read them, show the data in the console. Afterwrds i am trying to call a database with JDBC but there i have problem when i create the table.
    try
    String[] allFields;
    String createTableStr = "CREATE TABLE" + createTableStr
    + "(" + org.apache.commons.lang3.StringUtils.join(allFields,
    ",") + ")";
    Could anyone help me?
    Thank you in advance!:)
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.commons.lang3.StringUtils;
    import org.apache.poi.ss.usermodel.Cell;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class exam1 {
    @SuppressWarnings({ "unchecked", "unchecked" })
    static void main (String[] args) throws Exception {
    String filename = "C:\\Users\\Efi\\Documents\\test5.xls";
    List sheetData = new ArrayList();
    FileInputStream fis = null;
    try {
    fis = new FileInputStream(filename);
    HSSFWorkbook workbook = new HSSFWorkbook(fis);
    HSSFSheet sheet = workbook.getSheetAt(0);
    Iterator rows = sheet.rowIterator();
    while (rows.hasNext()) {
    HSSFRow row = (HSSFRow) rows.next();
    Iterator cells = row.cellIterator();
    List data = new ArrayList();
    while (cells.hasNext()) {
    HSSFCell cell = (HSSFCell) cells.next();
    data.add(cell);
    sheetData.add(data);
    } catch (IOException e) {
    e.printStackTrace();
    } finally {
    if (fis != null) {
    fis.close();
    showExcelData(sheetData);
    @SuppressWarnings("unused")
    HashMap<String, String> tableFields = new HashMap();
    for (int i=0; i<sheetData.size();i++){
    List list = (List) sheetData.get(i);
    for (int j=0; j<list.size(); j++){
    Cell cell = (Cell) list.get(j);
    if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
    System.out.print(cell.getNumericCellValue());
    }else if(cell.getCellType()==Cell.CELL_TYPE_STRING) {
    System.out.print(cell.getRichStringCellValue());
    } else if(cell.getCellType()==Cell.CELL_TYPE_BOOLEAN) {
    System.out.print(cell.getBooleanCellValue());
    if (j < list.size() - 1) {
    System.out.print(", ");
    private static void showExcelData(List sheetData) {
    @SuppressWarnings("unchecked")
    private HashMap parseExcelData (List sheetData){
    HashMap<String,Integer> tableFields = new HashMap();
    List list = (List) sheetData.get(0);
    for (int j=0; j<list.size(); j++){
    Cell cell=(Cell) list.get(j);
    tableFields.put(cell.getStringCellValue(),cell.getCellType());
    return tableFields;
    @SuppressWarnings({ "unchecked", "unchecked", "unchecked", "unchecked", "unused" })
    private String getCreateTable(String tablename, HashMap<String, Integer> tableFields){
    Iterator iter = tableFields.keySet().iterator();
    String str="";
    String[] allFields = new String[tableFields.size()];
    int i = 0;
    while (iter.hasNext()){
    String fieldName = (String) iter.next();
    Integer fieldType=(Integer)tableFields.get(fieldName);
    switch (fieldType){
    case Cell.CELL_TYPE_NUMERIC:
    str=fieldName + "INTEGER";
    break;
    case Cell.CELL_TYPE_STRING:
    str= fieldName + "VARCHAR(255)";
    break;
    case Cell.CELL_TYPE_BOOLEAN:
    str=fieldName + "INTEGER";
    break;
    allFields[i++]= str;
    return str;
    public Connection getConnection() throws SQLException {
    try {
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/kainourgia","root", "root");
    Statement stmt = con.createStatement();
    try
    System.out.println( "Use the database..." );
    stmt.executeUpdate( "USE kainourgia;" );
    catch( SQLException e )
    System.out.println( "SQLException: " + e.getMessage() );
    System.out.println( "SQLState: " + e.getSQLState() );
    System.out.println( "VendorError: " + e.getErrorCode() );
    try
    String[] allFields;
    String createTableStr = "CREATE TABLE" + createTableStr
    + "(" + org.apache.commons.lang3.StringUtils.join(allFields,
    *",") + ")";*
    System.out.println( "Create a new table in the database" );
    stmt.executeUpdate( createTableStr );
    catch( SQLException e )
    System.out.println( "SQLException: " + e.getMessage() );
    System.out.println( "SQLState: " + e.getSQLState() );
    System.out.println( "VendorError: " + e.getErrorCode() );
    catch( Exception e )
    System.out.println( ((SQLException) e).getSQLState() );
    System.out.println( e.getMessage() );
    e.printStackTrace();
    return null;
    }

    Please don't multipost! Also crossposted: http://www.java-forums.org/jdbc/71612-store-data-mysql-after-reading-excel-files.html
    Mod: I'm locking this thread.

Maybe you are looking for

  • First Aid Failed in Disk Utility

    Ok, i heard it was one of those monthly things to verify and repair the disk if needed, and it won't let me, because it gets the error The underlying task reported failure on exit. What does that mean? and how do i just repair it, without verifying?

  • How to make the icons bigger in windows 8.1 64bit?

    i'm the new user of cs6. when I open the AI or photoshop, the icons are too small in left and right side. i tried to change the revolution but it still nothing change. anyone can help me?

  • Transfer Order using ALE

    Hi, What is the program/transaction for sending Transfer Order(Message Type WMTORD) using ALE. What is the program/transaction for sending Transfer Order Confirmation(Message Type WMTOCO) using ALE. What is the program/transaction for sending Transfe

  • I cannot installed Flash Player 8 (Error 1904)

    Hello i being using this computer for over a year and never had any problems. Until last month i was using the Msn video web site and it said i needed to installed my flash player, and it was weird cause i never uninstall it on the first place. So i

  • I can't open photoshop

    I downloaded photoshop, and it won't open