LOV of column names with a report's custom column headings?

I have a list ov values definition that looks like this:
select column_name d, column_name r from all_tab_columns where table_name = 'DATABASE_LIST'
I'd like to list the custom column headings from a report as d, rather than repeating the column_name. How can I do this?

As Anton said, the best thing is to store your custom headings in a table so that you can use the table for your LOV as well as for your report headings.
To use dynamic report headings, you can use the 'PL/SQL function body returning colon-delimited headings' feature on the Report Attributes page.
So, if your report headings are stored in table t that function body can be
declare
l_headings varchar2(4000)
begin
for rec in (select heading from t) loop
   l_headings := l_headings||':'||rec.heading;
end loop;
return ltrim(l_heading,':');
end;Hope this helps.

Similar Messages

  • Lookup column names with Power Query

    Hi,
    before I go ahead and change source files, I was wondering if I can use Power Query to get a model with the following data. To simplify the example, I have the following dataset in an Excel sheet:
    In another Excel sheet, the column names are defined, for example:
    What would like to have in Power Query is one table with the column names from the second screenshot in column B. Is there a way to link these two tables together in Power Query in order to use these names as column headers in the dataset?
    Thanks!
    - If a post answers your question, please click "Mark As Answer" on that post!

    You can filter the list of renames against the list of actual column names with something like
        FilteredColumns = Table.SelectRows(Columns, each List.Contains(Table.ColumnNames(Source), [Name])),
    Again, the working end-to-end:
    let
    Source = Table.FromRows({{"New York", 23, 51, 732}, {"Chicago", 25, 421, 23}, {"Los Angeles", 632, 22, 423}}, {"City", "Col 1", "Col 2", "Col 3"}),
    Columns = Table.FromRows({{"Col 1", "Column 1"}, {"Col 2", "Column 2"}, {"Col 3", "Column 3"}, {"Col 4", "Column 4"}}, {"Name", "Value"}),
    FilteredColumns = Table.SelectRows(Columns, each List.Contains(Table.ColumnNames(Source), [Name])),
    ColumnsAsRenames = Table.TransformRows(FilteredColumns, Record.FieldValues),
    RenamedColumns = Table.RenameColumns(Source, ColumnsAsRenames)
    in
    RenamedColumns

  • Dynamic Column Name on Interactive Report

    Hi all,
    Is it possible to assign a SQL result to a Column name on an interactive report?
    I have been able to do this on a standard SQL Report though the use of page items but have not had much luck with interactive reports.
    Any help is appeciated.
    Thanks,
    Dan

    could you please explain step 4 a bit more?
    as with the standard report, i just created an item with SQL query with a corresponding computation with same SQL query and that works great.
    i tried the same method with interactive and it did not work.
    in step 4 it mentions creating a process to populate the items.
    how is this done?
    Thanks,
    Dan

  • How to refer a column name in form report

    Hi,
    How can i refer a column name in the form report. My issue is that " I have a form report in that i have column name when i use to click the column name it should bring me to next page with the corresponding values of the column."
    Here i have achieved that when i click on column name(in Page1) it brings me to next page(Page2). but in the next page(P2) i want to display(only display) the corresponding values of the selected column(Page1) but the values should not be editable and should not be in text field it should be in display only field.
    So how can i write a sql query in display only souce field. Ie, how can i refer the column name in(page1) form report.

    Hi Karthik
    Very good morning.
    I think u have column link in the first page and when u select a data in the first page and when u r moving to the next page the the corresponding data need to there is it correct.
    For example You have table Employee and u have a select list in the first page contains name of the employee when u select one name and corresponding datas of the employee need to be in the second page.
    So Dont clear the cache of the first page.
    I the next page make the page items as display only and give the source of the all items a returning the single sql query.
    If u have four items in the next page namely p2_sal, P2emp_no etc..
    Then use like this
    select sal from emp where emp_name=:P1_EMPNAME
    Hopes this might helps you.
    Thanks & Regards
    Srikkanth.M

  • Column name changed in reports

    I have to do some changes on my existing report, its really a complex report with more number of columns and tables. now its really hard to fix the alias name changed by report builder automatically. any one could help me to fix this problem, means what i have alias name in query that i want to use in report.

    Hi,
    Could you pl clarify the Q? Do you mean that Reports Buider has automatically added an alias to a column name? This is not expected.
    Or do you mean that you need to change the alias of the column without disturbing the report definition? You can alter the data model of the report using the feature "Customization at runtime using XML". For more information, refer to Chapter 16 in Publishing Reports Manual for 10g:
    http://www.oracle.com/technology/documentation/reports.html
    Navneet.

  • I am unable to get order by column name in oracle report parameter form

    i created query like following in query builder
    SELECT CASE_NO, COURT_ID, CASE_TYPE,
    INITCAP(PLAINTIFF) PLAINTIFF,INITCAP( DEFENDENT) DEFENDENT,
    INITCAP(COUNSEL) COUNSEL, START_DATE, PREVIOUS_HEARING_DATE,
    NEXT_HEARING_DATE,INITCAP( DESCRIPTION) DESCRIPTION,
    INITCAP(RELIEF) RELIEF,INITCAP(EXTENT) EXTENT,
    DECREE_DATE,INITCAP(STATUS) STATUS,INITCAP( LOCATION) LOCATION,
    LEGAL_FILE_NO, MSNO
    FROM L_CASE_MASTER_MAIN
    WHERE to_char(NEXT_HEARING_DATE,'DD-MON-YYYY')=:P_NHD ORDER BY :P_COL
    and i created parameter form for these two bind variables :P_NHD,:P_COL
    in,:P_COL i wrote lov as Select trim(COLUMN_NAME) from user_tab_columns where table_name='L_CASE_MASTER_MAIN'  to get all the columns.
    in parameter form i am able to get all the columns but when i am generating report it is not giving results as per my ordered column.
    kindly let me know the solution
    Report Version :Oracle Reports 11g
    Db Version:Oracle  11g

    Hi,
    Ordering the column first takes place from the Data Model Itself.
    Please Check your column ordering in the report data model. If it is not ordered in a right way then Rearrange it.
    Remove your order by in query...
    If any issues... let me know
    Regards,
    Soofi

  • How to suppress column names in SQL-report

    What I want is just the data, without any column names.
    COLUMN LDATE OFF;
    SELECT     SYSDATE LDATE
    FROM DUAL;
    LDATE
    07.11.11
    This example doesn't work. There is still LDATE above column. Any idea?

    user5116754 wrote:
    Great, it's so simple. Im sure there is a way to omit this result statement: "531 rows selected" at the end of report!There is, and it's also in the documentation...
    SQL> set feedback off
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    SQL>

  • JTable column names with custom model

    I'm having problems with column names in a JTable which uses a custom model. For some reason, the colums are being shown as A, B, C etc. The data, however, displays fine.
    This is the code which constructs the table.
    MyTableModel tableModel = new MyTableModel(myArrayList);
      myTable = new JTable(tableModel);
      myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      myTable.setFillsViewportHeight(true);This is the class, MyTableModel
    class MyTableModel extends AbstractTableModel {
            private ArrayList<Account> data;
            private String[] colNames = {"", "Name","Type","Group","Created","Modified"};
            public MyTableModel(ArrayList<Account> data) {
                this.data = data;
            public int getRowCount() {
                return data.size();
            public int getColumnCount() {
                return 6;
            public Object getValueAt(int row, int col) {
                Account account = (Account)data.get(row);
                switch(col) {
                    case 0:
                        return account.getIcon();
                    case 1:
                        return account.getName();
                    case 2:
                        return account.getType();
                    case 3:
                        return account.getGroup();
                    case 4:
                        return account.getDateCreated();
                    case 5:
                        return account.getDateModified();
                    default:
                        return "";
            public String getColumName(int index) {
             System.out.println("N:"+colNames[index]);
                return colNames[index];
        }When the table is displayed, nothing's displayed to the console, but I'd have thought getColumnName would print the current column name. Am I missing something obvious?

    Oh great. I'll go back under my rock.
    Thanks =)

  • Invalid column name (with ojdbc)

    hi,
    I created a resultSet by executing query with more then one table in it. (left join)
    and now i want to getObject. so I execute resultSet.getObject("tablename.columnName")
    and I get this error "invalid column name".
    when i'm doing the same thing with MySQL it works fine.
    I don't want to do aliases for all the columns because there are too much of those.
    please help.
    thanks,
    asaf.

    that's not standard JDBC. You must use either the plain column name,
    or the column number. In cases where there are multiple columns with
    the same name you must use the column number for all but the first
    column with the same name.
    Joe Weinstein

  • Column Name in BI Reports

    Hi,
    I have about 80 reports that are running in various dashboards. Each of those reports is an Answers request.
    Is there a way to find out if a particular column is being used in which report without going through each report manually?
    Thanks,
    rkingmdu

    Hi kingmdu,
    Is there a way to find out if a particular column is being used in which report without going through each report manually?No,we can find a single column from so many requests.
    But we can do one thing,its simple the column you want to search gives you some clue say like example column name=customer name then definately it will exists in something named customer prefixed or suffixed table in the presentation catalog that are defined.Same way you apply it for the column your searching.
    Looks simple but no other option.
    Hope it helps you.
    Best Wishes,
    Kranthi.

  • Dynamic column name with SELECT INTO

    I am trying to build a function that derives a pay amount from a set of business rules. There are about 40 columns that hold various pay amounts and their column names are variations of 4 indicators (day shift, vs night shift, etc.) that I have to dynamically look up, ie here is the ID number and a timecard, now figure out which of the 40 fields to look up to get the pay amount.
    I can determine from the timecard and employee ID which field to look at, but I'm getting hung up with the syntax needed to construct and execute the statement inside the PL/SQL block. I need to RETURN the pay I extract using the function, and I can create the correct SQL statement, but the EXECUTE IMMEDIATE won't accept the SELECT INTO syntax.
    Can someone please suggest a solution? Here is the function:
    create or replace FUNCTION FN_GET_PAYRATE(tc in NUMBER, e in NUMBER, pc in VARCHAR2)
    RETURN NUMBER
    IS
    e_id NUMBER;
    tc_id NUMBER;
    pl_cd VARCHAR2(7);
    shft VARCHAR2(2);
    lvl VARCHAR2(2);
    typ VARCHAR2(2);
    e_typ VARCHAR2(4);
    proj NUMBER;
    hrly VARCHAR2(4);
    payrt NUMBER;
    var_col VARCHAR2(10);
    sql_select VARCHAR2(200);
    sql_from VARCHAR2(200);
    sql_where VARCHAR2(200);
    sql_and1 VARCHAR2(200);
    sql_and2 VARCHAR2(200);
    sql_and3 VARCHAR2(200);
    sql_orderby VARCHAR2(200);
    var_sql VARCHAR2(2000);
    BEGIN
    e_id := e;
    tc_id := tc;
    pl_cd := pc;
    SELECT NVL(SHIFT,'D') INTO shft
    FROM TS_TIMECARD_MAIN
    WHERE TIMECARD_ID = tc_id;
    --DBMS_OUTPUT.PUT_LINE('SHIFT= ' || shft);
    SELECT NVL(PAY_LVL, 1), NVL(PAY_TYPE, 'B'), NVL(RTRIM(EMP_TYPE), 'LHD'), NVL(PROJECT, 001)
    INTO lvl, typ, e_typ, proj
    FROM TS_EMPLOYEES
    WHERE EMP_ID = e_id;
    --DBMS_OUTPUT.PUT_LINE('Level= ' || lvl);
    --DBMS_OUTPUT.PUT_LINE('PAY_TYPE= ' || typ);
    --DBMS_OUTPUT.PUT_LINE('EMP_TYPE= ' || e_typ);
    --DBMS_OUTPUT.PUT_LINE('PROJECT= ' || proj);
    IF e_typ <> 'LHD' THEN
    hrly := 'H';
    ELSE
    hrly := '';
    END IF;
    IF proj <> 001 THEN
    var_col := shft || lvl || typ || hrly;
    --DBMS_OUTPUT.PUT_LINE('RATE COLUMN= ' || var_col);
    sql_select := 'SELECT NVL(' || var_col || ', .01) INTO payrt';
    sql_from := ' FROM TS_PAYRATES';
    sql_where := ' WHERE PROJECT_ID = ' || proj;
    sql_and1 := ' AND ACTIVE = 1';
    sql_and2 := ' AND JOB_TYPE = ' || CHR(39) || e_typ || CHR(39);
    sql_and3 := ' AND PILE_ID = ' || CHR(39) || pl_cd || CHR(39);
    var_sql := sql_select || sql_from || sql_where || sql_and1 || sql_and2 || sql_and3 || sql_orderby;
    DBMS_OUTPUT.PUT_LINE('SQL: ' || var_sql);
    EXECUTE IMMEDIATE var_sql;
    DBMS_OUTPUT.PUT_LINE('RATE= ' || payrt);
    RETURN payrt;
    ELSE
    DBMS_OUTPUT.PUT_LINE('ERROR');
    RETURN 1;
    END IF;
    END;
    I have alternately tried this:
    SELECT NVL(var_col,.01) into payrt
    FROM TS_PAYRATES
    WHERE PROJECT_ID = proj AND ACTIVE = 1
    AND JOB_TYPE = CHR(39) || e_typ || CHR(39)
    AND PILE_ID = CHR(39) || pl_cd || CHR(39);
    as a substitute for the EXECUTE IMMEDIATE block, but I can't seem to use a dynamic substitution for the column name.
    Any help would be greatly appreciated.

    That's the most difficult part - the error messages seem to indicate a problem with the SQL statement in its execution context, because I can take the SQL string by itself and it executes perfectly.
    Here are three variations:
    SELECT INTO
    select fn_get_payrate(21555, 30162, 15) from dual
    ERROR at line 1:
    ORA-00905: missing keyword
    ORA-06512: at "PEOPLENETIF.FN_GET_PAYRATE", line 60
    SQL: SELECT NVL(N4P , .01) INTO payrt FROM TS_PAYRATES WHERE PROJECT_ID = 701 AND ACTIVE = 1 AND JOB_TYPE = 'LHD' AND PILE_ID = '15'
    Without SELECT INTO  (returns NULL)
    SQL> select fn_get_payrate(21555, 30162, 15) from dual;
    FN_GET_PAYRATE(21555,30162,15)
    SQL: SELECT NVL(N4P , .01) FROM TS_PAYRATES WHERE PROJECT_ID = 701 AND ACTIVE = 1 AND JOB_TYPE = 'LHD' AND PILE_ID = '15'
    RATE=
    EXECUTE IMMEDIATE USING
    SQL> select fn_get_payrate(21555, 30162, 15) from dual;
    select fn_get_payrate(21555, 30162, 15) from dual
    ERROR at line 1:
    ORA-01006: bind variable does not exist
    ORA-06512: at "PEOPLENETIF.FN_GET_PAYRATE", line 61
    SQL: SELECT NVL(N4P , .01) FROM TS_PAYRATES WHERE PROJECT_ID = 701 AND ACTIVE = 1 AND JOB_TYPE = 'LHD' AND PILE_ID = '15'

  • SQL Query not working for column names with spaces

    Hi People..
    We have a strange situation wherein, the column name in the database table has a space inbetween like "Constant Name". While we write a JDBC statement code with the select query we get an exception for invalid syntax. It will help us in a great way if you have anything to inform us on this..
    Thanks
    Prabz

    Using case sensitive names and names with spaces in it is not a good practice.
    However, I believe the SQL standard accounts for this with quoted identifiers. I believe the syntax is
    . select "My Field1", "My Field2"
    . from "My Table'
    Have also seen the following although it might be MS Access specific.
    . select [My Field1], [My Field2]
    . from [My Table]

  • Pass column names dynamically in report

    Hello experts,
    I am creating an ALV report where i need to pass the column names dynamically. if the current month is March and year is 2009. the column names should be as below
    March 2009 April 2009 May 2009 June 2009 ..............till Feb 2010 (total columns are 12)
    if the current month is June and year is 2010 it shoud be displayed as
    June 2010 July 2010 Aug 2010................till May2011
    I am actually calculating the forecast qty for each month and displaying in a report from the current month.
    How to write field catelog for this requirement?
    Thanks in Advance.
    Rajesh.

    I think in the fieldcat, at the time of declearation, you can alter the field description depending on the present month.
    If present_month = January
    wa_fieldcat-reptext_ddic = 'January'.       " Field description
    elseif present month = February.
    wa_fieldcat-reptext_ddic = 'February'.       " Field description
    on so on.....................
    Kuntal

  • ResultSetMetaData.getColumnLabel(int coluN) gives column name with quote

    I am using ojdbc14.jar for "Oracle Database 10g Enterprise Edition Release 10.2.0.3.0". My query is "Select 'column name' from dual". When i get column name using ResultSetMetaData.getColumnLabel(int coluN) it return column name including single quotes ie: for the above query result is 'columname'. Ideally it should not return ' (single quote).
    Why do this happening?

    You will have that even when you run with sqlplus.
    =
    Ashok

  • Getting Column names from SQL report

    I have a SQL report as follows:
    select ename, dept, manager
    from emp;
    I need to be able to dynamically access the column names being displayed inside APEX so I can use in a List of Values. I can't use all_tab_columns. Is there an internal APEX table/view that I can accxess that will give me all of the columns that are eing displayed in a SQL report?

    Hi Bob,
    Try this -
    1) Give your report region a static id
    2) Use the following query -
    select
      heading d,
      column_alias r
    from
      apex_application_page_rpt_cols
    where region_id = 'FOO';Obviously change 'FOO' to match your region id, and look at the different columns available in the apex_application_page_rpt_cols view to see what best suits you.
    The APEX dictionary rocks ;)
    Hope this helps,
    John.
    http://jes.blogs.shellprompt.net
    http://apex-evangelists.com

Maybe you are looking for