How to create a table using a variable or flat file ?

Hello All,
I want to create a table in which column names and data type will be read from a flat file or a variable.
How can i do this ? Any suggestations are appricaible.....
Regards,
Ashish

How about using this code.
Used Directory object EXT_DIR where the input file abc.txt is located with the below mentioned data
TABLE SANJ_TEST
SANJ_AB NUMBER(6)
SANJ_BC VARCHAR2(100)
Declare
v_file utl_file.file_type;
z varchar2(100);
v_cnt number :=0;
v_str Varchar2(1000) :='';
v_tab varchar2(40);
v_col varchar2(30);
v_data_type varchar2(30);
Begin
v_file := utl_file.fopen('EXT_DIR','abc.txt','r');
loop
utl_file.get_line(v_file,z);
if substr(z,1,5) = 'TABLE' then
if v_cnt <> 0 Then
v_str := v_str||')';
execute immediate v_str;
end if;
v_cnt := 0;
v_str := 'Create Table ';
v_tab :=Ltrim(Rtrim(substr(z,7)));
v_str := v_str||v_tab||'(';
Else
dbms_output.put_line('count in else start '||v_cnt);
v_col := ltrim(rtrim(substr(z,1,30)));
v_data_type := ltrim(rtrim(substr(z,31)));
if v_cnt=0 then
v_str := v_str||v_col||' '||v_data_type;
else
v_str := v_str||','||v_col||' '||v_data_type;
end if;
v_cnt := v_cnt+1;
End if;
End loop;
utl_file.fclose(v_file);
Exception
When NO_DATA_FOUND then
v_str := v_str||')';
execute immediate v_str;
dbms_output.put_line('In excep '||sqlerrm);
utl_file.fclose(v_file);
End;
/

