Need to display column names in a dynamic page
Hi
I am displaying some rows returned from an sql querry in a dynamic page ...I hv written the sql querry between <ORACLE> AND </ORACLE> TAGS...The problem is ,i am not able to display the column names ...Why ? pl help....
ram
You must to use the htp package. Example:
<ORACLE>
begin
htp.tableopen('1','CENTER',null,null,'BORDER="1"');
htp.tableheader('NParte','CENTER');
htp.tableheader('Descripcisn','CENTER');
htp.tableheader('Precio/Unit','CENTER');
htp.tableheader('Servicio','CENTER');
htp.tableheader('IVA','CENTER');
htp.tableheader('Total','CENTER');
for cursor_cotiza in (select
r.Nparte as Nparte, r.Descripcion as Descripcion,
r.preciounit as preciounit,
NVL(f.servicio,0) as servicio,
round((0.145)*r.preciounit,3) as IVA,
round((0.145)*r.preciounit,3) + r.preciounit +
NVL(f.servicio,0) as PrecioTotal
from
carryin.repuestos r,
carryin.casos c, carryin.facturacion f
where r.NCaso =:NCaso
and r.Ncaso=c.NCaso
and c.Ncaso=f.Ncaso(+)
and f.servicio(+)<>0
union
select
r.Nparte as Nparte, r.Descripcion as Descripcion,
r.preciounit as preciounit,
NVL(f.servicio,0) as servicio,
round((0.145)*r.preciounit,3) as IVA,
round((0.145)*r.preciounit,3) + r.preciounit +
NVL(f.servicio,0) as PrecioTotal
from
carryin.casosneq r,
carryin.facturacion f
where r.NCaso =:NCaso
and r.Ncaso=f.Ncaso(+)
and f.servicio(+)<>0
) loop
htp.tableRowOpen('CENTER','CENTER');
htp.tableData(cursor_cotiza.Nparte,'CENTER');
htp.tableData(cursor_cotiza.Descripcion,'CENTER');
htp.tableData(cursor_cotiza.preciounit,'CENTER');
htp.tableData(cursor_cotiza.servicio,'CENTER');
htp.tableData(cursor_cotiza.IVA,'CENTER');
htp.tableData(cursor_cotiza.PrecioTotal,'CENTER');
htp.tableRowClose;
end loop;
htp.tableclose;
end;
</ORACLE>
This example show a table with header and borders. You must to see this package for more information.
Similar Messages
-
Need to display COlumn headers dynamically in ALG Grid
Hello,
I need to display column headers dynamically in alv grid Display with its corresponding value.
Column headers should be picked from a field in Final Internal table and its corresponding field will also need to pick from the same table.
T_final... Suppose Field STCTS - (To pick coulmn headers)
CCNGN - (To pick appropriate value for that column)
Can anybody explain me how i can pass these values to ALV Grid using
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = Y_I_FCAT
IMPORTING
EP_TABLE = DY_TABLE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Any suggestions will be appreciated....
Regards,
KittuHi,
Go thru this link, and the code of Mr.Dev Parbutteea
Re: Probelm with Using Field Symbol in FM
thanks
Mahesh -
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,
BalajiIs 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 -
Not displaying column names in dynamic pages?
I'd like to use a dynamic page as a detail page. In doing this I need a bit more freedom of design than what I now know is possible. Most important - I only need to print out the values returned by the SQL, not the column names as well. And I need to define the colors and fonts of the html table tags surrounding the returned values. How?
It seems a bit strange that I am allowed to change the look and feel of the surrounding page elements through defining my own templates, and then have Oracle define how the elements placed in the templates are to appear.Hi,
It is not possible to change the format the output coming from the <oracle> tags.
Thanks,
Sharmila -
Need to create a dynamic caption(column name) in a dynamic table
Hi All,
I have created dynamic table .But the dynamic column is not showing.I have created two column name that is name and empId .I have tried with following code
IWDCaption nameCap=(IWDCaption)view.createElement(IWDCaption.class,"nameCap");
nameCap.setText("Name");
tabColumn1.setHeader((IWDCaption)nameCap);
IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
addCap.setText("Address");
tabColumn2.setHeader((IWDCaption)addCap);
I m getting internal server error...But When i m comented the above code i can able to see tha dynamic table withput column name..Can anyone help me
SumanHi
IWDTableColumn tabColumn1 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"N_Co");
IWDTableColumn tabColumn2 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"A_Co");
IWDInputField nameText = (IWDInputField)view.createElement(IWDInputField.class,"N_Text");
nameText.bindValue(attrib1);
tabColumn1.setTableCellEditor((IWDTableCellEditor)nameText);
IWDInputField addText = (IWDInputField)view.createElement(IWDInputField.class,"A_Text");
addText.bindValue(attrib2);
tabColumn2.setTableCellEditor((IWDTableCellEditor)addText);
<b>I need to see the column name.....</b>
for that i have written the following code...
while writting the following code i m getting internal server error
IWDCaption nameCap = (IWDCaption)view.createElement(IWDCaption.class,"nameCap");
nameCap.setText("contribution_area");
tabColumn1.setHeader((IWDCaption)nameCap);
IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
addCap.setText("SUM");
tabColumn2.setHeader((IWDCaption)addCap); -
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 -
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 -----------> RecordsMy 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 -
ALV Report - displaying column name in two fields.
Dear All,
I am working on ALV report , report is ready but now i have to format it according to client requirment, in which have to show column name in two row like.
supppose there is field by name
"Date of receipt of processed Goods"
can i display it like
"Date of receipt of
processed Goods "
Assured points for suitable answer.
Looking foward to your response.
Best Regards,
Gulrez AlamHi Ellery,
As Philipp said, there is no need for populating the field using PL/SQL. You would just need to go to the Paper Layout in the Reports Editor, click on "Text" in the Drawing toolbar, drag it to the appropriate place in your layout to create the field, and write what you want in that field. Below that, you can create the field(s) which will display the actual totals. I'm assuming that creating the totals field is not a problem.
Navneet. -
ADF swing: JTabbedPane does not display column names.
Hi all,
I have created an ADF Panel, which allows the user to run a few simple queries against an Oracle database done using ADF view objects and ADF view links and ADF application module.
From the data control area I drag and drop a view link containing a query into a JTabbedPane. But when I run the ADF panel, JTabbedPane does not display the column headers from the SQL as opposed to JScrollPane which does.
Suppose you do a select * from departments(dep_id, manager, state_cd), you will see all column headers meaning dep_id, manager, state_cd, and under each column the corresponding data which was retuned by the SQL if you use JScrollPane. But if you use you use JTabbedPane then you would only see the data which was retuned by the SQL without seeing the column header names meaning dep_id, manager, state_cd.
What do I need to do to make JTabbedPane display columns headers?
I would appreciate your input.
Thanks.
Bobby A.Hi,
JScrollPane should be used. You can add this into a JTabbedPane if you like. Not all Swing panel show table headers
Frank -
Can the column names be changes dynamically in OBIEE presentation
Hi,
Is thr any way through which I can change the column names depending on the value of a column.
the table structure is
Plan_name Character1 Character2 Character3 ....
so here according to plan_name the meaning of each character column changes. And I want to display each type of meaning on the presentation layer.
I cannot create aliases as the number of different plan name is 1200.
Any help will be appreciated.
Regards,
Akansh AgarwalHi,
I haven't tested these options, but you might. Maybe you try to supress the header for your table with data. After that, create a second table, which will be used as the header, and insert the same number of columns as the first table.
So on the 'header' table, create a conditional style (Criteria, Column Properties, Conditional Formatting), pointing to the values on shown in the first table. (You maybe need the data to be queried in both).
If this does't work, you can try to adapt the javascript shown in this blog: DELIVER BI OBIEE 11g &amp; 10g , ODI , OBIA: OBIEE Table make a row BOLD with JAVA
And instead of making the row bold, change the value.
Hope this helps. Sorry if it does't work.
Best regards. -
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
PaulPHi 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 -
Column names of a dynamic internal table
Hi Friends,
I have a dynamic internal table flowing in my ABAP program and I want to list down the column names of the this dynamic internal table.
The declaration of this dynamic internal table :
FIELD-SYMBOLS:
<l_t_data> TYPE STANDARD TABLE.
Can you please tell me how to get the column names?
Thanks,
GauravHi,
You can use ABAP Runtime Type Identification to get the column names of the internal table.
e.g >
>lo_itab holds reference to description object of internal table whose column names i have to extract.
>Using method describe_by_data of class cl_abap_typedescr export the field symbol assigned to the table and import the object reference into lo_itab.
>Then using method get_table_line_type of lo_itab import line type description object reference into lo_line.
>Check if lo_line is referring to a structure, if yes , downcast it to a object reference lo_struct of type cl_abap_structdescr.
>The column description of all columns in the structure is stored in 'components' table of cl_abap_structdescr.
So loop at the table to get all the column names stored in column 'name' of table 'components'.
Thank You. -
Displaying Column name in a text field
I am running a report in a spreadsheet format using the across orientation..
the last column is a total total of the previous columns and I need to display a title 'weekly totals' at the top of this column,,
I am trying to write code to return a text string
'Weekly Totals'to populate this field/
I have tried the following
declare
title_name varchar2(20);
begin
title_name:=('Weely Sales Totals');
return title_name;
end;
thanksHi Ellery,
As Philipp said, there is no need for populating the field using PL/SQL. You would just need to go to the Paper Layout in the Reports Editor, click on "Text" in the Drawing toolbar, drag it to the appropriate place in your layout to create the field, and write what you want in that field. Below that, you can create the field(s) which will display the actual totals. I'm assuming that creating the totals field is not a problem.
Navneet. -
Display column name in sql*plus
Hi,
How to display full column name?
there are n no of tables, i have to query the tables but i want the column name to be displayed fully. for example
SQL> desc control
Name Null? Type
CODE NOT NULL VARCHAR2(255)
LOAD_PERIOD_START_DATETIME DATE
SQL> select code,load_period_start_datetime from control;
CODE
LOAD_PERIOD
AAA
01-AUG-2007
SQL> col load_period_start_datetime format a30
SQL> /
CODE
LOAD_PERIOD_START_DATETIME
AAA
01-AUG-2007
SQL>
As it is only one column i can set with 'col <column_name> format a 30'
if there are n no of coumns from n no tables then how do i get the full column name?
Please help me.
ThanksHi,
you can get all the column's for a TABLE from all_tab_columns this VIEW, why dont you write as script which will generate the commands.
Could you please tell us why do you want to display the compete COLUMN NAME in SQL plus.
Thanks -
How to display Column Names of a Database Table in JSP
Dear All,
I want to display all the attribute names(column names) of a database table on JSP.
[ ex: mytable contains : ( EmpId,EmpName,Dept ). This should be display as EmpId--text box
EmpName--text box
Dept----textbox
please note , i don't want to display values,but only column namesYeah make use of methods like
ResultSet DatabaseMetaData.getColumns(String catalog, String schemaPattern, String tableName, String columnNamePattern)
else use
String ResultMetaData.getColumnName(int column_index)
search google i'm sure u wud get thousands of example on it... :)
Maybe you are looking for
-
Calling a function from another class - help!
I realize that this is probably a basic thing for people who have been working with JavaFX for a while, but it is eluding me, and I have been working on it for over a week. I need to call a function that is in another class. Here's the deal. In Ent
-
When I Update My Nano, I get error message, "file not found"
When I Update My Nano, I get an error message, "file not found, cannot update iPod". I have looked through the manual and tried reinstalling the iTunes program but it still won't update my iPod with music or pictures. PLease help.
-
Itunes just does not open - no error
itunes just stopped opening - no error message. tried software update...seems to install fine, but itunes still won't open
-
Need help buying products!
O.K. I found this really great site(s) with some really cheapish products. Are these sites legit? I figured some of you guys may know. 1. Hard Core Mac, http://store.yahoo.com/hardcoremac/macosxcd.html (IS THIS DISK FULL INSTALL. I HAVE 8.6. WILL THI
-
I am looking for a straight answers as to if it is possible to print a PDF silently, perhaps using Adobe SDK? The criteria are: Print from Windows 7, Using .Net/ C#. No GhostScript No Adobe Reader popup. No Printer Dialog (Printer properties will be