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>
Similar Messages
-
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 -
How to pass column name as a values from one page to another
hi
i have created a report(pivot) from a table
SQL> SELECT * FROM T;
C1 C2 C3 D SEQ
A AA 2 1
A AB 3 2
A AC 2 3
B AB 5 4
B AC 6 5
SQL> SELECT C1
2 ,NVL(MAX(CASE WHEN C2='AA' THEN C3 END),'') AA
3 ,NVL(MAX(CASE WHEN C2='AB' THEN C3 END),'') AB
4 ,NVL(MAX(CASE WHEN C2='AC' THEN C3 END),'') AC
5 ,SUM(C3) FROM T GROUP BY C1;
C1 AA AB AC SUM(C3)
A 2 3 2 7
B 5 6 11
SQL>
my requirement in Apex is like this(reverse)
eg-
when i click on cell values '2' then,it should return
C1 C2 C3 D SEQ
A AA 2 1
{quote}how to pass column name as a values from one page to another
for example i have to pass 'c2' as a value to next page{quote}for report pivot you can reffer below link
Report
Amuthanks for your reply
i 'm doing what exactly you mention here .
my problem here is
i have 15 columns
i am executing a query based on the values of the column(column name) in the target page
1)here i am passing(all) the column values to the next page-but i want to pass only one column values(column name)
when i click on any cell of that column
OR
2)i can pass all column name to target page -there(in the target page) i can filter out
i think option 1 would good if you filter out the unwanted columns
Regards
Amul -
How to get column names for a specific view in the scheme?
how to get column names for a specific view in the scheme?
TIA
Don't have DD on the wall anymore....or this?
SQL> select text from ALL_VIEWS
2 where VIEW_NAME
3 ='EMP_VIEW';
TEXT
SELECT empno,ename FROM EMP
WHERE empno=10 -
How to pass column name at run time in function.
how to pass column name at run time in function as parameter.
thank in advance
pramod patelHello,
Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
p_value_number in number)
return number is
v_stmt varchar2(500);
begin
v_stmt := 'update emp
set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
where empno = 7369';
execute immediate v_stmt;
return 0;
commit;
end;
call to this function can be like this..
declare
v_number number;
begin
v_number := fun_updtest('SAL',5000);
end;
Adinath Kamode -
How to rename column name of table?
Hello...
How to rename column name of table?
The column have data.
Thanks.
Martonio.The following should work in 9i release 2 and above.
SQL> create table mytable(col1 varchar2(2),
2 col2 date);
Table created.
SQL> insert into mytable values('t1',sysdate);
1 row created.
SQL> select * from mytable;
CO COL2
t1 30-NOV-04
1 row selected.
SQL> desc mytable
Name Null? Type
COL1 VARCHAR2(2)
COL2 DATE
SQL> alter table mytable rename column col2 to mydate;
Table altered.
SQL> desc mytable
Name Null? Type
COL1 VARCHAR2(2)
MYDATE DATE
SQL> select * from mytable;
CO MYDATE
t1 30-NOV-04
1 row selected.
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Productionhttp://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/wnsql.htm#972698 -
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 get column names in table maintenance dialog?
I created a new Z table and created a maintanance dialog so that I can maintain the table through sm30. i don't see columns names on maintenance screen, just a "+" sign for each column! Could someone please tell me how to display column name?
Thanks.
MithunHello Mithun
The column texts are taken from the field descriptions of the data elements used in your z-table. A "+" sign usually indicates that none of the field descriptions of the data element has been maintained.
Regards
Uwe -
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 -
How to validate column name in dynamic made sql?
Oracle db, jdbc, web app with struts2/spring.
Example table could be this:
CREATE TABLE album
album_id number(10) not null,
artist varchar2(50) not null,
title varchar2(50) not null,
released DATE,
CONSTRAINT album_pk PRIMARY KEY (album_id)
);In may app the user MAY search, MAY sort, and the result from an select might return 10.000 rows.
The basic sql usually look like this.
String sql = "select album_id, artist, title, released from album";Then in the html page the user can add search criteria for each column. Like type "iron maiden" in artist field, put "1982" in released field. And you all know what the exceptionally result should be from that :)
Now I need to modify the sql a bit:
if( artist search field contains stuff )
sql = sql + " where nvl( artist,' ') like ?"
}we try use prepared statements right? So we use ? as placeholders, and then add "iron maiden" into this statement later on.
Nice, no big fuzz right, and pretty safe from sql injections i guess.
But now I have to have an if/else for every single field in the table. Boring. In my app I got like 25 tables like this, with 20 columns minimum. Copy/Paste have never been so boring.
I also might have to add "order by" with user selected columns and their order. I have to count the query to get total result in case i got to split it up in pages. So there is alot of if/else and sql = sql + "more stuff", and sticking to ? and pure prepared statements is impossible.
But doing this is not good either:
for( each element in a map)
sql = sql + " and nvl( " + key + ",' ') like ?"
}Where key is "artist".
In struts and other tag libs its easy to make kode like:
<s:textfield name="model.addSearch( 'artist' )" value="%{model.getSearch( 'artist' )}" size="30" />
Silly example maybe, but just to make a point.
Inputed values in an html form, can very easily be a part of a dynamic created sql - which becomes a security problem later on.
Artist is an column name. Key should be validated if it contained an valid column name.
I could make a list of strings, containing valid column names to check against.
My question is if there is possible to get this type of information from the database, so I don't have to hand-make these lists?
But I also want to keep the number of heavy and slowing queries down.
My app have like 25 tables now, and I could easily get away with hand-make everything, copy/paste around etc. But I have more projects and this question will be here next time too. And after there again...Etharo wrote:
Metadata. Then I have to query the database, take the result and use it for validating of input. If my sql only query 1 table, then this is ok. In this case I could do with that. But if the sql query mutliple tables, with sub-selects, unions etc. Then I might have to query all tables first, and even then I might not have what I want.
The best way is of course to run the query, then get the metadata from that query - cause then im 100% sure what columns will be returned, and then I can validate with that.... 1 query is often not that slow. But I might query once to find total number of rows the query return in order to decide if we need to page the result. then query to get the metadata for validating input, then query to get the result... Maybe this is ok -but my head don't like it as an general ok thing to do, but I can't really say why...If you have a gui screen then it needs to correspond to some specific query. It can't be all possible combinations.
So once you know the query you can obtain the meta data using a query that returns no results. Like the following.
select * from mytable wheren 1 = 0
>
Jschell:
I agree to what you say. I don't understood everything you said tho.
Im not sure if you talk about having 1 search field (like google), and you input stuff there that might be in any columns.
I have several search fields in one-to-one relasionship with view column/sql query column.
Then you already know what the field represents. So validate it in the gui and not via the database.
The first is way more advanced since you have to cover any input, any column, any case etc. Pluss add ranking. Lots of work for someone who have done little searchengines.
Latter is simpler, but might also be limiting.Huh?
As an example if you have a call center then the operators are not going to be doing unrestricted searches to find customers. They are going to look using a very limited set of data like the customer name and telephone number.
>
My job is very much like an consulent. They got an app, I shall add a new feature. The app is old and ugly coded. My boss ask how long it takes to make this, I say 2months, he decide 1 month. My dev time for features is rarely above 1 month, and I don't make much new apps.
So I don't have the time to make advanced codegenerator, or spend time to evaluate various frameworks. Bringing an framework into the existing code is actually difficult. But I do want to improve the code, and add good code into the existing app that can be extended without evil pain.
That doesn't jive with your OP. You made the following statement "My app have like 25 tables now, and I could easily get away with hand-make everything,...".
That suggests that you are doing much more than simply updating an existing application.
If you only need to add one new field then you should do only that. You shouldn't be attempting to add a system spanning validation system.
On the other hand if you are in fact adding a validation system, then code generation makes it likely that it would take less time or no more than the same. And it is less likely to introduce bugs.
Learn how to make an code generator? Well I guess thats what I asked help for - point me in the right direction if you could pls. Putting strings together to become code in an logic way is usually manageable, at least for simple querys. Evaluating that the generated code is good/safe - got no good clues...
Learn about frameworks? Got no time. Hope I will get the time, but I won't. The customer must want to spend the money so I can get the time, that won't happen cause an framework does not add features, its only cost saving in terms of dev time, and maintenance time. The customer have no such focus/interest. They got a bit money to spend now and then regularily. i.e. government.
I just want to try code as good as possible so I save myself from errors, painfull rewrites, and dev-time that gets out of proportions because of stupid code. So the question is actually about me trying to improve myself, its just that i don't know how right now.There are two goals.
1. Implement a specific feature in an existing application.
2. Learn a new way to solve problems.
Nothing says that the second will help with the first. They should be addressed separately and your post doesn't make it clear what the first is so it is hard to say how it should be down.
As for the second I already made a suggestion which provides two new ways to solve problems. -
Parse SQL: How to extract column names, table names from a SQL query
Hi all,
I have a requirement wherein a SQL query will be given in a text file.
The text file has to be read (probably using text_io package), the SQL query needs to be parsed and the column names, table names and where clauses have to be extracted and inserted into separate tables.
Is there a way to do it using PL/SQL ?
Is there a PL/SQL script available to parse and extract column names, table names etc ?
Pls help.
Regards,
SamI think I jumped to conclusion too early saying it is completely possible and straight forward. But after reading through your post for one more time I realised you are not interested only in the column_names, also the table_names and the predicates .
>
SQL query needs to be parsed and the column names
>
The above is possible and straight forward using the dbms_sql package.
I am pasting the same information as I did in the other forum.
Check this link and search for Example 8 and .
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm#sthref6136
Also check the working example from asktom
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1035431863958
>
table names and where clauses have to be extracted
>
Now this is the tricky bit. You can extract the list of tables by getting the sql_id from v$sql and joining it with v$sql_plan. But sometimes you may not get all the results because the optimizer may choose to refine your query (check this link)
http://optimizermagic.blogspot.com/2008/06/why-are-some-of-tables-in-my-query.html
and you can get the predicate information from the same table v$sql_plan but I will leave that area for you to do some R&D.
Regards
Raj
Edited by: R.Subramanian on Dec 10, 2008 3:14 AM -
How to list column names and data types for a given table using SQL
I remember that it is possible to use a select statement to list the column names and data types of databaase tables but forgot how its done. Please help.
You can select what you need from DBA_TAB_COLUMNS (or ALL_TAB_COLUMNS or USER_TAB_COLUMNS).
-
How to concatenate column name in PL/SQL
Here is ex.
I want to execute like this
for i in 1 .. 18 loop
EXECUTE IMMEDIATE 'select qty_sz'||i||' from table1';
end loop;
I mean Can I cancatenate column name with a variable?
your advice is gretly Appeciated.
Ram.It would be a lot easier to diagnose your problem if you posted the error message. Oracle has an awful lot of error messages.
I thing I have noticed is this:
EXECUTE IMMEDIATE mysql into var1 using 'qty_sz'||i ;
You have an implicit datatype conversion there, i being a number and you can only concatenate varchar variables. There is a little wrinkle in this, in that to_char seems to put a space in front of any number. So try this:
EXECUTE IMMEDIATE mysql into var1 using 'qty_sz'||ltrim(to_char(i));
and see if it makes any difference.
Another problem will be if your columns are like this: qty_sz01, qty_sz02,...qty_sz8. because the default mask doesn't incude the leading zero so in that case you should specify the mask in the to_char(i, '09')
If neither of those fixes your problem post the your error message.
rgds, APC -
Sorting report columns for PL/SQL report
I have created a report of type "Pl/Sql function body returning Sql query" in which I am generating the column names within the query. I would now like to make the first three of these columns sortable. But when I click on the "sort" box for the first three columns, all my column names suddenly switch to "Col 1", "Col 2" etc.
As you can see by the following snippet from the PL/SQL that generates the query, the column names are data driven, so I'm not in a position to declaratively rename each column. As it happens, the first three columns names are fixed, but all the subsequent column names are data driven.
Suggestions on how to make the first three columns sortable while preserving the generated column names of the remaining columns?
thanks
susan weber
declare
query varchar2(4000); -- query
begin
query := 'select first_name "First Name", last_name "Last Name", encounter_date "Encounter Date" ';
for c1 in (select distinct attr_src, attr_code, attr_text, sequence_number from finding_vt)
loop
query := query || ', (select val_text from finding_vt vt where vt.encounter_id = e.encounter_id and vt.attr_src = ''' || c1.attr_src || ''' and vt.attr_code = ''' || c1.attr_code || ''' and sequence_number = ' || c1.sequence_number || ') "' || substr(c1.attr_text,0,30) || '"';
END LOOP;
query := query || ' from patient pat, encounter e where pat.patient_id = e.patient_id';
return query;
end;This turns out to be related to the choice of "use generic column names" v. "use query specific column names".
I had chosen "use generic column names" just to get past the initial creation page. I then debugged the query creation sql, but never changed that setting back to "use query specific column names". The fix is to choose "use query specific column names". -
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,
Dancould 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
Maybe you are looking for
-
Getting error while posting invoice in T-code F-02
Hello, When i try to post invoice in T-code F-02 gives me the error message"There is no item category assigned to account bank a/c/company" Can any one suggest me why this is error came up and how to resolve this. Thanks, Lavi
-
HT1719 why doesnt my 1st generation ipod shuffle appear on my devices on itunes?
Why doesnt my 1st generation ipod shuffle appear under my devices on itunes when i plug it in? i have windows 7. I got the ipod today from a friend with their music. i deleted their music and added my own to the folder it was in. but when i unplugged
-
Error Message at JIT & FRC schedule Release
Hi all, I am getting error at JIT & FRC schedule Release in ME38 & ME84 "Error generating release against scheduling agreement (cause 2)" Message no. 06857 Help to create Jit & Frc Schedules Venkat
-
Hey All, I am trying to use GUI_DOWNLOAD to download some HR data to an excel file and was running into some issues. 1] After downloading all the data to the excel file when I open the excel file the coulms are by default displayed in same colum
-
Is there any way to restrict adding himself as a approver in scenarios?
Is there any way to restrict adding himself as a approver in scenarios?