Dynamic column names

I created a line chart with the following sql statement:
select null link, periode_jaar, sum(totaal) total from V_KPL_VZ_OWB@rapportage_dwhtest
where periode_jaar = (Select max(periode_jaar) from V_KPL_VZ_OWB@rapportage_dwhtest)
group by periode_jaar
order by periode_jaar
In the legend of the chart the line is named total. I would like have it named for example: Total 2009
So how i create the dynamic column? Any ideas? Tnx in advnaced

tnx for helping, i posted my xml code below where to put the tag: <format>{%Name} ({%Value})</format>
i assume i have to replace %Name with my sirie name and the %Value with the name i wanted?
Is it possible to replace %Value with an item like :p1_year
&#60;?xml version = "1.0" encoding="utf-8" standalone = "yes"?&#62;
&#60;root&#62;
&#60;type&#62;
&#60;chart type="2DLine"&#62;
&#60;animation enabled="yes" appearance="size" speed="10" /&#62;
&#60;hints auto_size="yes"&#62;
&#60;text&#62;&#60;![CDATA[{NAME}, {VALUE}]]&#62;&#60;/text&#62;
&#60;font type="Verdana" size="10" color="0x000000" /&#62;
&#60;/hints&#62;
&#60;names show="yes" width="150" placement="chart" position="bottom" &#62;
&#60;font type="Verdana" size="10" color="0x000000" /&#62;
&#60;/names&#62;
&#60;values show="no" prefix="" postfix="%" decimal_separator="," decimal_places="0" /&#62;
&#60;arguments show="no" /&#62;
&#60;line_chart left_space="5" right_space="5"&#62;
&#60;block_names enabled="no" /&#62;
&#60;/line_chart&#62;
&#60;/chart&#62;
&#60;workspace&#62;
&#60;background enabled="yes" type="solid" color="0xffffff" alpha="0" /&#62;
&#60;base_area enabled="no" /&#62;
&#60;chart_area enabled="yes" x="80" y="50" width="380" height="280" deep="0"&#62;
&#60;background enabled="no"/&#62;
&#60;border enabled="yes" size="1"/&#62;
&#60;/chart_area&#62;
&#60;x_axis name="Jaar" smart="yes" position="center_bottom" &#62;
&#60;font type="Verdana" size="14" color="0x000000" bold="no" align="center" /&#62;
&#60;/x_axis&#62;
&#60;y_axis name="%" smart="yes" position="left_center" &#62;
&#60;font type="Verdana" size="14" color="0x000000" bold="no" align="center" /&#62;
&#60;/y_axis&#62;
&#60;grid&#62;
&#60;values /&#62;
&#60;/grid&#62;
&#60;/workspace&#62;
&#60;legend enabled="yes" x="480" y="50"&#62;
&#60;font type="Verdana" size="10" color="0x000000" /&#62;
&#60;/names&#62;
&#60;values enabled="YES"/&#62;
&#60;scroller enabled="no"/&#62;
&#60;header enabled="no"/&#62;
&#60;background alpha="0"/&#62;
&#60;/legend&#62;
&#60;/type&#62;
#DATA#
&#60;/root&#62;

