Query output result on shell is a big mess
Hello,
I just installed Oracle Express on Ubuntu 11.10. Then I tried using SQL*PLUS by running the query "select * from hr.employees;". But the output was a mess. Can anyone help me with formatting the output?
Besides, I want this to be a permanent change not just for the current session.
This is how it looks after I ran the query "select * from hr.employees;"
http://img21.imageshack.us/img21/4639/screenshotat20120113210.png
Edited by: 908010 on Jan 13, 2012 11:17 AM
Set off with a wider console using SET LINESIZE 180. Then add few useful settings like SET PAGES 50000 for having headers printed only once every 50k rows, SET TAB OFF to prevent replacing of multiple spaces with tab characters plus SET TRIMOUT ON and SET TRIMSPOOL ON to get rid of trailing spaces at line ends.
To format individual columns use column clause:
column first_name format a20
column last_name format a20
column email format a30Finally, to make these persistent, place them in either site global configuration script under $ORACLE_HOME/sqlplus/admin/glogin.sql or local one at ~/login.sql.
Similar Messages
-
Result Row in the query output
Hi,
If I restrict a characteristic by hierarchy then I cant have the result row displayed. If the hierarchy active is removed then the result row gets displayed. All characteristics are marked to show the result row.
This characteristic is Account Number. If in the query definition I remove the restriction on account numbers and just select hierarchy active and the required hierarchy in the properties then I get the result row in the output. But now it also displays all the unassigned account numbers in a separate node Not Assigned Account Number (s).
I cant even restrict it in the output with hierarchy active selected. When I do select filter value in the output the options Include in Selection and exclude from Selection are grayed out and hence cant select it.
Please advice on this issue
Thank you,
samHi Jaya,
I think you misunderstood my issue.
My problem is not that i do not want to see the field. But instead, i do not want to see only the results row in the query output.
I need to have the results to populate a calculation via sumct formula.
My question is, can sumct be populated if i hide/supress RESULT row ?
Regards,
Maili -
Modifying the text "Result" and "Overall Result" in a BEx query output
Hi,
1) Is it possible to modify the text "Result", "Overall Result" which appears in the sub-total and grand total lines of BEx query output? I do not see any related setting the properties area of the object in BEx Query designer. Do I have to write some VB code or can I do something in Customer Exits?
Also my client wants that this text need to be made dynamic such as "Sub-Total for the month of Jan 2006".
I can use work book option and change the texts manually.But this is not meeting my clients requirement.
2)Is it possible to have dynamic title text for a BEx query?
We are on BW 3.5 & if any of you could provide / guidance to the above issue.
Thanks,
VenkatramYou will have to use VB Macros to change the text "Result" and "Overall Result", there is not settings in the query designer for the same.
You can have dynamic descriptions for queries using text variables like Expense Query for month of Jan 2006, if user selected Jan 2006.
Thanks. -
To download the query output to falt file
Hi all,
i have a query which i know will give more than 65k records as the output for a selection.
i cannot run this query in excel due to its limitation.
if i run on web i cannot download this as downloading is happening to excel file only.
The customer ideally wants to download the query result to a text file(csv,tab-delimited etc) which inturn it will upload to MS-Access.
How do i achieve this?
SAP has given response use try using these options:
1.open interfaces to receive the output of a query via the MDX language.
2.open hub tool as it is designed for big amounts of data.(i suppose this is not possible as i want to download query output not the data target contents)
how do i achieve my scenario with option 1?
Are there any alternatives??
Any useful help will be rewarded.
Regards,
Dhanya.hi vivek,
thnks for the useful reply.
i have some problem with my ID,hence loggin in through my coleague's ID.
i will assign u points as i get logged in.
I did as u said by downloading it to unconverted format.
the file got download to a text file.where the output has
1.header rows(10 lines almost)
2.the values r coming in single quotes e,g:
'144000023073 'TAAS SETTLEMENT CONV 738 '19333000 '30.09.2006 '0.000
how can i remove all this?
Regards,
Dhanya
I -
Output results to more columns...
Hi!
I have problem, for which I didn't find solution yet.
I have query and this query returns the unknown count of rows (this row count is unknown in time of developing). I would like output results of this query to more than one result column to the screen.
Example:
I would like output results like this:
Result 1 Result 3 Result5
Result 2 Result 4
so the number of the rows is minimal!!!
It can be called real down/across!
(not like this:
Result 1
Result 2
Result 3
Result 4
Does anybody know the generic solution, how to do?
Thanks!
nullPlace the data models as you want and design with additional frames
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by abcdefgh:
Hi!
I have problem, for which I didn't find solution yet.
I have query and this query returns the unknown count of rows (this row count is unknown in time of developing). I would like output results of this query to more than one result column to the screen.
Example:
I would like output results like this:
Result 1 Result 3 Result5
Result 2 Result 4
so the number of the rows is minimal!!!
It can be called real down/across!
(not like this:
Result 1
Result 2
Result 3
Result 4
Does anybody know the generic solution, how to do?
Thanks!<HR></BLOCKQUOTE>
null -
Want to See Selected Input Variables in the query output
Hi al
My client gives a requirment like they want to see selected variables in the query output. Like suppose if i am entering Profit center, controlling area, version, caldayas a input on the screen. Now they want to see only Profit center and version on the query result.
Please let me know if any one has this solution.
Regards,
Amit ShetyeHi
Can you please give us user requirement and according to ure requirement so we given replies . If ure requirement please explain detail
But it is not neccessary that we can put something in free char and all. Inspite of that they wanted to select the input variable as per their requirement. They dont want to restrict them in Free char. -
Query Builder results seem to max out at 500 lines. How to change?
Hi all,
Some of out Application Express users are using the Query Builder tool for ad-hoc reporting. The idea is to run the SQL to extract the data, then download to MS Excel. The Query Builder results seem to max out at 500 lines. I want to increase that value. I searched all Application Express forums for 'query builder output max 500' and then 'query builder output' and did not find the answer.
How do I change the 500 line limit in Query Builder results?
Thanks!
Application Express 3.1.2.00.02
Oracle 10g
Standard PDF printing (not BI Publisher)Bryan,
Here is a link to an HTML-DB studio application, that is a QBE "replacement" for the query tool in APEX development..
http://htmldb.oracle.com/pls/otn/f?p=18326:7:1387557504245687::::P7_ID:1222
It is for an older version of APEX, but you should be able to make it work for your needs..
Thank you,
Tony Miller
Webster, TX -
Dear All,
We have a query developed in BI 7.0 version. Today when i excuted the query I couldn't able to see to output for any selections.
The same query fetches result when I exeute in RSRT transaction.
The query is created on a infocube. I have only one customer exit code for infoprovider and that too works fine..
I couldn't able to track why the query is not able to give result when i excute in query designer (or) the web templete which contains this query.
Will this occur due to any setting change in querHi ,
Even we faced a similr problem , like the query runs fine in RSRT but throws runtime error in portal.
so when we remove zero suppression form query properties the query used to ran fine in portal.
smilary, when we unhide the field which is hidden , again the query ran fine in portal.
similarly, when we remove result row suppression the query ran fine....just have a try if any of these works for u.
finally our problem has been sent to sap.
Regards,
Priya. -
Jump to search term in a query output...
Hi,
I have the results of a query outputted in a table. Depending
on the user, this can be a longish query - maybe 100+ results. All
these results have a checkbox next to them. The user checks the
records they need to select, then submits the form to take that
list of records in the "check" variable to another page which
processes it.
What I'd like to be able to do is provide a search box on top
of this table, for the user to type in a search term in the record
they want to find. Then, I'd like the page to jump down to that
record so the user can check it. But here's the kicker - I don't
want to lose any other already-checked boxes. So the form variable
needs to persist, even if this is done multiple times.
Any ideas on how this might be accomplished? I don't mind if
the search has to be tied just to one field, etc. And I'm not
asking anyone to write the code for me. Just point me in the
direction of the right technique/technology, if ya can.
Thank you!Hi,
It might be worth checking out some of the Ajax libraries for
this. jQuery (
http://jquery.com) has a plugin
called ScrollTo (
http://plugins.jquery.com/project/ScrollTo)
that lets you easily scroll to a specific position or element (or
other) item on a page. The developer has more details on his site (
http://flesler.blogspot.com/2007/10/jqueryscrollto.html).
You could use the ScrollTo plugin in concert with one of the
Auto Complete plugins for jQuery (one of them:
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/).
Hope that helps get you started. -
Anyway to supress the coulmn names in the query output from SQLPLUS
Hi,
I am using sqlplus to run a script which returns the results with column names.
Is there anyway to omit the column names from the query output from sqlplus?
I would like to have only results with out their column names in the output.
Thanks in advance!!Hi,
Maybe your LINES(IZE) isn't set ?
SCOTT>set lines 130
SCOTT>select status, machine, module
2 from v$session
3 where upper(username) = 'SCOTT';
STATUS MACHINE MODULE
INACTIVE PFAE3\VPC4894-03 TOAD 9.7.2.5
ACTIVE PFAE3\VPC4894-03 SQL*Plus
2 rows selected.
SCOTT>As an alternative to setting linesize, you can format columns:
SCOTT>set lines 80
SCOTT>col status for a8
SCOTT>col machine for a30
SCOTT>col module for a30
SCOTT>select status, machine, module
2 from v$session
3 where upper(username) = 'SCOTT';
STATUS MACHINE MODULE
INACTIVE PFAE3\VPC4894-03 TOAD 9.7.2.5
ACTIVE PFAE3\VPC4894-03 SQL*Plus
2 rows selected.
SCOTT>Regards
Peter -
The Query output should bring 0 from 0 records
Hi Guru's
I have a critical requirment in my project, I have to build an query on BW statistics Multi provider ( 0BWTC_C10 ).
The Query should result an output with an exception when any data load brings 0 from 0 records to the info provider
Please suggest me as what key figures and the stucture i need to take in the query in order to get the desired output.
Respond ASAP as the ticket should be closed today
Thanks in advanceHi KR MR,
Try with thses info objects
0TCTREQSID Data Request (SID)
0TCTIFCUBE InfoCube
0TCTMNRECO Records (WHM Process)
& use time characteristics..........
if u want u can additional char like........source system for navigational purpouse.................
Regards,
Vijay. -
Inserting Selection Criteria in Query Output
Hello guys
How can I insert a "Selection Criteria" for a query in its output. The final outcome should be:
1. The user runs the query.
2.The Selection Criteria pops up. The user enter the values. Then executes the query.
3. The query is displayed:
a. It has the Free Charcteristics in the left hand side top corner.
b. The query results below it.
c. And on the top, in the middleof the query, over the results area, the selction criteria should be displayed like:
<b> Plant : 0353
Free Material : Empty Demarcation
Characteristics Fiscal year / Period : 001/2007
Query Output</b>
Can this be done in BEx? Do i need a create a workbook? how do i do this?
Thanks.Hi Prasad,
Create a workbook so that you will be able to place results at defined locations.
For displaying all selection criteria in the workbook choose layout > Display Text Elements . Delete the text elements that you do not wish to display.
Jaya -
Coldfusion tags within query output
I have a simple query to a SQL database that returns a record
set. Within the record set is a field that contains HTML and CFML.
When I display the content it reads the CF tags literally. Is there
any way to get the CF tags to be processed when it is returned in
the query output? See example below.
------------------ CODE ON PAGE
<CFQUERY name="getdata" datasource="DSN">
select ID, HTMLFIELD
from TABLENAME
where ID = '1'
</CFQUERY>
<CFOUTPUT QUERY="getdata">
#getdata.HTMLFIELD#
</CFOUTPUT>
-----------------------VALUE OF "HTMLFIELD"
VARIABLE--------------------------------
<CFSET todaysdate = #DateFormat(Now(), "mm/dd/yyyy")#>
<p>Today is #variables.todaysdate#</p>
------------------------WHAT IS DISPLAYED IN THE
BROWSER----------------
Today is #variables.todaysdate#
-----------------------WHAT should BE DISPLAYED IN THE
BROWSER------------
Today is 06/14/2006Pete is right, very risky.
I've done a similar feature for a site I wrote that allowed
users to edit pages on the fly, only I pre-selected functions that
could be used and created wrappers for them. Then the users would
insert something like $now()$ in the WYSIWYG. Then when the page
was requested I would pass the data containing HTML and psuedo-CFML
through parse routine which would render the end results in a
controlled manner.
I would really recommend this route as you will have much
more controll over the types of scripts that can be run. It is also
easy to make buttons that insert the code for them.
HTH -
Wrong query output..
Guys,
Please can someone help me ? I am getting a wrong query output.. There is data available for 31-DEC-2006 but the below query doesn't seem to display it.. What could be the reason ? The query displays results for all date except 31st
SELECT date_inserted ||','||
COUNT (DECODE (HR, '00', user_id)
) ||','||
COUNT (DECODE (HR, '01', user_id)
) ||','||
COUNT (DECODE (HR, '02', user_id)
) ||','||
COUNT (DECODE (HR, '03', user_id)
) ||','||
COUNT (DECODE (HR, '04', user_id)
) ||','||
COUNT (DECODE (HR, '05', user_id)
) ||','||
COUNT (DECODE (HR, '06', user_id)
) ||','||
COUNT (DECODE (HR, '07', user_id)
) ||','||
COUNT (DECODE (HR, '08', user_id)
) ||','||
COUNT (DECODE (HR, '09', user_id)
) ||','||
COUNT (DECODE (HR, '10', user_id)
) ||','||
COUNT (DECODE (HR, '11', user_id)
) ||','||
COUNT (DECODE (HR, '12', user_id)
) ||','||
COUNT (DECODE (HR, '13', user_id)
) ||','||
COUNT (DECODE (HR, '14', user_id)
) ||','||
COUNT (DECODE (HR, '15', user_id)
) ||','||
COUNT (DECODE (HR, '16', user_id)
) ||','||
COUNT (DECODE (HR, '17', user_id)
) ||','||
COUNT (DECODE (HR, '18', user_id)
) ||','||
COUNT (DECODE (HR, '19', user_id)
) ||','||
COUNT (DECODE (HR, '20', user_id)
) ||','||
COUNT (DECODE (HR, '21', user_id)
) ||','||
COUNT (DECODE (HR, '22', user_id)
) ||','||
COUNT (DECODE (HR, '23', user_id)
) ||','
FROM (
select distinct user_id,
trunc(date_inserted) date_inserted,
to_char(date_inserted,'HH24') HR
from production.gl_user_game_sessions ugs
where date_inserted between '01-DEC-2006' and '31-DEC-2006'
AND exists( select 1
from production.gl_user_registrations gur
where gur.registration_site = 'rokes.com'
and gur.user_id = ugs.user_id)
order by user_id,trunc(date_inserted))
group by date_inserted
order by date_inserted
Date,00:00 to 00:59,01:00 to 01:59,02:00 to 02:59,03:00 to 03:59,04:00 to 04:59,05:00 to 05:59,06:00
01-DEC-06,66,47,23,20,11,9,23,45,59,82,68,78,77,87,85,101,118,129,129,140,139,142,132,111,
02-DEC-06,88,53,29,24,15,19,15,38,53,66,83,96,85,116,128,139,133,132,123,102,133,125,113,113,
03-DEC-06,100,68,45,23,18,14,21,19,42,75,87,87,82,92,103,72,0,111,225,170,165,125,124,81,
04-DEC-06,70,42,25,36,8,15,22,35,58,68,54,75,78,78,101,90,125,130,132,112,107,132,122,81,
05-DEC-06,56,44,25,12,6,16,28,28,69,89,65,75,67,86,110,90,104,123,123,144,137,140,109,83,
06-DEC-06,54,36,24,11,12,13,21,28,60,72,61,89,67,73,105,94,104,106,131,127,170,123,134,85,
07-DEC-06,58,26,23,17,11,9,22,31,59,63,69,75,82,79,103,79,102,106,150,138,178,163,126,103,
08-DEC-06,59,45,19,17,12,10,24,35,59,57,75,64,68,59,92,101,108,123,131,119,133,129,110,80,
09-DEC-06,77,50,28,21,14,16,19,32,65,61,69,87,107,109,106,114,121,122,94,113,113,110,131,101,
10-DEC-06,73,57,42,16,21,18,20,25,34,61,44,88,62,88,96,127,140,107,141,115,117,126,93,78,
11-DEC-06,58,32,17,8,6,8,14,29,57,62,76,73,58,72,96,95,102,98,129,126,124,148,117,92,
12-DEC-06,67,37,20,15,11,16,19,33,62,76,75,55,67,71,75,98,103,101,116,119,134,121,120,88,
13-DEC-06,57,37,11,15,3,14,2,0,9,73,61,59,59,75,85,87,97,107,122,124,143,129,124,105,
14-DEC-06,55,39,14,16,11,17,25,35,40,61,54,62,69,68,87,79,108,99,118,132,132,142,124,82,
15-DEC-06,69,39,21,26,12,13,17,27,50,64,69,60,74,88,88,92,115,105,114,127,106,123,117,114,
16-DEC-06,77,59,27,24,20,16,17,24,41,68,75,98,82,87,90,111,103,122,102,99,131,71,117,103,
17-DEC-06,84,47,22,17,13,13,12,25,40,59,45,56,72,82,85,96,88,106,107,117,149,116,105,82,
18-DEC-06,51,24,29,12,15,10,10,28,38,38,48,47,59,80,72,74,91,103,100,116,119,123,139,83,
19-DEC-06,53,36,17,12,11,23,20,29,58,77,70,71,62,83,81,89,106,104,101,120,130,118,125,94,
20-DEC-06,60,32,12,18,11,14,17,27,53,56,66,67,76,65,103,103,125,92,112,123,109,130,108,86,
21-DEC-06,50,29,22,16,9,12,22,34,35,58,78,71,62,85,101,105,110,124,129,147,156,129,108,88,
22-DEC-06,64,36,23,28,20,14,31,44,58,49,65,78,76,81,109,117,139,138,141,121,112,130,128,94,
23-DEC-06,95,67,31,28,22,13,21,32,40,48,80,76,83,105,123,126,118,155,131,124,147,124,135,106,
24-DEC-06,84,53,44,31,15,18,22,33,36,58,76,82,91,90,113,124,118,113,98,108,117,124,107,91,
25-DEC-06,71,54,40,15,12,20,17,22,38,61,56,70,63,73,94,93,109,97,87,100,98,109,85,84,
26-DEC-06,56,45,18,23,13,14,14,18,35,48,73,82,95,115,143,153,136,147,111,110,138,125,96,85,
27-DEC-06,82,42,27,18,13,13,27,18,37,60,65,87,78,94,164,166,171,147,160,143,120,150,118,115,
28-DEC-06,98,51,38,28,18,22,16,25,49,57,78,82,95,129,145,135,145,142,133,157,183,165,131,136,
29-DEC-06,93,62,32,20,16,13,24,31,51,72,71,84,96,110,179,166,190,167,156,153,142,162,148,114,
30-DEC-06,94,66,44,28,18,18,21,21,41,53,95,87,91,139,161,154,201,162,150,166,152,128,144,133,
SQL> Thanks in advance
GHi,
try this:
where date_inserted between to_date('01-DEC-2006 00:00:00','DD-MM-YYYY HH24:MI:SS') and to_date('31-DEC-2006 23:59:59' 'DD-MM-YYYY HH24:MI:SS')(not tested) -
Hi,
I have created procedure to analyze tables. I tried to get output but its not displaye in a proper way. I want to output as like as a query output.
create or replace procedure tablestats
as
begin
for cur in (SELECT OWNER,TABLE_NAME, NUM_ROWS, BLOCKS, AVG_ROW_LEN,TO_CHAR(LAST_ANALYZED, 'MM/DD/YYYY HH24:MI:SS')FROM DBA_TABLES WHERE OWNER='SCOTT') LOOP
dbms_output.put_line(cur.owner||' '||' '||cur.table_name||' '||cur.NUM_ROWS||' '||cur.BLOCKS||' '||cur.AVG_ROW_LEN);
DBMS_STATS.GATHER_TABLE_STATS('scott',cur.table_name);
end loop;
end;
Output came lke this:
SQL> exec tablestats
SCOTT DEPT 4 4 20
SCOTT EMP 14 4 38
SCOTT SALGRADE 5 4 10
SCOTT SERVICE 8 5 12
SCOTT BONUS 0 0 0
PL/SQL procedure successfully completed.
Acually i want output like..
1* SELECT OWNER,TABLE_NAME, NUM_ROWS, BLOCKS, AVG_ROW_LEN,TO_CHAR(LAST_ANALYZED, 'MM/DD/YYYY HH24:MI:SS') Last_Analyzed FROM DBA_TABLES WHERE OWNER=
'SCOTT'
SQL> /
OWNER TABLE_NAME NUM_ROWS BLOCKS AVG_ROW_LEN LAST_ANALYZED
SCOTT DEPT 4 4 20 11/27/2013 19:10:44
SCOTT EMP 14 4 38 11/27/2013 19:10:44
SCOTT SALGRADE 5 4 10 11/27/2013 19:10:44
SCOTT SERVICE 8 5 12 11/27/2013 19:10:44
SCOTT BONUS 0 0 0 11/27/2013 19:10:44
Please help me.
Thanks,Hi,
As John said, PL/SQL doesn't give you any of the nice formatting features that front end tools, like SQL*Plus, provide. If you want headers, you have to say exactly what they are, and write them yourself. If you want the columns to line up, you have to decide how long they will be and pad them yourself. It's a lot of work.
Why not let PL/SQL do the things that only PL/SQL can do, and let SQL*Plus do the things it does well? Have your procedure or function return a cursor, which you can then diplay in SQL*Plus, or write a piplined function, that you can use in queries where SQL*Plus can format the results.
The query you posted can eaisly be done directly from SQL*Plus, of course. I assume you posted a very simple example, becuase your question is just about display. If you don't absolutely need PL/SQL, don't use PL/SQL. What I said above applies if you really do need PL/SQL.
Maybe you are looking for
-
Using itemCreationPolicy with a custom component
I'm working on a project where the users need to be able to have a 'filtered' view of one of the edit dialogs. I'm using view states to control which of the input fields show up for each view. The 'save' logic is the same for both states, so I still
-
Dreamweaver 8, ASP VBScript, Access Database. http://www.trajectorysquared.com I have a blog set up using a CMS, where I make a post that is submitted to a table specifically for posts. Users can also make comments on the posts, which are submitted i
-
Nesting of names in Adresse Book, bug?
I´m getting a weird thing with my contacts, on several contacts it seems like new sub-adresses are added on one main contact like this: the main email-adresse (on the left) is not added by me to the contact-list, but is probably there as a cc in some
-
Hi I have requirement to update BOM and Routing . Please suggest me BAPI or functional module to Update BOM and Routing . Thanks Uday
-
Hi, OS: IBM-AIX Oracle: Oracle10g 10.2.0.3.0 I created Oracle user with relavent groups. With logging in as oracle user, I can perform DBA activities. My senario is that, I have to create oracle equivalent user say (neworacle). So I have created newo