Similar Messages

  • How to create a table using Text Layout Framework?

    How to create a table using Text Layout Framework? I meen real tables - like in HTML.

    Cell as indipendant TLF should work, I have created my table using same approach and works fine for me ... this is where it is
    http://apps.live-documents.com/docs/openWebDoc.do?docId=1480607
    Regards
    Raf

  • How to create a table with a variable

    Hi everyone!
    I have a procedure which receives a table name as a parameter and need to create a table using that name
    For example:
    PROCEDURE REFRESH_REPORTS (table_name varchar2) IS
    BEGIN
    table_name_REPORT := table_name;
    execute immediate 'create table table_name_REPORT .....
    But I don't get this working. I am just adding this procedure as a part of a package which is used for web/online reports.
    Could someone guide me on how I could create this table?
    I was getting errors like invalid table name and I even tried to use a variable which stores the entire sql statement and concatenated with the table name's variable but still that was not working.
    Thank You so much in advance.
    Nithya
    Edited by: user645399 on Jan 20, 2010 9:42 PM

    user645399 wrote:
    Thank You so much for the valuable feedback.
    My agency requires some reports to be generated at a certain interval, after a certain type of batch load. A few different types of reports will be generated and usually we have scripts which we run to generate the necessary tables and extract the reports from there. We retain the tables for verification purpose as it stores some valuable status of some customers and so on, which we will not be able to generate again easily. The table will have around 50,000 - 100,000 records averagely. Sometimes more.
    I am automating the process now as per client's request.
    So, I thought of using the same script to automate it in the web. For table name we usually changed them manually.
    Now, when the user runs, he or she have to give them table name/ report name.
    I thought of concatinating the sysdate and report name but what if there is a problem and the user runs it for a second time?
    Unless I have a separate part of the coding to take care of this issue.
    Please advice if there is an alternative.
    Thank You Very Much.
    Cheers!
    NithyaSo why is it necessary to create a table just to create a report?
    You really, really need to rethink this entire process from the beginning, not just try to shoehorn in something from a current, astoundingly bad, design.

  • How to create a table using subform if  lifecycle designer 7.1 not availabl

    hi,
    plis tell me how to create a table because i am using adobe lifecycle 6.1 and in the library
    there is no object for table..
    also tell me that if i have adobe lifecycle designer then which is better option and why?
    use table from library directly or create a table using subform...

    Hi Sweta,
    Create the interface attributes of type string and xtring type.
    Create node in the context of type graphics. bind the interface fields to the graphic node context element properties -
    Graphic content, field of xzstring type and mimetype to be string/any char data type of suitable length.
    In  layout drag and drop the image field and bind it to the graphic element.
    In yoour report programme-
    do the code as berlow to pass the graphic data -
    <i>CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
    p_object = 'GRAPHICS'
    p_name = '<mime type graphic name>'
    p_id = 'BMAP'
    p_btype = 'BCOL' "BMON if monochrome
    RECEIVING
    p_bmp = w_binary
    EXCEPTIONS
    not_found = 1
    internal_error = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.</i>
    in the call <form function module>
    pass the inerface values for
    xstring (graphic field) to be w_binary (import parameter of the previous method)
    and mime type  to be 'image/bmp'.
    This would work.
    Hope fully you may be able to see a tutorial on this soon ;).
    - anto.

  • How to create a table using polish

    I am able to show all the database records in table form but i want to edit a particular cell of the table, how to do that. thanks in advance.

    Cell as indipendant TLF should work, I have created my table using same approach and works fine for me ... this is where it is
    http://apps.live-documents.com/docs/openWebDoc.do?docId=1480607
    Regards
    Raf

  • How to create new table using pertioned table

    hi,
    i am using a partitioned table , now i want to craet a new table with same structure of my existing partitioned table.
    so can i use this syntax
    create table abc_new as
    select * from my_partitioned_table
    where 1=2;
    if i use this syntax would it make same structure of my existing partitioned table ?
    and
    when
    we use syntax like
    create table abc_new as
    select * from my_partitioned_table
    where 1=2;
    so would it make also indexing on new table to if old table exists ? if not so how can we create that indexing too at time of running this syntax ?
    reagrds

    No.
    Although the command would create a new table with the same column names and datatypes, it would NOT be a partitioned table. You must explicitly specify the PARTITION BY clause and Partition definitions when creating the table.
    Similarly, index definitions are not copied automatically. You must explicitly run the CREATE INDEX statements (which you can generate from the source using DBMS_METADATA.GET_DDL or using any other tools/utilities).
    (However, if you use Export-Import -- e.g. importing to another schema or to another database, it would create a partitoned table with the same name and with the same index definitions).
    Hemant K Chitale

  • How to create dictionary table using web dynpro?

    Dear Experts,
    Please clarify my doubts.Im new in this EP development.
    Im using EP6 portal with NWDS6 for dev.
    My Doubts are :
    Im trying to develop a web dynpro application which captures some data and insert/update in Table.
    => If we create a structure Dictionary in web dynpro application will that automatically create the table in Portal database?
    => If it is automatically created how to insert or update that table.
    can any one plz help.
    thanks and regards,
    Viswes.

    Hi Visweswara
    This will use the concept of EJB.
    Refer these for creating Dictionary tables...
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70929198-0d36-2b10-04b8-84d90fa3df9c]
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c]
    As far as answer to your second question is concerned,
    => If u create a structure Dictionary in web dynpro application  it will not create the table in Portal database..
    You can access that table via creating a web dynpro iview in Portal..
    Only application can accessed after deployment via iviews in Portal..
    Thanks...
    Rewards Appreciated...

  • How to create a dynamic SSIS package for multiple flat file destinations

    Hi,
    I have to create a ssis package which has single data flow task and inside that I have 23 source (sql- select * from - statements)- destination (flat files, 23 distinct) connection.
    Now for each product I have to create separate SSIS package (i.e. if prod=abc then these read select * from abc_tables and 23 abc_ txt files)
    I want to do it dynamically, means only single package and inside that variables will take select * values for each source-dest connection (so i believe 23 variables) and same for destination flat files.
    Let me know. :)
    ANK HIT - if reply helps, please mark it as ANSWER or helpful post

    Sorry It seems you're contradicting yourself. you say I know my source and dest structure and the you're
    asking all I want is to have a dynamic structure
    what does that mean?
    and reading your next sentence
    I want to run a package for 5 products, instead of creating 5 ssis packages with 23 source- dest connection, I would
    like to have one with only 23 source- dest connections 
    What I feel is what you're looking for is to  have a looping structure to loop through each of the 5
    products.
    In that case what you could do is this
    1. Create a object variable in SSIS 
    2. Use a Execute SQL Task to populate the variable with all available products (I think you'll have a master table for that). Set ResultSet property to Full ResultSet and then in ResultSet tab map Object variable to 0 th index
    3. use a ForEachLoop container with ADO .NET recordset enumerator and map to object variable. Create a variable of datatype same as that of Product identifier field to get individual values out
    4. Inside loop create your data flow task with 23 source destination connection. In the query part use a parameter for product field and map it to the variable containing product value to get only data for the product.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to create dynamic table using POJO based DataControl

    Hi,
    I'm using JDeveloper 11.1.1.5.0. I'm not using ADF BC.
    I've a requirement to display the Dynamic table in my search page.
    In our product we are using POJO based Data controls.
    I created a task-flow and page fragment. I tried to create the dynamic table by drag-drop of searchResults from my Data control, I see the option for Read-Only Dynamic Table, but when I select this option, I don't see anything happening.
    Does the Dynamic Table work with POJO data controls?
    Any inputs would be helpful.
    Thanks
    Ravi

    First U have to crate Extended View Object to your actual View obj.
    Now take Page with Panel  Splitter ,on First facet drag View obj as table and on second Facet Drag Extended View Obj as table.On page loading U have delete all rows from Extended View object.And then u have write bean code on button click to get current select rows from above view objct,and for Filter rows from Second View obj according to selection of rows from first view obj...

  • How to create a table using blob datatype and then selecting the output???

    I have created table
    create table imgloader(img_l blob);
    now i want to insert the image i.e. '/u1/archie.jpg' to this table
    what steps to be follwed to insert the image into table..and how to see the stored image??

    Is GOOGLE & SEARCH broken for you?
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:392618837633

  • How to create dynamic connection string with variables using ssis.

    Hello,
    Can anyone let me know on how to create dynamic connection string with variables using ssis?
    Any help would be appreciated.

    Hi vinay9738,
    According to your description, you want to connect multiple database from multiple servers using dynamic connection.
    If in this case, we can create a Table in our local database (whatever DB we want) and load all the connection strings.  We can use Execute SQL Task to query all the connection strings and store the result-set in a variable of object type in SSIS package.
    Then use ForEach Loop container to shred the content of the object variable and iterate through each of the connection strings. And then Place an Execute SQL task inside ForEach Loop container with the SQL statements we have to run in all the DB instances. 
    For more details, please refer to the following blog:
    http://sql-developers.blogspot.kr/2010/07/dynamic-database-connection-using-ssis.html
    If there are any other questions, please feel free to let me know.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to create a table in the file using java code.?

    HI,
    I should export the data from the view objects to a word document. I have done that but I should
    display the data in the form of a table.
    Kindly come up with the necessary information on how to create a table in the file using java.
    Thanks,
    Phani

    Hi, Thank you for responding to my query.
    The below are the details of my code.
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding StudentDetailsContent =
    (DCIteratorBinding)dcBindings.get("StudentView1Iterator");
    OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
    Row currentRow =
    StudentDetailsContent.getRowSetIterator().first();
    Object a[]= currentRow.getAttributeValues();
    int i;
    for(i=0 ;i<=a.length;i++){
    w.write(a.toString());
    w.write(" ");
    w.flush();
    I am usning this coding to achieve the task of exporting data to file.
    I need to display this information in the table that is where I need help from you people.
    Thanks,

  • How to create a table to use in webdynpro ABAP

    Hi Guys,
    Can anybody let me know how to create a table to use in webdynpro ABAP. I am new to ABAP. It would appreciable if i get useful answer.  Thanks In Advance
    Regards
    Ravi

    Hi! You can use transaction code SE11.  Please refer to http://help.sap.com/saphelp_nw70/helpdata/en/6c/f2934259a5c66ae10000000a155106/frameset.htm
    Please note that table name should start with 'Y' or 'Z' - by SAP naming conventions object names starting with 'Y' and 'Z' are reserved for customer application development.
    Please reward points if helpful

  • I am using iPad pages, and figuring out how to create a table of content.

    Hello
    I am using pages on my iPad Air, and figuring out how to create a table of content? (TOC)
    Anyone can help me please?

    Based on what I have found, at this time, it appears that the only way to add a TOC or Bibliography to a Pages file is via Pages for MAC. Once that is done, you can automatically add entries in Pages for iOS. But you cannot initially add the element.
    It is not out of the question that there are some templates for Pages for iOS available that already have these added and available - but I cannot say first hand. All of the built in templates for iOS appear to be for short format documents and I have yet to find one that includes the TOC or Bibliography.

  • How to create the Table of Content (TOC) in WEB

    Dear Sir
    Please help me
    How to create the Table of content (TOC) in Web Intelligence Report,
    Thanks
    Gnanasekarn.K
    Edited by: Gnanasekaran Kandasamy on Nov 20, 2008 11:12 AM

    Hi Gnanasekarn,
    You can create TOC in webi using Open Document, You can create link on the TOC and you can connect that link to open new report .
    With the help of open document you can open the specific portion of report.
    So you can achive your requirement using URL reporting or Open Document.
    Regards,
    Chaitanya Deshpande

Maybe you are looking for

  • Camera raw not working and updates not working

    I have just re installed CS5 Extended after a system disc failure. Photoshop works but when I try to open raw files I get a message to say my camera is not supported (Canon550D. It was of course working previously) I have tried updating the software

  • Tables Proration/Spliting Logic required

    Hi Friends I have 3 internal tables: IT_0001: PERNR     BEGDA     ENDDA     WERKS     BTRTL     ABKRS     KOSTL     ORGEH 10774     20080101     20081028     US11     14     CB          0 10774     20081029     99991231     US11     14     CB     112

  • Mountain Lion Bug with Late 2008 15" Macbook Pro

    While draging any type of file from one place to another it seems as if my mouse sticks when i let go of the button. My track pad is not broken because I grabed a Magic mouse, and still same problem. The only way to fix this I have found is relaunchi

  • Thinking of getting a playbook!

    Hi I am thinking of getting a playbook but have a few basic questions: Can you link or bridge more than 1 bb phone to it? Can you watch 'sky go' and download sky go movies/programmes on to it? Can you use skype on it? And what is the battery life tim

  • Getting Houston weather on the weather widget

    I want to get the dashboard to show me weather in Houston, but I can't seem to figure out how to do that. Can someone give me a clue?