Dynamic table o in procedure

HELLO ALL,
I have a procedure to work with tables and i pass table names to it.
in this proc i need to have some variable with type of columns of each table.
who can help me?

i pass table names to the procedure and create dynamic cursor to fetching data.
then I must having variable with type of each column to assign content of column to the variable.
supose i have table ABC with columns " id namber, name varchar2(100), bdate date"
i want after i pass name of this table to my proc, the proc determine type of columns of the table and define variables with their types.

Similar Messages

  • Procedure for creating dynamic table

    Hi! I'm having a problem with creating a table with the help of procedure. The thing is, I want to pass an (possibly an array of) unknown amount of values - column names, types - to the procedure, that I defined, and then be able to create a (temporary) table with the received data. Possible? Maybe you could give me some hints - any help appreciated.

    899749 wrote:
    Yes, not literally there are million fields, of course :) What I was trying to say -> there are too much fields to create a hidden field array each time, and honestly I don't like this because of content availability through source code.Statement does not make sense.
    If there are too many "fields" (databases have tables and rows and columns - not fields), then how does introducing a new database table reduce these? It is far simpler to only select the rows required, the columns needed for display, and building a "field array" using that - assuming that your definition of such an array matches mine...
    Besides the saneness and logic of using dynamic tables, there are performance considerations. The slowest and most expensive database operation is I/O.
    So what is your justification to spend a lot of I/O on duplicating existing data in the database? Why read data from tables to create so-called dynamic tables? Is that the best spend of database resources?
    Don't know what forms you were talking about - the idea is to possibly use some programming (like php) + html to create a dynamic form. That's why I need a dynamic temporary table to pass the content around (no sessions, please).Forms are typically not dynamic. You do not point code at some arbitrary table structure and say "+form instantiate thyself+". This code will not understand the business rules and validation rules for properly displaying a data entry form for that entity, and applying the rules and logic for processing entered data and storing that in the table.
    Forms are usually (almost always) coded as static - the entry fields are known at design time. The validation rules are known. The business logic to apply is known.
    That begs the question as to not only what you are trying to do (it does not make sense!), but also why? What are the business requirements that need to be met?

  • Using a dynamic table variable in a stored procedure

    SQL Server can do this where you declare a table variable and insert / modify / delete rows in that table without it ever being actually ON the database.
    Can Oracle do this?
    I know I can do things like pass in a unique user id, create the table in the procedure with the user ID appended, etc ...
    but this procedure is going to be accessed via two modes, a batch job as well as online. The batch job may run this procedure 500 times.
    What I'm trying to is figure out a way to return a recordset of errors that occured in the job, simple, 3 lines like so:
    LineNumber NUMBER,
    Severity VARCHAR(10),
    Error_Msg VARCHAR(200)
    is there any 3 dimensional way of storing these records when the errors occur, then returning them as a select statement at the end of the procedure?
    Thanks,

    Why not create a table
    CREATE TABLE error_log (
      job_id  NUMBER,
      line_number NUMBER,
      severity VARCHAR2(10),
      error_msg VARCHAR2(200)
    CREATE SEQUENCE seq_error_log_job_id
      START WITH 1
      INCREMENT BY 1
      CACHE 100;In your procedure, you would get a new job_id from the sequence, insert whatever records you want in the error log table using that job_id and then return a REF CURSOR where you select from the error_log table using the job_id.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Execute Dynamic SQL statement using procedure builder

    i want to execute a dynamic SQL statment using procedure builder not using forms
    because my statement depending on a variable table name
    i know that i can do that from forms using
    FORMS_DDL('SQL_STAT');
    but i wanna to use the procedure builder
    which function i should use and how?
    please explain in example if you don't mind.
    thanks

    Hi,
    You can very well use DBMS_SQL Package supplied by Oracle for doing this.
    Search for DBMS_SQL in OTN. You will get all info regarding this.
    Regards.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by itslul:
    i want to execute a dynamic SQL statment using procedure builder not using forms
    because my statement depending on a variable table name
    i know that i can do that from forms using
    FORMS_DDL('SQL_STAT');
    but i wanna to use the procedure builder
    which function i should use and how?
    please explain in example if you don't mind.
    thanks<HR></BLOCKQUOTE>
    null

  • Dynamic Select Query including Dynamic Tables with For all Entries

    Hello everyone,
    I need to create a select query which involves using of Dynamic Tables.
    Suppose I have a dynamic table <d1> which consist of let say 10 records.
    Now i need to make a select query putting data into another dynamic table <d2>
    CONCATENATE keyfield '=' '<d1>' INTO g_condition SEPARATED BY space.
    CONCATENATE g_condition '-' keyfield INTO g_condition.
    SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <d1>
            FOR ALL ENTRIES IN <d1>
    WHERE (g_condition).
    But it is giving dump.
    Please help me on this....

    Short text
        A condition specified at runtime has an unexpected format.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "ZNG_CUSTOMWRITE" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
         not caught in
        procedure "WRITE_ARCHIVE_PROD" "(FORM)", nor was it propagated by a RAISING
         clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The current ABAP program has tried to execute an Open SQL statement
        which contains a WHERE, ON or HAVING condition with a dynamic part.
        The part of the WHERE, ON or HAVING condition specified at runtime in
        a field or an internal table, contains the invalid value "ZCOURIER-ZCOURIERID".
    CONCATENATE keyfield '=' g_header INTO g_condition SEPARATED BY space.
    CONCATENATE g_condition '-' keyfield INTO g_condition.
    SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <dyn_table1>
    FOR ALL ENTRIES IN <dyn_table>
      WHERE (g_condition).

  • Dynamic Cursor in a procedure

    Hi,
    I am using 10g and wanted to check if we can use a dynamic cursor in a procedure.
    Following is my code and wanted to see if that can work with every query passed as a parameter.
    example ,
    exec test1 ('select col1, col2, col3 from table1','Two columns Sql')
    exec test1 ('select col1 from table2','one columns Sql')
    exec test1 ('select col1, col2, col3, col4, col5 from table3','Five columns Sql')
    CREATE OR REPLACE procedure test1 (p_sql IN VARCHAR2, p_subject IN VARCHAR2
    is
      v_cu_string       VARCHAR2(2000);
      v_string          VARCHAR2(2000);
      v_sql             VARCHAR2(4000);
      v_head            VARCHAR2(4000);
      v_head_sql        VARCHAR2(4000);
      v_str_sql         VARCHAR2(4000);
          TYPE cv_typ IS REF CURSOR;
          cv cv_typ;
    begin
      v_sql := p_sql;
        OPEN cv FOR v_sql;
           LOOP
             FETCH cv INTO v_cu_string;
             EXIT WHEN cv%NOTFOUND;
            ------ Processing steps
          END LOOP;
          CLOSE cv;
    END;Thanks

    user527060 wrote:
    Following is my code and wanted to see if that can work with every query passed as a parameter.
    Just curious as to why this is an improvement of
    exec test1 ('select col1, col2, col3 from table1','Two columns Sql')
    select col1, col2, col3 from table1And
    exec test1 ('select col1 from table2','one columns Sql')
    select col1 from table2And
    exec test1 ('select col1, col2, col3, col4, col5 from table3','Five columns Sql')
    select col1, col2, col3, col4, col5 from table3It needs more code from you to build, more code for anyone to enter to execute, limits selects to only one table I would guess also comes with less documentation than SQL.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm

  • Dynamic tables

    Hi All,
    I have a form where i have four dynamic tables one after
    other, i want the header and body to show up atleast one even
    when there is no data flowing in to the table fields, is it possible,..?
    i have tried doing a dynamic table and a text field wrapped in a subform(S1)  and that subform in turn  wrapped in other subform(S2) to make S1 flowable.
    for Table1 i have checked Repeat Table for each data item, Min count = 1, Initial count =1 ;
    i did the same for all the 4 subforms,
    but only the first and last subfor sshow up the tables in them the rest only show text field i have included in each subform,
    does anyone have an idea on this as to how to get this done..
    Thank u all in advance.
    de1209

    Subramanian
    you can achieve that with the feature in oracle called DYNAMIC SQL
    for example see the following code
    declare
    sql_stmt     varchar2(200) := '&enter_stmt';
    cur_num     number;
    temp_num     number;
    begin
    cur_num := dbms_sql.open_cursor;
    dbms_sql.parse(cur_num,sql_stmt,dbms_sql.native);
    temp_num := dbms_sql.execute(cur_num);
    dbms_sql.close_cursor(cur_num);
    end;
    19:01:11 11 /
    Enter value for enter_stmt: create table aug(n number)
    old 2: sql_stmt varchar2(200) := '&enter_stmt';
    new 2: sql_stmt varchar2(200) := 'create table aug(n number)';
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.22
    19:01:33 SQL> desc aug
    Name Null? Type
    N NUMBER
    with this you should get some idea .
    Only thing is just you need to design your application carefully and then there you are .
    hope this helps
    cheers
    prakash
    [email protected]

  • Using temporary tables in stored procedures

    Suppose that I have created a temporary table in a stored procedure using an "EXECUTE IMMEDIATE" statement. When I compile the procedure, that table is not created yet, so the compiler says that the table does not exist.
    What is the way of using temporary tables in stored procedures?

    It's a good practice to avoid using DDL statements being executed from stored procedures. "Truncate Table" via dynamic SQL from stored procedure is a different story and is useful in DSS environments.
    But if you insist on "creating" tables using Dynamic SQL from Stored Procedures then you must also embed your DML statements in Dynamic SQL to avoid compilation errors.
    Example:
    Create or Replace Procedure Proc_TestDynamicSQL is
    Begin
    Execute Immediate 'Create table myTable as select * from user_tables' ;
    Execute Immediate 'Update myTable set table_name = ''Test'' ' ; --two single quotes before and after the string "Test"
    End;
    In this case, Oracle wouldn't care about the table references during compilation.

  • Dynamic table name - error

    After run (or test) of procedure
    create or replace procedure tmp_select_dymanic
    ( AInTable IN VARCHAR2,
    ACount OUT NUMBER
    ) as
    begin
    EXECUTE IMMEDIATE 'BEGIN SELECT count(*) INTO :Count FROM :InTable END;'
    USING ACount, AInTable;
    end tmp_select_dymanic;
    error message: invalid table name.
    I know the table exists and contains data. I can make SELECT in SQL (not dynamic).
    What a reason for error? May be privileges in database? But i make SELECT on my own table?
    How can i set dynamic table name in other way?
    My Oracle Version 10g.

    What you are asking can be done by REF_CURSOR;
    look this example and try your self the rest:
    CREATE OR REPLACE PROCEDURE insert_to_table_dinamic (
       table1   IN   VARCHAR2,
       table2   IN   VARCHAR2
    AS
       rc         sys_refcursor;
       v_sql      VARCHAR2 (2000);
       v_deptno   NUMBER;
    BEGIN
       v_sql :=
             'SELECT DEPTNO FROM '
          || table1
          || ' WHERE ROWNUM = 1 AND DEPTNO IS NOT NULL';
       OPEN rc FOR v_sql;
       LOOP
          FETCH rc
           INTO v_deptno;
          EXIT WHEN rc%NOTFOUND;
          v_sql :=
                'UPDATE '
             || table2
             || ' SET DEPTNO = '
             || v_deptno
             || ' WHERE DEPTNO IS NULL';
          EXECUTE IMMEDIATE v_sql;
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
    END insert_to_table_dinamic;when i give DEPT , EMP as my 2 parameters above code will set the deptno in EMP table where deptno is null;
    --Just a test proc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Making cell non editabale (of dynamic table) in alv

    Hi,
    I am working on a editable alv with a dynamic table <itab> .This table gets populated during runtime.Now I want to make few cell of this table not editabale (only few cell not the full columns) I knwo that the procedure is to
    declare my outtab like
    TYPES: BEGIN OF gs_outtab.
    TYPES: celltab TYPE lvc_t_styl.        "field to switch editability
            INCLUDE TYPE /npu/edmt_aa_eac.
    TYPES: END OF gs_outtab.
    and in the celltab i pass the information of cells which will be non editable...But the problem is as my outtab is a dynamic table I cannot INCLUDE IT IN ANOTHER types.
    Please help me how to do it???? Or is there any other way of doing it???

    Hi Priya
    Add the field of type lvc_t_styl while creating the field catalog.
    Now
    DATA lo_table TYPE REF TO data.
      cl_alv_table_create=>create_dynamic_table(
        EXPORTING
          it_fieldcatalog = lt_fieldcat  "the field catalog table
        IMPORTING
          ep_table = lo_table ). "the reference to the table gt_outtab with the style tab
    FIELD-SYMBOLS <tab> TYPE ANY TABLE.
    ASSIGN lo_table->* TO <tab> .
    Now you can fill your <tab>.
    Pushpraj

  • Dynamic Table data cannot be Read.

    Hello,
           I have an Adobe Interactive form and I am trying to read the data from the Dynamic Table I have in the Form. The Problem is when I try to read the data using the below code, the data which is entered by user data cannot be read for some reason.
    navigate from <CONTEXT> to <ADR_DATA> via lead selection
      lo_nd_adr_data = wd_context->get_child_node( name = wd_this->wdctx_adr_data ).
    navigate from <ADR_DATA> to <PREV_EMPLOYMENT> via lead selection
      lo_nd_prev_employment = lo_nd_adr_data->get_child_node( name = wd_this->wdctx_prev_employment ).
    get element via lead selection
      lo_el_prev_employment = lo_nd_prev_employment->get_element(  ).
    get all declared attributes
      "lo_el_prev_employment->get_static_attributes_table(
      lo_nd_prev_employment->get_static_attributes_table(
       IMPORTING
         table = form_data-prev_employment ).
    I have:-
    1. Checked the Binding on Adobe Form
    2. Checked the Context for the same.
    3. Checked the Cardinality of the Nodes.
    Please let me know in case i am missing something.
    Regards,
    Shishir.P

    Hello,
         I have tried other method as well but was unsucessful, the procedure is below:-
    1. Get PDF content of online form by reading the context.
    2. Convert this data to XML
          l_fp = cl_fp=>get_reference( ).
          l_pdf = l_fp->create_pdf_object( ).
          l_pdf->set_document( pdfdata = pdf_data ).
          l_pdf->set_task_extractdata( ).
          l_pdf->execute( ).
          l_pdf->get_data( IMPORTING formdata = l_xstring ).
          CLASS cl_ixml DEFINITION LOAD.
          DATA: g_ixml TYPE REF TO if_ixml,
                streamfactory TYPE REF TO if_ixml_stream_factory,
                istream        TYPE REF TO if_ixml_istream,
                document TYPE REF TO if_ixml_document,
                parser TYPE REF TO if_ixml_parser.
          g_ixml = cl_ixml=>create( ).
          streamfactory = g_ixml->create_stream_factory( ).
    wrap the table containing the file into a stream
          istream = streamfactory->create_istream_xstring( l_xstring ).
          document = g_ixml->create_document( ).
          parser = g_ixml->create_parser( stream_factory = streamfactory
                                          istream        = istream
                                          document       = document ).
          parser->parse( ).
    3. Read the data from the XML. (I was able to extract other data on the form but not the one in the table. The data entered in the table row in the interactive form is not getting converted into XML or not being extracted in PDF at all).
          form_data = get_adr_from_xml( document ).
    The Code Wizard is an old one and does not support table operations as the new code wizard. Please let me know in case you have any other method of resolving this issue.
    Please let me know your work around, I am in desparate need for a solution.
    Regards,
    Shishir.P
    Edited by: Shishir Paltanwale on Apr 21, 2010 8:16 PM

  • (Urgent) Dynamic Table Name

    Hi Fellows,
    Can I use dynamic table name in a loop? I have a problem that I want to use variable table in a cursor for example
    procedure check_rows as
    cursor c1 is
    select view_name
    from user_views;
    v_count number;
    v_view_name varchar2(35);
    begin
    for i in c1 loop
    select count(*)
    into v_count
    from i.view_name;
    if v_count = 0 THEN
    dbms_output.put_line ('The View '&#0124; &#0124;i.view_name&#0124; &#0124;' has no rows');
    end if;
    end loop;
    end;
    but i receive a message
    i.view_name must a name of a table to which the user has access.
    Can anybody solve my problem.
    Thanks in advance
    Mustafa

    Here is some codes I wrote with DBMS_SQL. I hope it will help you to start.
    PROCEDURE Get_record(p_select IN OUT select_rec, where_str IN OUT varchar2) IS
    my_keyblk varchar2(6);
    veh_id integer;
    ser_date date;
    succ_flag number;
    blk_route varchar2(4);
    blk_run integer;
    my_date_type integer;
    cur_blk_route INTEGER;
    rows_processed INTEGER;
    ignore integer;
    select_str varchar2(3000);
    First_date date;
    Last_date date;
    BEGIN
    begin
    select start_date, end_date into first_date, Last_date from change_date
    where current_next_code = 'CURRENT';
    exception when others then
    null;
    end;
    select_str := 'select keyblock, keycoach, proflag, pullout_date
    from logblock
    where (pullout_date between first_date and Last_date)
    and proflag = 0';
    cur_blk_route := dbms_sql.open_cursor;
    dbms_sql.parse(cur_blk_route, select_str, dbms_sql.v7);
    dbms_sql.define_column(cur_blk_route, 1, blk_route, 6);
    dbms_sql.define_column(cur_blk_route, 2, blk_run);
    dbms_sql.define_column(cur_blk_route, 3, veh_id);
    dbms_sql.define_column(cur_blk_route, 4, ser_date);
    ignore := dbms_sql.execute(cur_blk_route);
    LOOP
    if (dbms_sql.fetch_rows(cur_blk_route) > 0) then
    dbms_sql.column_value(cur_blk_route, 1, blk_route);
    dbms_sql.column_value(cur_blk_route, 2, blk_run);
    dbms_sql.column_value(cur_blk_route, 3, veh_id);
    dbms_sql.column_value(cur_blk_route, 4, ser_date);
    else
    dbms_output.put_line('ERROR ');
    end if;
    END LOOP;
    dbms_sql.close_cursor(cur_blk_route);
    END Get_record;
    end apc_block_assign;
    null

  • Send multiple rows to database from a dynamic table.

    I'm using JSP for my application. I have a table that changes
    in size depending on a value a user selects in a drop down list.
    They can then enter some values into the table and click the submit
    button. I know for whatever reason Dreamweaver only sends the first
    row to the database and I've had a hard time finding good
    examples/tutorials showing how I could make it send all the rows to
    the database.
    Is there a way for me to just do a while/for loop taking into
    account the number of rows in the table? That would be ideal for me
    as it sounds like the simplest method and I'm very new to web
    development.
    Should I be using the Server Behavior Builder or a Stored
    Procedure and if so is there any good examples for those as I've
    had a hard time working with any documentation/tutorials I've found
    regarding them.
    Any help would be greatly appreciated.

    Hey Baxter, thanks for the response. I guess I should have
    been more specific when I said I was new to Web Development. I am
    actually in Software Development where I primarily code in Java and
    other OO languages. I have worked with a database before in java by
    writing my own servlet. I have also done some HTML so jsp is very
    good for me as it is mostly java with the odd bit of html
    structuring with tables and such.
    Languages like PHP and ASP I am not very familiar with and
    most of the solutions I find for this very problem revolve around
    ASP. I have just found it very hard to find a solution to this
    problem. It seems like it isn't talked about very much even in
    Dreamweaver's own documentation. If a stored procedure is the only
    way to go then I think I can handle it with some guidance if anyone
    knows of some tutorials/examples available.
    Also is it really not possible to just go into the code and
    somehow make it loop through each row in the table and execute a
    prepared statement for each row? I've included some code of the
    dynamic table I have and as you can see I have a Submit button on
    its own outside of the table. If i had it inside then the user
    would have to submit each row individually which isn't realistic
    when there are many rows of data. Since the Submit is outside of
    the while it only gets called once after the table is populated
    thus sending only one row of data.
    You might want to copy paste the code into a text editor as
    some of the lines are long and may be hard to read here. If you
    notice any errors in the table itself like mismatching column
    headers it is because I changed some column names before attaching
    it here so just assume that the table is all built correctly.
    PS: I am going to be out of town for five days or so, so if I
    don't reply to you right away don't think I disappeared from this
    thread. Thanks again.
    <div>
    <h2>TableData</h2>
    <form ACTION="<%=MM_editAction%>" METHOD="POST"
    name="tabledata">
    <table>
    <% if (!Recordset1_isEmpty ) { %>
    <tr>
    <td class="head">Name1</td>
    <td class="head">Name2</td>
    <td class="head">Name3</td>
    <td class="head">Code1</td>
    <td class="head">Code2</td>
    <td class="head">Old Status1</td>
    <td class="head">New Status1</td>
    <td class="head">Old Status2</td>
    <td class="head">New Status2</td>
    <td class="head">Year</td>
    </tr>
    <% } /* end !Recordset1_isEmpty */ %>
    <% while
    ((Recordset1_hasData)&&(Repeat1__numRows-- != 0)) { %>
    <% if (szin11 ==2) {color11 = "#ECECEC" ;szin11=(0);}
    %><tr>
    <td><input type="hidden"
    value="<%=((((Recordset1_data =
    Recordset1.getObject("Name1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="Name1"
    /><%=(((Recordset1_data =
    Recordset1.getObject("Name1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <td><input value="<%=((((Recordset1_data =
    Recordset1.getObject("Name2"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="Name2"
    type="hidden" /><%=(((Recordset1_data =
    Recordset1.getObject("Name2"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <td><input value="<%=((((Recordset1_data =
    Recordset1.getObject("Name3"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="Name3"
    type="hidden" /><%=(((Recordset1_data =
    Recordset1.getObject("Name3"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <input name="Code1" type="hidden"
    value="<%=(((Recordset1_data =
    Recordset1.getObject("Code1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%>" />
    <td><input value="<%=((((Recordset1_data =
    Recordset1.getObject("Code2"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="Code2"
    type="hidden" /><%=(((Recordset1_data =
    Recordset1.getObject("Code2"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <td><input value="<%=((((Recordset1_data =
    Recordset1.getObject("Old Status1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="Old Status1"
    type="hidden" /><%=(((Recordset1_data =
    Recordset1.getObject("Old Status1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <td><input size="10"
    value="<%=((((Recordset1_data = Recordset1.getObject("New
    Status1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="New Status1"
    type="hidden" />
    <%=(((Recordset1_data = Recordset1.getObject("New
    Status1"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <td><input name="New Status1" type="text" size="5"
    /></td>
    <td><input size="10"
    value="<%=((((Recordset1_data = Recordset1.getObject("Old
    Status2"))==null ||
    Recordset1.wasNull())?"":Recordset1_data))%>" name="Old Status2"
    type="hidden" />
    <%=(((Recordset1_data = Recordset1.getObject("New
    Status2"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></td>
    <td><input name="New Status2" type="text" size="5"
    /></td>
    <td><%=(((Recordset1_data =
    Recordset1.getObject("Year"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%>
    <input name="Year" type="hidden"
    value="<%=(((Recordset1_data =
    Recordset1.getObject("Year"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%>"
    /></td></tr>
    <% if (szin11 ==0) {color11 = "#FFFFFF"; szin11=(0);}
    %>
    <% szin11++; %>
    <%
    Repeat1__index++;
    Recordset1_hasData = Recordset1.next();
    %>
    </table>
    <p>
    Comments<br />
    <textarea name="comments" cols="40"
    rows="4"></textarea>
    </p>
    <p>
    <input type="submit" value="Submit" />
    </p>
    <input type="hidden" name="MM_insert" value="tabledata"
    />
    </form>
    </div>

  • Filling dynamic table with dynamic structure en fields!

    Hello All,
    I have written the following code. Which is okay according the syntax check. But when I run the abap code it will give a syntax error. I want to insert data from database table into internal table. Because the tables that have to read are so many I decided to make a dynamic statement which can be used for all tables. Except it won't work as I wish.
    (LT_FIELDS) content is the dynamic fields which are defined earlier in the code and will change each loop.
    (TAB_X) content is the dynamic internal table which is defined earlier in the code and will change each loop.
    = structure of PA0002.
    (TAB_N) = T_PA0002.
    The code:
              SELECT (LT_FIELDS) FROM (TAB_X) INTO CORRESPONDING FIELDS OF .
              ENDSELECT.
    Can someone give me some advice how to solve this issue?
    During the run at the line "INSERT (TAB_N) FROM . " SAP creates an error like below.
                                                                                    K. tekst                                                                               
    Ein in einem SQL-Befehl genannter Tabellenname ist unbekannt.                                                                               
    Wat is er gebeurd?                                                                               
    Error in ABAP application program.                                                                               
    The current ABAP program "ZPF_R_MUTATIEOVERZICHT_MAIA" had to be terminated                 
         because one of the                                                                         
        statements could not be executed.                                                                               
    This is probably due to an error in the ABAP program.                                                                               
    Foutenanalyse                                                                               
    Es ist eine Ausnahme aufgetreten, die weiter unten näher erläutert wird.                    
        Die Ausnahme, der die Klasse 'CX_SY_DYNAMIC_OSQL_SEMANTICS' zugeordnet ist,                 
        wurde nicht abgefangen und führte deshalb zu einem Laufzeitfehler.                          
        Der Grund für die Ausnahme ist:                                                                               
    In einem SELECT-, UPDATE- oder DELETE-Befehl wurde ein ungültiger                           
        Tabellenname "T_PA0002" angegeben.                                                          
        Aus einem der folgenden Gründe tritt der Fehler erst zur Laufzeit auf:                      
        - der Tabellenname wurde dynamisch angegeben, oder                                          
        - die SELECT-Klausel, WHERE-Klausel, GROUP-BY-Klausel, HAVING-Klausel                       
          oder ORDER-BY-Klausel wurde dynamisch angegeben.

    I Just want to insert data into internal table T_PA0002 from database table PA0002.
    The internal table and database table can change during the runtime of the program. But Its always filling the internal table with data from database table.
    I made it this way because the data I need to extract from data base tables can change depending on the procedures in table T9VS2.
    So I can't know the structure or the table which has to be selected each procedure. Or I have to make a big program with a lot of if or Case statements in it. I want to avoid that! Dynamic table is much quicker to write and understand when it works.
    It wil reduce a lot of code!  I hope someone can give me a hint to solve the problem.

  • Create Table in a Procedure?

    Hey everybody!
    got a question... I would like to create a table within a procedure with a dynamic number of rows. The Input of the Procedure should be a number, and this number should determine the number of rows. Thought about something like this:
    create_table(3)
    -> rows: Seq_nb, Z1_Air, Z1_Gas, Z1_Time, Z2_Air, Z2_Gas, Z2_Time, Z3_Air, Z4_Gas, Z3_Time
    is this possible to do? All Tries to make a CREATE TABLE within the Procedure didn't work. Also, it seems to be difficult to name a row like 'Zx_Gas', x := Number
    I don't mean a temporary table, it should be a REAL table ;)
    Anybody who could help me please? Thanks in advance!!

    Is this the one you are trying to get?
    create or replace procedure create_table(num_of_cols in number) is
    num number;
    stmt varchar2(400);
    begin
    num:=num_of_cols;
    execute immediate 'drop table test_tab';
    stmt:='create table test_tab(constant_cols varchar2(30)';
    for i in 1.. num
    loop
    stmt:=stmt||', Z'||i||'_Air varchar2(30)';
    stmt:=stmt||', Z'||i||'_Gas varchar2(30)';
    stmt:=stmt||', Z'||i||'_Time varchar2(30)';
    end loop;
    stmt:=stmt||')';
    execute immediate stmt;
    end;

Maybe you are looking for