How to Display Query Results in a Max Width Formatted Way?
Hi,
I want to run a query to show the columns within headers to be formatted in a way that looks equal in width. I just want to get the max width for each column and display each item in a max width format in a query. Thanks.
Ex.
First Name Last Name City
John Sumi New York
Jay Heely Texas
if you are spooling a file on sql*plus use the column formatting method.
syntax:
COL <column_name> FORMAT a<integer>example:
COL emp_name FORMAT a40
Similar Messages
-
How to display query result in seperated page.
How to display query result in seperated page, if the results are very big (more than 5000 records) and there are so many concurrent users (about 500 - 1000 users).
Are there any solutions or frameworks?
Plese help me .........
thanks,
--bhasinHi,
How to display query result in seperated page?I think RowSet will be the better technology to use in this
situation.For more information on this please visit http://developer.java.sun.com/developer/Books/JDBCTutorial/chapter5.html
which explains in detail about RowSets.
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support/ -
How to display query result like this
I got a query...gives list of names.
i want to display
11. Peter
12. Jessica
32. Leo
15. Jamie
36. Edward
how i get static number infront of my query result.
static number is not in order.Amm85 wrote:
I got a query...gives list of names.
i want to display
11. Peter
12. Jessica
32. Leo
15. Jamie
36. Edward
how i get static number infront of my query result.
static number is not in order.
You could use the function queryAddColumn to add the numbers as a separate column to the query.
Let us suppose the name of the query is "myQuery". Then you could proceed as follows
<!---Define your "static" list of numbers --->
<cfset staticList = "11,12,32,15,36,13,23,14,33,16,44,31,17,34,18">
<!--- Create an array from the static list. --->
<cfset staticNrArray = ArrayNew(1)>
<cfset staticNrArray = listToArray(staticList)>
<!--- Add the array as a column to the query. --->
<cfset nColumnNumber = QueryAddColumn(myQuery, "staticNr", "integer", staticNrArray)>
<!--- Verify whether it works as expected--->
<cfdump var="#myQuery#">
The list I have given here has 15 numbers. This will naturally instruct ColdFusion to add a new column named staticNr, having 15 rows. You might like to know that the queryAddColumn function enables padding.
Here is how it works. Suppose that the query originally had only 8 rows before you added the column(of 15 rows). Then, in the new query, ColdFusion would pad the last 7 rows of the other columns with null values. If the original query had 20 rows instead, then Coldfusion would pad the last 5 rows corresponding to the staticNr-column with null values. -
How to display query results in windows side by side in Access 2010
In Access 2010 - when I open a query the result is desplayed in a tab.
When I open a new query - a new tab is created - now in front of the other tab.
I would like to see both queries at the same time.
How is that done?Select File > Options.
Click 'Current Database' in the navigation pane on the left.
Under 'Document window options', select 'Overlapping Windows'.
Click OK, then close and reopen the database.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
How to display query variable in text element and format the text element
Hi All,
I want to display the value of the value of variable against fiscper3 and the value of the variable against 0fiscyear in the web application template from the query in the text element in the web template in BI 7 Web application designer.
Also, in the web application designer I need to format the text element in the web application designer to set the text element to center the display change the size and make it bold. I am bit lost I cannot find these properties in the web application designer against the text element.
Appreciate if you could kindly help.
Thanks
KarenHi
hope below tags would help you
Re: Search by text on a variable
Re: Need to display text part of TEXT variable in query designer
regards
nag -
How to display the result of excutions(insert/update/delete rows)
Hello.
Does anyone know how to display the result of scenario executions just like a scenario executions tab of package (insert/update/delete rows) in other screen (in the intergated operating platform for operators using http)
In additional, I also like to show the hierarchy of scenario in the same view.
So, I need the query using the information of the ODI repository.
If it is possible, I also like to have the decription of the tables in the ODI repository.
Can anyone tell me how can I get the information of the counts of excution?
Thanks in advance.Hi,
You can get that information from the API getPrevStepLog. Does it work for you?
Download the last API reference manual from:
http://www.oracle.com/technology/products/oracle-data-integrator/10.1.3/htdocs/1013_support.html#docs -
SSMS Addin - How To Access Query Results Grid
Hi,
I want to access Query Result Grid(Results) in SSMS addin but I did'nt found anything.
How can I access Query Result Grid, Rows, Columns and Cells when I executed a script?
Thanks.SQL Server Management Studio currently supports query execution results to be displayed in three different ways: Results to Grid,
Results to Text and Results to File.
By default SQL Server Management Studio is configured to display query results in
Grid format. If you want to change the default to some other option follow these steps.
1. In SQL Server Management Studio, under Tools menu, click
Options as shown in the snippet below.
2. In the Options dialog box, expand Query Results, expand
SQL Server and then select General as shown in the snippet below. In the right side panel choose one of the three options shown below in the
Default Destination for results drop down list and click
OK to save the changes as shown in the snippet below. The changes will go into effect once you open a New Query window.
Query Result Options for Results to Text
In this format you have the option to display the results in a different tab as well as setting different output options.
In the Options dialog box, expand Query Results, expand
SQL Server and then select Results to Text tab as shown in the snippet below. In the right side panel first select the checkbox for
Display results in a separate tab and then select the checkbox for
Switch to results tab after the query executes and then click
OK. If you would like to also display the column name in the result set then choose the option Include column headers in the result set
as shown in the snippet below.
The options you can use in the Text format are:
Output format: - In the above snippet you could see that by default the output is displayed as columns aligned. Some of the other options that are available are Comma Delimited,
Tab Delimited, Space Delimited and Custom Delimited. If you choose the Custom Delimited option in the Output format drop down list then you need to specify a character of your choice for the delimiter in the
Custom delimiter text box.
Include column headers when copying or saving the results: - If this option is selected, then whenever the results are copied to clipboard or it is saved to a file the column headers are also copied along with the results.
Include the query in the result set: - The text of the query is displayed as part of query output under the messages tab.
Scroll as results are received: - If this option is selected, then the display focuses on the most recently returned records at the end of the results set.
Right align numeric values: - If this option is selected, then numeric values will be aligned to the right of the column.
Discard results after query executes: - If this option is selected, then the query results are not displayed in the reviewing pane.
Display results in a separate tab: - If this option is selected, then the result set after query execution will be displayed in a new tab instead of at the bottom of the query window.
Switch to results tab after the query executes: - If this option is selected, then after the query execution the screen focus will be set to the results tab.
Maximum number of characters displayed in each column: - This sets the maximum characters to display for any one column. So if you have a column that is 500 characters this will only show the first 256 if you keep the default setting.
Ref link :http://www.mssqltips.com/sqlservertip/2346/different-options-for-query-results-in-sql-server-management-studio/
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
How to display the results in order by based on search value
Hi All,
how to display the results in the below order.
CREATE TABLE TEST( SONGID NUMBER, TITLE VARCHAR2(200))
INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)');
INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)');
INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK');
INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA');
INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)');
INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)');
INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA');
INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI');
INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE');
SELECT *FROM TEST WHERE INSTR (TITLE, 'MADONNA') > 0
output:
SONGID TITLE
10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
11 CICCONE, MADONNA (CA)
12 DALLIN, MADONNA LOUISE/STOCK
13 MADONNA
14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
15 MADONNA (CA)
16 MIRWAIS AHMADZAI, MADONNA
17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
18 MADONNA (CA),CICCONE
Expected output :
13 MADONNA
14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
15 MADONNA (CA)
18 MADONNA (CA),CICCONE
...if user searches with 'MADONNA' , I have to display the results like title starts with 'MADONNA' first then rest of the records.
Please let me know is it possible to display the results in that order.
Regards,
RajasekharThis may be a bit more accurate:
SQL> SELECT *
2 FROM TEST
3 WHERE INSTR (TITLE, 'MADONNA') > 0
4 ORDER BY INSTR (TITLE, 'MADONNA')
5 ,TITLE
6 ;
SONGID TITLE
13 MADONNA
14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
15 MADONNA (CA)
18 MADONNA (CA),CICCONE
12 DALLIN, MADONNA LOUISE/STOCK
11 CICCONE, MADONNA (CA)
17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
16 MIRWAIS AHMADZAI, MADONNA
10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA) -
How to get query result in comma dilimited text or excel file?
Does anybody know how to get query results in comma delimited
text file or excel file, I tried spool abc.txt, but the result
showed some ------ lines
ThanksTry doing this in your sql scripts
set heading off
set pagesize 0
set linesize 4000
set feedback off
set verify off
set trimespace on
set colsep ","
spool output.txt
select * from dual (or whatever you are querying
spool off
There may be a couple other set statement that you could add but
this should get you started in the right direction -
How to save query result in excel file
Hi all,
How to save query result in excel file from sql*plus tool.
thank youDo you really need an Excel file (binary) or a simple CSV?
If you just need a CSV then search for DUMP_CSV at http://asktom.oracle.com or at this forum
If you need formatting and/or multiple worksheets then you can use free tools like
https://xml-spreadsheet.samplecode.oracle.com/ or https://exceldocumenttype.samplecode.oracle.com/
Regards
Marcus -
How to return query result in procedure
Hi all,
Can anyone tell me how to return query result in pl/slq procedure using out .
thank you
regards
P PrakashProcedure for sys_refcursor:
create or replace procedure ptest(c out sys_refcursor) is
begin
open c for select * from dual;
end;Procedure for collections(although sys.ODCIVarchar2List is varray, same example you can use with "table of")
create or replace procedure ptest2(c out sys.odcivarchar2list) is
begin
select dummy
bulk collect into c
from dual;
end;Example:
declare
c sys_refcursor;
v varchar2(100);
vt sys.odcivarchar2list;
begin
ptest(c);
fetch c into v;
dbms_output.put_line('1.Cursor data: '||v);
ptest2(vt);
dbms_output.put_line('2.Collection data: '||vt(1));
end;Regards,
Sayan M. -
How to get Query Results based on Analysis Authorization Ranges????
Hi Experts,
I have gone through the lot of SDN Links, however not able to find the answer to my question.
I have an Authorization Issue, NO Authorization
Error : EYE 007 ( Insufficient Authorizations )
<b>Here is the issue:</b>
Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
<b>Its really urgent, please help..!</b>
Here are the logs:
Authorization Check Log
Date and Execution Time (Local Server)
Execution Date: 06.09.2007
Execution Time: 14:48:41
Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
Executed by User ZBI_TEST_001
Executed with Analysis Authorizations of Another User ZBI_TEST_001
InfoProvider Check
Building the Buffer...
...Buffer Built
Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
InfoProvider Check
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:
0CO_AREA
0TCAACTVT
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider :
List Is Empty:
There Are No Characteristics That Have to Be Checked in Detail
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
CO_AREA = '0003'
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Authorized
Subselection (SUBNR) Is Authorized
Authorization Check Complete
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Partially or Fully Authorized (Intersection) Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Value selection partially authorized. Check of remainder at end
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Not Authorized
All Authorizations Tested
Message EYE007: You do not have sufficient authorization
No Sufficient Authorization for This Subselection (SUBNR)
Following CHANMIDs Are Affected:
184 ( 0CO_AREA )
Authorization Check CompleteHi,
Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
Hope it helps,
Cheers,
Balaji -
How to output query results directly to a file
Hello,
I'm new to this and i need to know how to output the results of a query directly to a file instead of it displaying on the screen and then outputting to a file in SQL Developer Version 2.1.0.63.
Thanks in advance for any help!
Edited by: user13036938 on Jun 16, 2010 7:24 AM
Edited by: user13036938 on Jun 16, 2010 7:25 AMfor a really basic spool:
SPOOL [FILEPATH];
SELECT [SOMETHING] FROM [SOMETABLE] WHERE [SOMECONDITION];
SPOOL OFF;see also:
http://www.oracle.com/technology/products/database/sql_developer/files/sql_worksheet_commands.html
for a list of other useful SQLPlus commands supported by SQL Developer
Edited by: Irian on 16-giu-2010 17.08 -
How to Display Query Variables in Text Titles?
Hi experts,
I have created a web template that has a query parameter screen and then displays the results in the form of charts and tables.
My question is how do I display the parameters entered by the user in a chart title?
For example if the user enters a date range of ISO Week 19 to 23, I want to display the chart title as: "Report Results - Week 19 to 23".
I also want to do the same for a general title. I've tried using information fields, but they don't allow me to add additional text.
Maybe I need to use some java script to get the parameter value?
Keep in mind I am just starting out with this and I am using BW7.0 with the WAD.
Thanks in advance for any assistance.Thanks for your response.
I think you are referring to 3.5? Maybe 7.0 handles it differently?
I've tried entering free text and then putting in a text web item that is hooked up to a data provider with a characteristic but that only prints out the characteristic header and not the actual value selected by the user.
For example, I have the following:
Report for week <text web item>
Returns:
Report for week ISO Week
I would like it to return:
Report for week 19
Thoughts? -
Trying to display query results in 2 columns
I am trying modify someone elses existing code to display the
results of a query in 2 columns on a web page.
The result of the existing code can be seen
here
Below is the code that I am trying to modify
<table width="95%" border="0" align="center"
cellpadding="4" cellspacing="2">
<cfoutput query="News" startrow="#StartRow_News#"
maxrows="#MaxRows_News#">
<tr align="center" class="TEXTnormal">
<td nowrap class="TEXTnormal
style1">................................................................................. ...................................</td>
</tr>
<tr class="TEXTnormal">
<td><table width="100%" border="0" cellpadding="0"
cellspacing="0" class="TEXTnormal">
<tr>
<td><cfif News.ImageNameThumb gt 0>
<a href="news_view.cfm?recordID=#News.ID#"><img
src="uploadedimages/#News.ImageNameThumb#"
alt="#News.ImageCaption#" hspace="8" vspace="0" border="0"
align="left"></a>
<cfelse>
</cfif></td>
<td><a href="news_view.cfm?recordID=#News.ID#"
class="TEXThighlight">#News.Title#</a> -
#News.Day#.#News.Month#.#News.Year# <br>
#News.Summary#</td>
</tr>
</table></td>
</tr>
</cfoutput>
</table>
I have changed the above code to
<table width="95%" border="0" align="center"
cellpadding="4" cellspacing="2">
<cfset LoopEndRow = CEILING(#EndRow_News#/2)>
<cfloop
index = "row"
from = "#StartRow_News#"
to = "#LoopEndRow#"
step = "1">
<tr class="TEXTnormal">
<cfset breaker = 0>
<cfloop
index = "column"
from = "0"
to = "2"
step = "1">
<cfoutput query="News1" startrow="#StartRow_News#"
maxrows="#MaxRows_News#">
<td width="50%">
<table width="100%" border="0" cellpadding="0"
cellspacing="0" class="TEXTnormal">
<tr>
<td><cfif News1.ImageNameThumb gt 0>
<a href="news_view.cfm?recordID=#News1.ID#"><img
src="uploadedimages/#News1.ImageNameThumb#"
alt="#News1.ImageCaption#" hspace="8" vspace="0" border="0"
align="left"></a>
<cfelse>
</cfif></td>
<td><a href="news_view.cfm?recordID=#News1.ID#"
class="TEXThighlight">#News1.Title#</a> -
#News1.Day#.#News1.Month#.#News1.Year# <br>
#News1.Summary#</td>
</tr>
</table></td>
<cfset breaker = breaker+1>
<cfif breaker EQUAL 2>
<cfbreak>
</cfif>
</cfoutput>
</cfloop>
</tr>
</cfloop>
</table>
The results of this modified code can be see
Here
as you can see what I have done gives the correct number of
columns (2)
and the correct number of rows for the quantity of data (3)
however each row shows only the first 2 pieces of data
returned by the query
Can I modify the query output so that it returns pieces of
data off set by the amount of data already output?
if so how?Right off the bat, you have 2 loops and I cant see why...
So what is happening, is the outer loop is going 3 times...
for 3 rows, then your inside loop is showing the first record, the
Breaker var is breakign out of this loop after one row is shown.
Then the main loop says do it again...
You don't need nested loops to accomplish this, I dont
understand why you would think of needing that...
Looking at your code, just get rid of the outer loop... there
is no need for it. You are already looping around the query object
in the inner loop, thats all you need...
Heres some psudeo code to help you out...
loop around query maximum of 6 rows
-- display data
-- if recordcount EQ 2 or recordcount EQ 4 then
----- </tr><tr> <!--- this will make the new
row --->
end loop
Maybe you are looking for
-
I had purchased Adobe Photoshop CS2, came to realize that Adobe no longer supported activation (online or by phone). I uninstalled and downloaded again from the Adobe site: https://www.adobe.com/cfusion/entitlement/index.cfm?e=cs2_downloads The Pho
-
1616 screen goes black - Help please
I have just bought a new Nokia 1616. I have worked through all the settings but cannot find the one to stop it turning the screen off after a few minutes of non-use. The screen goes black and so you don't know if it is switched on or not. Ideally I
-
How to Stop Auto assignment of Source of Supply in SC
Hi All; We are using SRM7 classic scenario. While creating a SC, the system automatically assigns a vendor in the source of supply if there is 1 contract or 1 inforecord.If there are multiple, the system will not assign but it will show them all so
-
Hi, I have 10.2.0.3 database running on HP-UX (Itanium) and want to apply the CPU patch released April 2008. Does anyone come across any issues while applying this patch? Is there any document/link i should refer? Thanks
-
My N73 ME won't turn ON after I install PC Suite.
My Nokia N73 Music Edition won't turn ON after I update the version of my PC Suite from V 3.0638.0.0.30 to V 4.0727.2.2.1 can somebody help me with this I can no longer use my N73 ME now and I don't what to do to resolve this problem and I need your