How to rename C00n generic column names in a Dynamic SQL report

I have a an interface whereby the user can select 1 to 60 (upper limit) columns out of 90 possible columns (using a shuttle) from one table before running a report.
To construct the SQL that will eventually execute, I'm using a "PLSQL function body returning SQL query" with dynamic SQL. The only problem is that I have to use "Generic Column Names" option to be able to compile the code and end up with c001 to c060 as the column names.
How can I use the names of the selected columns as the report headings rather than c001, C002... etc?
I do not know beforehand which columns, or how many columns or the order of the selected columns.
I know Denes K has a demo called Pick Columns but I can't access his code. I have a hunch though that he may be just using conditions to hide/show the apropriate columns.
thanks in advance
PaulP

Hi Paul
I would change the Heading Type in the Report Details screen to PLSQL and use the shuttle item to return the column values. e.g.
RETURN :p1_shuttle;
I'm assuming the shuttle already has a colon separated list of the column headings in the correct order?
I hope that helps
Shunt

Similar Messages

  • How to know a table column name in HTML (Hyperion Interactive Reporting).

    Hello,
    I have a Hyperion Interactive Reporting dashboard section with an embembed table section on it.
    The dashboard it will be open only in HTML.
    I put the table as Active, so i can interact with her.
    So, what I need to know now is how can I know the column name or number when I double click in one cell of the table.
    Can anyone help me with this?
    Thank you in advance,
    Carlos

    Views don't have primary keys though their underlying tables might. You'd need to pick apart the view to determine where it's columns are coming from.
    You can select the text of the view in question from user_views.

  • How to use the column names generated from Dynamic SQL

    Hi,
    I have a problem with Dynamic SQL.
    I have written an SQL which will dynamically generate the Select statement with from and where clause in it.
    But that select statement when executed will get me hundreds of rows and i want to insert each row separately into one more table.
    For that i have used a ref cursor to open and insert the table.
    In the select list the column names will also be as follows: COLUMN1, COLUMN2, COLUMN3,....COLUMNn
    Please find below the sample code:
    TYPE ref_csr IS REF CURSOR;
    insert_csr ref_csr;
    v_select VARCHAR2 (4000) := NULL;
    v_table VARCHAR2 (4000) := NULL;
    v_where VARCHAR2 (4000) := NULL;
    v_ins_tab VARCHAR2 (4000) := NULL;
    v_insert VARCHAR2 (4000) := NULL;
    v_ins_query VARCHAR2 (4000) := NULL;
    OPEN insert_csr FOR CASE
    WHEN v_where IS NOT NULL
    THEN 'SELECT '
    || v_select
    || ' FROM '
    || v_table
    || v_where
    || ';'
    ELSE 'SELECT ' || v_select || ' FROM ' || v_table || ';'
    END;
    LOOP
    v_ins_query :=
    'INSERT INTO '
    || v_ins_tab
    || '('
    || v_insert
    || ') VALUES ('
    || How to fetch the column names here
    || ');';
    EXECUTE IMMEDIATE v_ins_query;
    END LOOP;
    Please help me out with the above problem.
    Edited by: kumar0828 on Feb 7, 2013 10:40 PM
    Edited by: kumar0828 on Feb 7, 2013 10:42 PM

    >
    I Built the statement as required but i need the column list because the first column value of each row should be inserted into one more table.
    So i was asking how to fetch the column list in a ref cursor so that value can be inserted in one more table.
    >
    Then add a RETURNING INTO clause to the query to have Oracle return the first column values into a collection.
    See the PL/SQL Language doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/returninginto_clause.htm#sthref2307

  • Column name in link on sql report?

    Hey guys -
    Is there some way to put the column name of a report in a link?
    When you define a link on a column you have the ability to use a substition string for the VALUE of a particular column... but I want to somehow pass the string value of the column.... anyone know how to do this?
    Thanks

    Not the value of the column.. I want the actual column name...
    i.e.
    Items on page to set:
    txtbox1
    txtbox2
    Query:
    Channel          INS1     INS2     INS3     INS4
    Retail          13     1     333     55
    Wholesale     4234     23     1     44Okay, so I want to make a link on the values in the query (the #'s) to set the values of the txtboxes...
    example would be if I click on 333 I want it to set txtbox1="Retail" and txtbox2="INS3"
    The channel one is fine I just use the substition string of #COL1# in the link and it replaces the value... but nothing that I can find on how ot set txtbox2="INS3"
    Edited by: nferreri on May 15, 2009 9:51 AM

  • How to modify a table column name

    Hi all,
    How to modify a table column name...
    Thanks

    could type the command here... but will not do that..because you are supposed to read the docs.
    You can find the command here..
    http://www.faqs.org/docs/ppbook/r22871.htm
    Regards,
    G.

  • APEX 4.0 "Use Generic Column Names" not working

    Hi,
    I have a report which is a SQL query (PL/SQL function body returning SQL query) in APEX 4.0. For this region i have selected the option "Use Generic Column Names (parse query at run time only)".
    For some reason when I run the page the browser just shows the error "The requested URL /apex/f was not found on this server". This happens only for the region type "SQL query (PL/SQL function body returning SQL query)" . If I choose the report region as SQL query and select the option "Use Generic Column Names (parse query at run time only)" That works fine. This happens only in APEX 4. Is it an apex 4 bug or am I missing something?
    Thanks
    Sashika.

    Hi,
    Just managed to get it running. The Apex 4.0 SQL query (PL/SQL function returning SQL) works just fine. I had a small error in the query itself. In the PL/SQL function I had a referenced page item whose value in the initial run is set to null which is making the fuzz. Just adding an NVL resolved the problem.

  • Multi Row Selector using Generic Column Names (parse query at runtime only)

    Hi,
    I created a tabular report which had a multi row select in it - got the deleting working fine.
    Am now creating a second tabular report, but because of the SQL:
    select
    "ID",
    "ID" ID_DISPLAY,
    "RESNUMBER",
    "RESDESCRIPTION",
    decode(RESTYPE,'R','Right Party','W','Wrong Party'),
    decode(DMCFLAG,'Y','Yes','N','No'),
    decode(SALEFLAG,'Y','Yes','N','No')
    from "CALL_RESULTS"
    I have to select the option Use Generic Column Names (parse query at runtime only) otherwise I cannot save the form.
    My problem is I am now unable to add a multi row selector to the tabular form. If I do and run the form I get the following error - failed to parse SQL query: ORA-00904: "COL11": invalid identifier. Also when I go back and edit the form the multi row selector has been removed.
    Can anyone tell me why I can't add a row selector like I previously could?
    Regards
    Simon

    Arie,
    I added aliases and to the decode columns, and I can now add a row selector to the form without any problems.
    Thank you very much for your help.
    Regards
    Simon

  • Need to know the column names in my dynamic select clause

    Dear All,
    Please go through the following code. While executing the following code i am getting an error saying that dbms_sql.describe_columns overflow, col_name_len=35. Use describe_columns2.
    Please guide me how to proceed further. Or please help me, how can i get the column names when i issue a dynamic select clause.
    DECLARE
    CUR INTEGER;
    COL_CNT INTEGER ;
    A INTEGER;
    SEL_CLAUSE VARCHAR2(2000);
    DESC_T DBMS_SQL.DESC_TAB;
    REC DBMS_SQL.DESC_REC;
    b number;
    BEGIN
    SEL_CLAUSE := 'SELECT 1,2,DECODE(1,1,''ONE'',2,''TWO'',3,''THREE'') FROM DUAL';
    --'SELECT ROWID,PARA_SUB_CODE,DECODE('||''''||'ENG'||''''||','||''''||'ENG'||''''||',PARA_NAME,PARA_BL_NAME),NULL,NULL FROM PCOM_APP_PARAMETER';
    --'SELECT 1,2,DECODE(1,1,''ONE'',2,''TWO'') FROM DUAL';
    DBMS_OUTPUT.PUT_LINE( SEL_CLAUSE );
    CUR := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(CUR,SEL_CLAUSE,DBMS_SQL.NATIVE);
    DBMS_SQL.DESCRIBE_COLUMNS(CUR,COL_CNT,DESC_T);
    B := desc_t.first;
    FOR J IN 1..COL_CNT
    LOOP
    DBMS_OUTPUT.PUT_LINE('J := '||J || ' COL CNT ' || COL_CNT);
    END LOOP;
    BEGIN
    A := DBMS_SQL.EXECUTE(CUR);
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    END;
    Regards,
    Balaji

    Is there any way can i have it directly??It does not work with static SQL either. Dynamic SQL is no different.
    SQL> select 1 x from dual where x = 1 ;
    select 1 x from dual where x = 1
    ERROR at line 1:
    ORA-00904: "X": invalid identifier
    SQL>As suggested already, you will need to use alias if you want your select expression to be referred in the where clause.
    SQL> BEGIN
      2      FOR rec IN (SELECT *
      3                  FROM   (SELECT 1,
      4                                 2,
      5                                 DECODE(1, 1, 'ONE', 2, 'TWO', 3, 'THREE') "DECODE(1, 1, 'ONE', 2, 'TWO', "
      6                          FROM   DUAL)
      7                  WHERE  "DECODE(1, 1, 'ONE', 2, 'TWO', " = 'ONE')
      8      LOOP
      9          NULL;
    10      END LOOP;
    11  END;
    12  /
    PL/SQL procedure successfully completed.
    SQL>Message was edited by:
    Kamal Kishore

  • 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

  • Pass column-name as a parameter to reports

    Hello,
    the code below calls a report. But now I want to sort the rows in the report. For example I have a text-item in my form-modul. If I type a column-name and press the button then the rows should be sorted in the report. Is it possible tp pass column-names as parameter to reports?
    DECLARE
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status VARCHAR2(20);
    BEGIN
    repid := find_report_object('STATIONSTOPOLOGIE');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,RUNTIME);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'html');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_oracle-dev');
    -- SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no pdeptno='||:dept.deptno);
    v_rep := RUN_REPORT_OBJECT(repid);
    rep_status := REPORT_OBJECT_STATUS(v_rep);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(v_rep);
    END LOOP;
    IF rep_status = 'FINISHED' THEN
    WEB.SHOW_DOCUMENT('http://oracle-dev:8888/reports/rwservlet/getjobid'||
    substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=rep_oracle-dev','_blank');
    ELSE
    message('Error when running report');
    END IF;
    END;

    Hi,
    the work has been done in reports. You can use a lexical parameter in reports to add a condition for sorting to the query like:
    select .. from .. where ... &p_order.
    Then add another parameter to the report (for example p_param). Fill p_param via your interface in forms (SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER, ....) with the column name. Then build a report trigger like:
    if :p_param is null
    then
    :p_order:= null;
    else
    :p_order:= 'order by '||:p_param;
    end if;
    But have a look, that p_param can only get correct values.
    Rainer

  • How can i get the column names in CSV file.

    Hi,
    After execution of infospoke i can not see the column names in that file.How can i get column of respective infoprovider?
    Thanks,
    Gananadha Lenka

    Hello Gana,
    Actually while exporting the data using Info Spoke, we have the possibility to modify the data that we send. This is possible using transformations.
    In your Info Spoke, you have a tab called Transformations.
    Here you need to create an implementation and then use BADi to populate data.
    Check if you can write a start routine sort of thing here and insert a new record into the internal table by hardcoding with your field headings.
    Let me know if you dont know how to create transformations.
    Kris...

  • How to know primary key column name form a table name in sql query

    Suppose I only know the table name. How to get its primary key column name from the table name?
    Thanks

    Views don't have primary keys though their underlying tables might. You'd need to pick apart the view to determine where it's columns are coming from.
    You can select the text of the view in question from user_views.

  • How to obtain the updated column name in a trigger?

    Hello everyone,
    I need to know for audit propose the updated column name in a After Update Trigger on a Table.
    The table have more than 20 columns, and i think that do more than 20 conditions asking for the difference between the :new value and the :old value is not the best way.
    Thanks for the help!
    LCJ

    Hi,
    Thanks to all for the replays.
    I didn't know that i can pass the column name to the UPDATING. This is only possible on 10g??
    Any way, i pass the column name and works fine, but i have another issue because of that.
    I obtain the column name from a cursor that query user_tab_columns view, when i try to obtain the value of the :old or :new, i can't because i don't know how to obtain the value of the value.
    This example show better:
    DECLARE
    vOldValue Varchar2(50);
    Cursor cur_Column_Names Is
    Select COLUMN_NAME
    From User_Tab_Columns
    Where TABLE_NAME = 'table_name';
    BEGIN
    For var_cursor In cur_Column_Names Loop
    If Updating(var_cursor.COLUMN_NAME) Then
    vOldValue := '?'; -- How obtain the value of the :old. + >var_cursor.COLUMN_NAME??
    End If;
    End Loop;
    END;Thanks to all for the help.
    LCJ

  • How to refer to a column name in the domain constraint

    When we specify a check constraint (for SQL Server) within a domain we need to enter some syntax expression, for example
    len(phone) > 7
    Later the modeller will put exactly this expression into SQL code. But this would be wrong as constraint should refer to a column name in the table (which would not be "phone").
    So how to make Data modeler to put a real column name within domain constraint?

    Thank you very much, it really works!
    However I would like to know where I can get documentation on such internal variables (like %COLUMN%)? I find it difficult to locate this information in the Help file attached to a modeler (it seems that it only describes UI screens).

  • 11g bi publisher data model generic columns names for obiee data source?

    I'm just trying to figure out if this is a bug, expected behavior or installation problem. When I select an Oracle BI Analysis to add to the data model diagram the column names are not copied over. Instead they are all renamed as Column0-ColumnNN.
    Thanks
    Edited by: user13087422 on Apr 7, 2011 9:49 AM

    I'm facing this same issue. Can you solve that? What's the problem with it?
    Regards,
    Ariel

Maybe you are looking for

  • Why do I receive error -1073807339 VISA Write

    I have a LV app built using LV2010 SP1 on a WinXP 32-bit machine.  The app uses VISA to communicate serially through a RS232 to USB adpater to a pump.  I can run the compiled app (exe) on another Win XP 32-bit machine without error.  But the app gene

  • SCCM 2012 SP1 - Multiple SUP - common WSUS DB

    Hello, Is it supported / recommend to share a common WSUS DB for multiple WSUS / SUP roles ? If yes, how to perform a clean deployment of additional SUP dealing with additional KB requirements.Following article explains the problem but the solution l

  • Federated Portal Registration

    Hi, I have Problem With WSDL in not Get Connected thanks swati

  • Next and Previous Document menu items greyed out

    I have Reader 8.1 and the next document and previous document menu items under View > Go To are greyed out, even though I have several document open and they show up in the windows menu. Any thoughts? Thanks.

  • RE: GPU disabled with NVidia 8800GTX, 2 weeks and no fix yet!

    Hi folks My hard drive crashed while back...had to reinstall everything. Now, for some reason Photoshop refuses to enable OpenGL access even though before I was able to use Photoshop with my video cards. I have reinstalled the app multiple times, res