Similar Messages

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Dynamic column name sql?

    I need to do a select statement using dynamic column names. Can it be done WITHOUT building a string to execute the sql?
    In other words, I want to use a variable name in the SELECT part of a statement.
    Thanks

    Properly done, there shouldn't be a great difference in the performance of static and dynamic SQL. Of course, dynamic SQL is a whole lot more complicated to get right. It's also rather at odds with your requirement that column names get passed in dynamically-- if you don't know what columns you're going to select at compile time, you can't use static SQL.
    That said, there are a handful of tricks around using Oracle's built-in XML processing functionality to simulate dynamic SQL. This is almost certainly less efficient than doing dynamic SQL in your case, and a whole lot more complicated, but it's technically not dynamic SQL.
    The proper response, though, is almost certainly to either
    1) figure out how to design the application so that column names need not be passed in at runtime or
    2) use dynamic SQL.
    If at all possible, option 1 is generally preferable. While there are situations where dynamic SQL is necessary, those tend to be rather rare.
    Justin

  • Form with dynamic Column Names

    Hello,
    I am using "Form with report on table" and I would like to make use of dynamic column names labels that are derived from another table (sql). I am stuck on how to do this, any advice?

    Hi FourEyes;
    Try using this.
    Select Col1, Col2, Col3
    into :P1_Field1, :P1_Field2, :P1_Field3
    from Your_Table
    Where (your conditions);

  • Dynamic Column Names in Flat File Destination

    Hello,
    Inside a Data Flow Task, I have an ADO.Net data source which executes a stored procedure that provides results in 5 columns.
    The requirement is to have it connect to a flat file destination, such that the column names is dependent on what data was pulled by the data source. There is a variable indicator which identifies the data that was pulled. For example:
    If the indicator is 0, then the columns names will be A,B,C,D,E. Otherwise, if the indicator is 1, then column names will be V,W,X,Y,Z.
    Any suggestions will be of great help.
    AJ

    If you only have two variations then use a branched execution (based on precedence constraints) and direct it to one DFT or another based on the result returned by the stored procedure.
    Otherwise use .net
    code to create one package or another dynamically.
    PS: I suggest not to bother using SSIS for such a simplistic scenario.
    Arthur My Blog

  • Dynamic Column name in a Cursor

    Hello there,
    How can I access data in cursor's field with dynamic fields names, more illustration follows:
    My table has columns named as C1,C2,C3 so on
    defined a cursor cursor_name on that table,
    I need to access the fields by a loop like this:
    OPEN cursor_name;
    Fetch cursor_name into rec;
    for i in 1 .. 10 loop
    if rec.ci = 1Then
    end if;
    end loop
    close cursor_name;
    where rec,ci represents the name of the cursor fields, so that I loop over them,
    how can I implement such an idea,
    thanks in advance
    regards

    Thanks Bily, and user10715047,
    actually the reason behind the need of such an approach, is as following:
    assume that I have table of set of logical conditions, " LOGICAL CONDITIONS" has three columns: ID, Condition_name and the logical_condition, example:
    1, c1,  x = 1
    5, c2,  y = 2
    10, c3, p = 3 where ID is just a sequence to identify the records from each other "primary key"
    assume that I need to provide the possible combination of the result of applying each of the conditions, for example :
    if c1 = 1 ,c2= 0 and c3= 1 then  my result must be 1 ' This according some predefined rulesso that I created table which contains all the possible logical conditions, ( as the max number of logical conditions are known)
    defined as follows : combination( combination_ID, c1, c2, c3, c4, ....cmax, result)
    sample record:
    combination_ID, c1,  c2, c3, .. c max, result
              100,   1,    0,   1, ....., 1, 1in the PL/SQL procedure, I would get all the needed combination, into a cursor, then to optimized the code, I need to access the fields ( which is the Ci) in a loop
    for i in 1..3 loop
    if cursor_rec.ci = 1 then
    Action
    end if;
    end loop;the dynamic name I meant in my first post was this : cursor_rec.ci ,
    so that I can access the cursor's fields without the need to name them one by one, as there could be long sequence of conditions to be checked.
    hope that I made the idea clearer, Any suggestions, please !
    anyway I will give the DBMS_SQL cursors a shot , try if I can use to implement the purpose,
    as I know similar dynamical variable names, is available in Java,
    Regards,

  • Dynamic forms using dynamic column names

    I have a table with columns such as level_1, level_2, etc.
    until level_11 and I have another table with level_id and
    description, i.e. for level with id = 1 the description could be
    'Crawl.' Id 2 could be 'Walk' etc.
    I'm trying to make a checklist so people can mark when
    they've done things on the checklist, and then upload those values
    to the appropriate tables to store the information so it's all
    still there when they go back to check off a new skill.
    I can't figure out how to make the column names in the form
    dynamic.
    I've played around with the formatting and still can't quite
    get it. I've tried evaluate(queryname.level_#level_id#),
    queryname.label, a bunch of other ones, and I can't seem to get it
    to work.
    Thanks for the help!

    Get to know CF's structure / array notation. This comes in
    very handy when dealing with queries and form fields.
    - Form.myFieldName can also be referenced by
    Form["myFieldName"]
    - MyQuery.myField can also be referenced by
    MyQuery["myField"][rowNumber]
    Anything in the above example surrounded by quotation makes
    can be made dynamic by just adding in a cf variable surrounded by
    pound signs:
    get_dealer_completion["level_#level_id#"][1]

  • Dynamic Column Names from one table and its corresponding values from another table

    I have 2 tables. First tables gives the specification if a column is required or not. we have the 2nd table with the same column name where we provide the actual values.
    I want to select all the required columns from the 1st table and retrieve the values for those from the 2nd table. Both this i want to achieve in a single select statement.

    This wil require a dynamic Query with a Pivot
    DECLARE @ColsPivot as VARCHAR(MAX);
    DECLARE @Query  AS VARCHAR(MAX);
    1. Retreive the ID for all required field
    SET @ColsPivot = (SELECT STUFF((SELECT  ',' + quotename(CAST([RequirementID] as varchar(3))) FROM [dbo].[Requirement] WHERE required=1 FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)') ,1,1,''));
    This will give you : [1],[2],[3],[8],[9],[14] for exemple.
    2. Build your Query
    SET @Query ='SELECT ClientID,'+@ColsPivot+''
        FROM (
            SELECT [ClientID],[RequirementID],[Value]
            FROM dbo.RequirementValue
            WHERE ClientID=@CliendID --Optional SP parameter
        )src
              PIVOT(
                MAX(Value)
                for [RequirementID] in ('+@ColsPivot+')
        ) p';
    3. Exec(@Query);

  • Dynamic Column Names using Refcursors

    Hi,
    I have a stored procedure which returns a refcursor. The refcursor contains a SQL query in which the column names and number of columns vary dynamically based on the date parameters passed.
    "My objective is to return certain XYZ details of employees for a certain month range."
    For ex: For the month of Aug-2011, the column names would be '1-AUG-11' to '31-AUG-11 and for Feb-2011 '1-FEB-11' to '28-FEB-11'
    My issue is, when I execute the refcursor query using "EXEC", my column names/headings are preserved.
    FIELD NAMES: EMPLOYEE_CODE XYZ_TYPE *1-AUG-11* *2-AUG-11* ... *31-AUG-11*
    DATA: EMPCODE_Z TYPE1 VALUE_1 VALUE_1 ... VALUE_31
    Whereas when I fetch the refcursor into a collection of nested table and display, my column names are lost.
    DATA: EMPCODE_Z TYPE1 VALUE_1 VALUE_1 ... VALUE_31
    Is there a way where I can preserve the column names from the refcursor after fetching into pl/sql collections?
    Any help would be highly appreciated.
    Thank you.
    Edited by: 867622 on Nov 11, 2011 4:38 PM

    867622 wrote:
    If not dynamic SQL, how can the number of columns be altered based on the input parameters?Cannot. A dynamic SQL projection means dynamic SQL (there's an exception to this, and despite interesting is not relevant to 99.99% of problems dealing with dynamic SQL projections).
    You can however still use a dynamic projection and wrap that into a user defined type interface.
    Here's the basic approach:
    // create a user define type that will provide the wrapper for the SQL projection
    create or replace type TString as table of varchar2(4000);
    // build dynamic SQL projections via this type, e.g.
    select
      TStrings( object_id, object_name, created )
    from user_objects
    select
      TStrings( emp_id, dept_id, salary, commission )
    from employeesDespite the SQL cursors being different and the columns and number of columns being selected different, the SQL projection of both are the same. The Count method tells you the number of columns in the projection. Referencing an applicable column is simply done by using the column's sequential number in the projection.
    You also do not have to use a collection or varchar2 as the wrapper type - you can create complex user objects and use the collection type for that, as the SQL projection.
    Another alternative is converting the ref cursor into a DBMS_SQL cursor and using the latter's describe interface to dynamically determine the structure of the SQL projection and fetching the column values from it. But 11gr1 or later is needed for doing this.

  • Dynamic column name in OBIEE

    Hi all,
    In my report i need to show one chart view. I'm having one prompt. There the user is asked to select a no. for eg. say 10. and a date eg. 10-JAN-09. So my report should show the data from 10-JAN-09 and go backwards to 10 days. if he selects 5 days then only 5 days of data only need to show from that date. This part is ok. The chart has five sections in it. They are
    1) 80-100% of the time period
    2) 60-80%
    3) 40-60%
    4) 20-40%
    5) <20%
    So the legends should vary according to this.
    Suppose if the user selects 10 days then the legend should be,
    1) 8-10 days
    2) 6-7 days
    3) 4-5 days
    4) 2-3 days
    5) less than 2 days
    If user selects 5 means then the legend should be,
    1) 5 days
    2) 4 days
    3) 3 days
    4) 2 days
    5) 1 day
    In the prompt im saving this value in one variable. So all i need to do is to apply aggregation on the variable and place it in the column name. But i dont know where to give it. Please help.
    Thanks,
    Karthick

    Hi when you dynamically change the table column that will automatically reflect in the chart legend.
    please check the following link for dynamically changing column header name
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/

  • Dynamically Pass the Column Name cursor. || Dynamic Column Name

    Hi,
    I need to dynamically pass the column name based on a Mapping table in a loop ( Right now i have hardcoded stuff )just like using Execute immediate.... Inside the procedure, I have commented as where i hit the problem.
    Thanks for all of your time...
    Thanks
    Muthu
    CREATE OR REPLACE PROCEDURE xml_testing_clob AS
    doc xmldom.DOMDocument;
    main_node xmldom.DOMNode;
    root_node xmldom.DOMNode;
    user_node xmldom.DOMNode; item_node xmldom.DOMNode;
    root_elmt xmldom.DOMElement;
    item_elmt xmldom.DOMElement;
    item_text xmldom.DOMText;
    item_test xmldom.DOMText;
    nodelist xmldom.DOMNodeList;
    sub_variable varchar2(4000);
    x varchar2(200);
    y varchar2(200);
    sub_var varchar2(4000);
    CURSOR get_users IS
    SELECT FIRST_NAME,LAST_NAME,ROWNUM FROM USER_INFO_TBL WHERE WEIN_NUMBER = '1234' ;
    CURSOR get_cdisc_name IS
    select CTS_COL_NAME,CDISC_NAME from CTS2CDISC_DICTIONARY where CTS_TABLE_NAME = 'USER_INFO_TBL';
    BEGIN
    -- get document
    doc := xmldom.newDOMDocument;
    doc := xmldom.NewDomDocument;
    xmldom.setVersion(doc, '1.0');
    xmldom.setStandalone(doc, 'no');
    xmldom.setCharSet(doc, 'ISO-8859-1');
    -- create root element main_node := xmldom.makeNode(doc);
    root_elmt := xmldom.createElement(doc,'AdminData');
    root_node := xmldom.appendChild(main_node,xmldom.makeNode(root_elmt));
    FOR get_users_rec IN get_users LOOP
    item_elmt := xmldom.createElement(doc,'User');
    xmldom.setAttribute(item_elmt,'OID' , get_users_rec.rownum);
    user_node := xmldom.appendChild(root_node,xmldom.makeNode(item_elmt));
    FOR cv_get_cdisc_name IN get_cdisc_name LOOP
    EXIT WHEN get_cdisc_name%NOTFOUND;
    sub_var := cv_get_cdisc_name.cts_col_name;
    sub_variable := 'get_users_rec.';
    sub_variable := 'get_users_rec.'||cv_get_cdisc_name.cts_col_name;
    x := sub_variable;
    dbms_output.put_line(x); -------------- Here i just see the literal string
    y := get_users_rec.FIRST_NAME;
    dbms_output.put_line(y); -------------- Here i just see actual value ( data )
    item_elmt := xmldom.createElement(doc,cv_get_cdisc_name.cdisc_name);
    item_node := xmldom.appendChild(user_node,xmldom.makeNode(item_elmt));
    item_text := xmldom.createTextNode(doc,x ); ---- This is the place i am hitting with an error .
    If i use variable X then i am able to see only the literal
    string in the output. BUT if i put cursor name.coulmname,
    then the resumt (XML) is fine.I wanted acheive this
    dynamically just like execute Immediate
    item_node := xmldom.appendChild( item_node , xmldom.makeNode(item_text));
    END LOOP;
    END LOOP;
    -- write document to file using default character set from database
    xmldom.WRITETOCLOB(doc,);
    xmldom.writeToFile(doc, 'c:\ash\testing_out.xml');
    -- free resources
    xmldom.freeDocument(doc);
    END;
    +++++++++++++++++++++++++++++++++++ XML OUTPUT +++++++++++++++++++++++++++++++++++++++++
    <?xml version="1.0" ?>
    - <AdminData>
    - <User OID="1">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName> </User>
    - <User OID="2">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    - <User OID="3">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    - <User OID="4">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    - <User OID="5">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++ MAPPING TABLE DETAILS +++++++++++++++++
    CTS_COL_NAME     CDISC_NAME     CTS_TABLE_NAME     XML_TAG     -----------> Column Name
    FIRST_NAME     FirstName     USER_INFO_TBL     Element     -----------> Records
    LAST_NAME     LastName     USER_INFO_TBL     Element     -----------> Records

    My scenario is little different, let me explain:
    My columns will remain same but values changes (based on column formula) according to the selected prompt value
    If I select 'Oct' from prompt then
    Curr will contain data for 'Oct' only
    Next1 will contain data for 'Nov' only
    Next2 will contain data for 'Dec' only
    Next3 will contain data for 'Jan' of next year only.
    Later if I select 'Jul' from prompt then
    Curr will contain data for 'Jul' only
    Next1 will contain data for 'Aug' only
    Next2 will contain data for 'Sep' only
    Next3 will contain data for 'Oct' only.
    I don't have different columns for each months but the columns are capable to reflect data for any month.
    So, how can I reflect the column name as month name for which that contains data.
    Regards,
    S Anand

  • Cannot use alias for dynamic column name in SELECT statement

    Hi,
    I want to retrieve values from several tables by using dynamic column & table name as below:
    DATA: tbl_name(30) TYPE c VALUE '/bic/tbi_srcsys',  " staticly initialized for this example
               col_name(30) TYPE c VALUE '/bic/bi_srcsys'.  " staticly initialized for this example
    SELECT (col_name) INTO CORRESPONDING FIELDS OF TABLE it_values FROM (tbl_name).
    The internal table "it_values" does not contain a field named "/bic/bi_srcsys", instead it has another generic field "value" so that the above code can be applied to other tables. I tried to use alias (AS) as below:
    SELECT (col_name) AS value INTO CORRESPONDING FIELDS OF TABLE it_values FROM (tbl_name).
    But this cannot work. I know that there are other ways to solve this problem, such as by using a single field in SELECT .. ENDSELECT and subsequently appending it to the work area and internal table as below:
    SELECT (col_name)  INTO (lv_value) FROM (tbl_name).
      wa_value-value = lv_value.
      APPEND wa_value TO it_values.
    ENDSELECT.
    Just wonder if there is any other more elegant workaround, because I might have several other fields instead of only one?
    Thanks.
    Regards,
    Joon Meng

    Hi Suhas,
    thanks for the quick reply.
    Sorry that I have not well described the structure of the internal table "it_values". This internal table contains several other fields (key, type, value, etc.).
    I guess that the following code
    SELECT (col_name) INTO TABLE it_values FROM (tbl_name).
    works if the internal table only has one field (value) or the field "value" is in the first position, right?
    In this case, I need to fill the "value" field of internal table it_values (ignore the other fields like type, key) with values retrieved from (col_name) of the DDIC table.
    Looking forward to your reply.
    BR,
    Joon Meng

  • Dynamic actions on button and dynamic column name

    Hi!ynam
    I want to create a dynamic action on button click in my tabular form.
    I have a select list with values of my column names (P7_X_COLUMN) and a text field where users input values for update (P7_X_UVALUE).
    My idea is that when they click the button, they update selected column to desired value in all rows.
    However, I get the following error:
    ORA-06550: line 5, column 5: PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specification ORA-06550: line 4, column 1: PL/SQL: SQL Statement ignored (Go to error)
    It seems to me that I have not referenced the column name correctly, I thought it was the same as referencing values. How do I do that?
    This is my code:
    begin
    update "#OWNER#"."IZV_SLOG_DET"
    set :P7_X_COLUMN=:P7_X_UVALUE;
    end;
    Regards,
    Ivan

    I got it to work, but the query is too big. Can anyone help me with how to get it to work?
    I tried breaking it into more varchar2 strings, but i always get the same error:
    Error processing row.
    ORA-01461: can bind a LONG value only for insert into a LONG column
    declare  
    l_table_name varchar2(30) := 'IZV_SLOG_DET_POM'; 
    l_sql_stmt varchar2(32762);
    begin
    l_sql_stmt := 'update ' || l_table_name || ' set ' || :P7_X_COLUMN || ' =''' || :P7_X_UVALUE|| '''' ||
    'where'||
    'nvl(MSR_PRD_ID,1) = nvl(nvl(''' || :P7_X_MSR_PRD_ID || '''' || ',MSR_PRD_ID),1) and' ||
    'nvl(SRC_STM_ID,1) = nvl(nvl(''' || :P7_X_SRC_STM_ID || '''' || ',SRC_STM_ID),1) and' ||
    'nvl(OZNAKA_KOMITENTA,1) = nvl(nvl(''' || :P7_X_OZNAKA_KOMITENTA || '''' || ',OZNAKA_KOMITENTA),1) and' ||
    'nvl(RSP,1) = nvl(nvl(''' || :P7_X_RSP || '''' || ',RSP),1) and' ||
    'nvl(OZNAKA_RETKA,1) = nvl(nvl(''' || :P7_X_OZNAKA_RETKA || '''' || ',OZNAKA_RETKA),1) and' ||
    'nvl(OZNAKA_IZVJESCA,1) = nvl(nvl(''' || :P7_X_OZNAKA_IZVJESCA || '''' || ',OZNAKA_IZVJESCA),1) and' ||
    'nvl(MBR_KOMITENTA,1) = nvl(nvl(''' || :P7_X_MBR_KOMITENTA || '''' || ',MBR_KOMITENTA),1) and' ||
    'nvl(KOMITENT_NEREZ,1) = nvl(nvl(''' || :P7_X_KOMITENT_NEREZ || '''' || ',KOMITENT_NEREZ),1) and' ||
    'nvl(ZUPANIJA,1) = nvl(nvl(''' || :P7_X_ZUPANIJA || '''' || ',ZUPANIJA),1) and' ||
    'nvl(DRZAVA,1) = nvl(nvl(''' || :P7_X_DRZAVA || '''' || ',DRZAVA),1) and' ||
    'nvl(SEKTOR_NEREZIDENTA,1) = nvl(nvl(''' || :P7_X_SEKTOR_NEREZIDENTA || '''' || ',SEKTOR_NEREZIDENTA),1) and' ||
    'nvl(VRSTA_POVEZANOSTI,1) = nvl(nvl(''' || :P7_X_VRSTA_POVEZANOSTI || '''' || ',VRSTA_POVEZANOSTI),1) and' ||
    'nvl(INSTRUMENT,1) = nvl(nvl(''' || :P7_X_INSTRUMENT || '''' || ',INSTRUMENT),1) and' ||
    'nvl(VALUTA,1) = nvl(nvl(''' || :P7_X_VALUTA || '''' || ',VALUTA),1) and' ||
    'nvl(OTKAZNI_ROK,1) = nvl(nvl(''' || :P7_X_OTKAZNI_ROK || '''' || ',OTKAZNI_ROK),1) and' ||
    'nvl(IZVORNO_DOSPIJECE,1) = nvl(nvl(''' || :P7_X_IZVORNO_DOSPIJECE || '''' || ',IZVORNO_DOSPIJECE),1) and' ||
    'nvl(VRSTA_INDEKSACIJE,1) = nvl(nvl(''' || :P7_X_VRSTA_INDEKSACIJE || '''' || ',VRSTA_INDEKSACIJE),1) and' ||
    'nvl(VALUTA_INDEKSACIJE,1) = nvl(nvl(''' || :P7_X_VALUTA_INDEKSACIJE || '''' || ',VALUTA_INDEKSACIJE),1) and' ||
    'nvl(PORTFELJ,1) = nvl(nvl(''' || :P7_X_PORTFELJ || '''' || ',PORTFELJ),1) and' ||
    'nvl(UTRZIVOST_KREDITA,1) = nvl(nvl(''' || :P7_X_UTRZIVOST_KREDITA || '''' || ',UTRZIVOST_KREDITA),1) and' ||
    'nvl(ZNACAJKE_KAPITALA,1) = nvl(nvl(''' || :P7_X_ZNACAJKE_KAPITALA || '''' || ',ZNACAJKE_KAPITALA),1) and' ||
    'nvl(RIZICNA_SKUPINA,1) = nvl(nvl(''' || :P7_X_RIZICNA_SKUPINA || '''' || ',RIZICNA_SKUPINA),1) and' ||
    'nvl(UGRADJENI_DERIVAT,1) = nvl(nvl(''' || :P7_X_UGRADJENI_DERIVAT || '''' || ',UGRADJENI_DERIVAT),1) and' ||
    'nvl(ODNOSNA_VARIJABLA,1) = nvl(nvl(''' || :P7_X_ODNOSNA_VARIJABLA || '''' || ',ODNOSNA_VARIJABLA),1) and' ||
    'nvl(PREDZNAK,1) = nvl(nvl(''' || :P7_X_PREDZNAK || '''' || ',PREDZNAK),1) and' ||
    'nvl(VRSTA_IZNOSA,1) = nvl(nvl(''' || :P7_X_VRSTA_IZNOSA || '''' || ',VRSTA_IZNOSA),1) and' ||
    'nvl(KOMITENT_PBR,1) = nvl(nvl(''' || :P7_X_KOMITENT_PBR || '''' || ',KOMITENT_PBR),1) and' ||
    'nvl(UDJELI_POVEZ_C,1) = nvl(nvl(''' || :P7_X_UDJELI_POVEZ_C || '''' || ',UDJELI_POVEZ_C),1) and' ||
    'nvl(AR_ID,1) = nvl(nvl(''' || :P7_X_AR_ID || '''' || ',AR_ID),1) and' ||
    'nvl(AU_ID,1) = nvl(nvl(''' || :P7_X_AU_ID || '''' || ',AU_ID),1) and' ||
    'nvl(AR_BUSS_ID,1) = nvl(nvl(''' || :P7_X_AR_BUSS_ID || '''' || ',AR_BUSS_ID),1) and' ||
    'nvl(MTI_CCY_TP_ID,1) = nvl(nvl(''' || :P7_X_MTI_CCY_TP_ID || '''' || ',MTI_CCY_TP_ID),1) and' ||
    'nvl(REG_NO,1) = nvl(nvl(''' || :P7_X_REG_NO || '''' || ',REG_NO),1) and' ||
    'nvl(REG_SFX,1) = nvl(nvl(''' || :P7_X_REG_SFX || '''' || ',REG_SFX),1) and' ||
    'nvl(JMBG_ID_NO,1) = nvl(nvl(''' || :P7_X_JMBG_ID_NO || '''' || ',JMBG_ID_NO),1) and' ||
    'nvl(IP_ID,1) = nvl(nvl(''' || :P7_X_IP_ID || '''' || ',IP_ID),1) and' ||
    'nvl(TAX_ID_NO,1) = nvl(nvl(''' || :P7_X_TAX_ID_NO || '''' || ',TAX_ID_NO),1) and' ||
    'nvl(INSTRUMENT_OLD,1) = nvl(nvl(''' || :P7_X_INSTRUMENT_OLD || '''' || ',INSTRUMENT_OLD),1) and' ||
    'nvl(PREDZNAK_OLD,1) = nvl(nvl(''' || :P7_X_PREDZNAK_OLD || '''' || ',PREDZNAK_OLD),1) and' ||
    'nvl(NAPOMENA,1) = nvl(nvl(''' || :P7_X_NAPOMENA || '''' || ',NAPOMENA),1) and' ||
    'nvl(NOVI_POSAO_F,1) = nvl(nvl(''' || :P7_X_NOVI_POSAO_F || '''' || ',NOVI_POSAO_F),1) and' ||
    'nvl(LISTA_SUMARNA,1) = nvl(nvl(''' || :P7_X_LISTA_SUMARNA || '''' || ',LISTA_SUMARNA),1) and' ||
    'nvl(LISTA_REKAP,1) = nvl(nvl(''' || :P7_X_LISTA_REKAP || '''' || ',LISTA_REKAP),1) and' ||
    'nvl(DZS_IDY_CL_ID,1) = nvl(nvl(''' || :P7_X_DZS_IDY_CL_ID || '''' || ',DZS_IDY_CL_ID),1) and' ||
    'nvl(HNB_IP_CL_ID,1) = nvl(nvl(''' || :P7_X_HNB_IP_CL_ID || '''' || ',HNB_IP_CL_ID),1) and' ||
    'nvl(NO_DYS_OO,1) = nvl(nvl(''' || :P7_X_NO_DYS_OO || '''' || ',NO_DYS_OO),1) and' ||
    'nvl(POSTOTAK1,1) = nvl(nvl(''' || :P7_X_POSTOTAK1 || '''' || ',POSTOTAK1),1) and' ||
    'nvl(POSTOTAK2,1) = nvl(nvl(''' || :P7_X_POSTOTAK2 || '''' || ',POSTOTAK2),1) and' ||
    'nvl(POSTOTAK3,1) = nvl(nvl(''' || :P7_X_POSTOTAK3 || '''' || ',POSTOTAK3),1) and' ||
    'nvl(BNK_ID,1) = nvl(nvl(''' || :P7_X_BNK_ID || '''' || ',BNK_ID),1) and'||
    'nvl(ID,1) = nvl(nvl(''' || :P7_X_ID || '''' || ',ID),1) and' ||
    'nvl(ID_RETKA,1) = nvl(nvl(''' || :P7_X_ID_RETKA || '''' || ',ID_RETKA),1) and' ||
    'nvl(DATUM_STANJA,1) = nvl(nvl(''' || :P7_X_DATUM_STANJA || '''' || ',DATUM_STANJA),1) and' ||
    'nvl(IZNOS,1) = nvl(nvl(''' || :P7_X_IZNOS || '''' || ',IZNOS),1) and' ||
    'nvl(IZNOS_ACTUAL,1) = nvl(nvl(''' || :P7_X_IZNOS_ACTUAL || '''' || ',IZNOS_ACTUAL),1) and' ||
    'nvl(ACT_AR_BAL_KN,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL_KN || '''' || ',ACT_AR_BAL_KN),1) and' ||
    'nvl(ACT_AR_BAL,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL|| '''' || ',ACT_AR_BAL),1) and' ||
    'nvl(IZNOS_ACTUAL_OLD,1) = nvl(nvl(''' || :P7_X_IZNOS_ACTUAL_OLD || '''' || ',IZNOS_ACTUAL_OLD),1) and' ||
    'nvl(ACT_AR_BAL_KN_OLD,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL_KN_OLD || '''' || ',ACT_AR_BAL_KN_OLD),1) and' ||
    'nvl(ACT_AR_BAL_OLD,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL_OLD || '''' || ',ACT_AR_BAL_OLD),1) and' ||
    'nvl(EXG_RT_CRD_RSK_F,1) = nvl(nvl(''' || :P7_X_EXG_RT_CRD_RSK_F || '''' || ',EXG_RT_CRD_RSK_F),1) ';
    execute immediate l_sql_stmt; 
    end;

  • Dynamic column name

    hi experts,
      DATA: temp(20) VALUE 'DATA',
            i TYPE I VALUE 1,
            J(2) type c.
            LOOP AT l_t_tsi.
                     J = I.
                    CONCATENATE TEMP J INTO COLNAME.
                    itab-(COLNAME) = l_t_tsi-time_series_value.
                    i = i + 1.
          ENDLOOP.
    My internal table (itab) has fields data1(20), data2(20), data3(20)...
    I want to generate the column names dynamically only.
    The above code gives an error at this line -
                    itab-(COLNAME) = l_t_tsi-time_series_value.
    Thanks in advance,
    Bijal

    Hi,
    If your aim is to refer to a internal table field dynamically you can do it.
    Look at the code segment below -
    DATA: temp(20) VALUE 'DATA',
    i TYPE I VALUE 1,
    J(2) type c.
    FIELD-SYMBOLS: <ls_data>.
    LOOP AT l_t_tsi.
    J = I.
    CONCATENATE TEMP J INTO COLNAME.
    <b>ASSIGN COMPONENT colname OF itab TO <ls_data>.
    <ls_data> = l_t_tsi-time_series_value.</b>
    *itab-(COLNAME) = l_t_tsi-time_series_value.
    i = i + 1.
    ENDLOOP.
    Regards,
    Manish Joshi
    If it solves your problem, close the thread.
    Don't clutter-up forum by leaving open threads.

Maybe you are looking for

  • Error 36 and External Drive File Copy Problem & USB Connections

    In attempting to copy a folder with some 200G+ of files from my iMAC, with OSX 10.6.7, to an external portable WD 1Tb HD, newly formatted to HFS+ (journaled), and connected to the iMAC via a USB cable to the USB port on the iMAC keyboard, I kept gett

  • Configuration / Uploading of Electronic Bank Statement Steps

    Hi I have confirgured the electronic bank statement functinality, I have used interpetaton alogrithm as 015, In Assign External Transaction type to posting rule, we have only two exteranal transaction 1001 for Credit and 1002 for debits in bank, we h

  • Color shift after upgrade to 7?

    I just upgraded from FCP 6 to 7, and I could swear my footage (AVCHD converted to ProRes) looks just slightly bluer now. Is this possible? Is there something different about how FCP 7 handles the video that could cause this? thanks!

  • OnLocation fails to record from Microsoft LifeCam Studio 1080p HD Webcam

    Hi, I finally installed and configured OnLocation on my laptop, and I was looking forward to shooting 1080p footage in my car. Imagine my disappointment when it turned out that OnLocation refuses to record from the camera! I know the camera works bec

  • Pages tab of Adobe Reader XI

    We were just upgraded to the new Adobe Reader XI.  In the previous version we were able to rotate, delete, extract, replace, crop, split document, etc. from the Pages tab.  In this new version none of these options are found on the Pages tab or anywh