Spacing between columns in SQL*Plus
Is there a way to format a SQL*Plus report so
numeric columns are not preceeded by a space?
I've already have the setting SET COLSEP ''
but that doesn't work on the numeric fields.
I've also tried setting the column format
and converting the numbers to strings. Any
help will be much appreciated!!
Numeric values are preceeding with a blank because of the sign (which is not included in the definition number(3,2) = -9.99 to +9.99).
You need to convert to char and trim :
select trim(to_char(mynumber)) mynumber from mytable;
Similar Messages
-
Pages-how to set spacing between columns
There used to be a spacing option between columns in Pages. How does one change that spacing now?
In Pages v5(.2), the column and gutter settings are located on the Format > Layout panel. The Gutter setting can be changed by double-clicking on its numeric value. If you have disabled the Equal column width check box, you can also directly change each Column width as you have the Gutter. Revealing the rulers from the View menu can improve the multicolumn layout process, as column indicators appear in the top ruler.
-
Formatting output columns - ala SQL*Plus 'column' command
SQL_Developer 1.5
Is there a way to format the output of queries for numbers, etc. like the 'column' command found in SQL*Plus?
I realize I can use the TO_CHAR() function in the SQL but was hoping there was something easier.
Thanks very much!
-garyit could be that the column of the table that you are trying to insert the data has a small length.
-
Hi,
In the forms ,I need to vary the width of columns and then rearrange it with proper spacing, is there any other way rather than manually doing it.
or in other word is there way to give the specified distance between two columns which can vary from column to column if column width are different.
For example width of column may be 60,80,20....
I am new to forms.please do suggest.
Thanks
Mandar.thanks all your reply.
But Moazzam again to know x and y position you need to know the values so its kind of tidious job and can get messy at times if we have more number of columns.
the only way i get is doing it manually.
anyways Thank again for your reply
Mandar. -
I am having a time trying to get my three column to allow the background color and text to show between the columns.
You can see what I am speaking of with this link: http://digitalresponseoc.com/clients/casey/index3.html
When I float col 3 to the right it looks nice between center column and right column, but I can't seem to get the center column to "float" only in the center to allow the space between the left and center column.
I want the text to show through.
Any help would be great. Thanks in advance.Thanks for the info. Your margin idea works great.
I have the Flash removed but the idea of using the container to show the background as seen at http://digitalresponseoc.com/clients/casey/index.html is giving me problems.
The background needs to be seen through the gaps in the columns.
I am learning more about stuff but I still need to figure out how to have the columns not shift when the browser is resized. argh.
Can you point me in a direction to learn how to do this.
Thanks -
Gap between columns in sql output
Dear all,
We have the below query :
column queue_name format a15
column max_processes format 999
column target_node format a10
column actual_processes format 999
column pending format 999
column running format 999
column onhold format 999
column scheduled format 999
column phase_code format a10
column user_concurrent_program_name format a60
column responsibility_name format a45
column status_code format a15
column requestor format a20
column actual_completion_date format a25
column completion_text format a120
column execution_time_in_minutes format 999999.99
column is_it_scheduled format a15
SELECT request_id,
user_concurrent_program_name|| NVL2(fcrsv.description, ' (' || fcrsv.description || ')', NULL) conc_prog,
fcrsv.requestor
,Case
when fcrsv.requested_start_date > fcrsv.request_date Then 'YES' Else 'NO' End is_it_scheduled
FROM fnd_conc_req_summary_v fcrsv, fnd_responsibility_tl frt
WHERE fcrsv.responsibility_application_id = frt.application_id AND fcrsv.responsibility_id = frt.responsibility_id AND status_code = 'E'
AND actual_start_date > SYSDATE - 1
ORDER BY NVL (actual_start_date, actual_completion_date) DESC;which is displaying the output like below :
REQUEST_ID CONC_PROG REQUESTOR IS_IT_SCHEDULED
32906957 Receipt Import GMOTIS NO
32906857 Receipt Import GMOTIS NO The gap between the column CONC_PROG AND requestor is high , we need to have no normal gap such that the complete output can be seen in
a single screen.
Please advise
Kai936074 wrote:
Dear all,
We have the below query :
column queue_name format a15
column max_processes format 999
column target_node format a10
column actual_processes format 999
column pending format 999
column running format 999
column onhold format 999
column scheduled format 999
column phase_code format a10
column user_concurrent_program_name format a60
column responsibility_name format a45
column status_code format a15
column requestor format a20
column actual_completion_date format a25
column completion_text format a120
column execution_time_in_minutes format 999999.99
column is_it_scheduled format a15
SELECT request_id,
user_concurrent_program_name|| NVL2(fcrsv.description, ' (' || fcrsv.description || ')', NULL) conc_prog,
fcrsv.requestor
,Case
when fcrsv.requested_start_date > fcrsv.request_date Then 'YES' Else 'NO' End is_it_scheduled
FROM fnd_conc_req_summary_v fcrsv, fnd_responsibility_tl frt
WHERE fcrsv.responsibility_application_id = frt.application_id AND fcrsv.responsibility_id = frt.responsibility_id AND status_code = 'E'
AND actual_start_date > SYSDATE - 1
ORDER BY NVL (actual_start_date, actual_completion_date) DESC;which is displaying the output like below :
REQUEST_ID CONC_PROG REQUESTOR IS_IT_SCHEDULED
32906957 Receipt Import GMOTIS NO
32906857 Receipt Import GMOTIS NO The gap between the column CONC_PROG AND requestor is high , we need to have no normal gap such that the complete output can be seen in
a single screen.
Please advise
Kaiuse RTRIM or LTRIM as appropriate -
Variable Spacing Between Column Prompts
Hi,
I have a dashboard prompt. I have placed it vertically on the left side of page. I has columns from 3 dimensions. As soon as the columns for a particular dimension end i want to add some additional space before the columns of the other dimensions start. Is there any way to do that. I'm working on OBIEE 11.1.1.5.
Rgds,
RJThat was a Layout Break in Pages '09 and has been chnaged in Pages 5 along with other 90+ features removed.
http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
Pages '09 should still be in your Applications/iWork folder.
Archive/trash Pages 5 and rate/review it in the App Store, then get back to work.
Peter -
6.1 vs 10.3: between column spacing
It appears that there is a slight difference in the spacing between columns in 6.1 and 10.3
Given that we use full column width images in each of our portlets, this is now causing us to have a minor horizontal scroll in the ballpark of 10 pixels in a 3 column layout.
Does anyone know where in the CSS the control is to set the spacing between columns?
Thanks!
GeoffFound it!
6.1
<!--End Portlet Column 0-->
</td>
<td colspan="1"><img src="http://dimension.marchofdimes.com/imageserver/plumtree/portal/public/img/sp.gif" alt="" border="0" align="absmiddle" height="1" width="5"/></td>
6.5<!--End Portlet Column 0-->
</td>
<td colspan="1" id="horizontalPaddingCell0"><img src="http://dimensiondev/imageserver/plumtree/portal/public/img/sp.gif" alt="" border="0" align="absmiddle" height="1" width="10"/></td>
This is how to fix the problem in the CSS (assuming you consider it a problem)
/* Set the following 2 attributes to adjust the spacing between columns */
#horizontalPaddingCell0 img{width:5px;}
#horizontalPaddingCell1 img{width:5px;} -
SQL*Plus Raises: ORA-3113 End of file on communication channel
I have a Win2000 machine running Oracle client 8i, connecting to an HP-UX server running 9i RAC, with an unknown collection of switches/firewalls in between. Using SQL*Plus I can successfully connect and run queries. However, if I leave the session idle for some time, approximately 15 minutes (though this varies), the next query I execute hangs for a few seconds, then returns with ORA-3113.
I have enabled client-side tracing (ADMIN level). The following extract shows the point at which an error first occurs:
nsprecv: reading from transport...
nttrd: entry
ntt2err: entry
ntt2err: soc 660 error - operation=5, ntresnt[0]=517, ntresnt[1]=54, ntresnt[2]=0
ntt2err: exit
nttrd: exit
nsprecv: transport read error
nserror: nsres: id=0, op=68, ns=12547, ns2=12560; nt[0]=517, nt[1]=54, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
nsdo: nsctxrnk=0
nioqrc: wanted 1 got 0, type 0
nioqper: error from nioqrc
nioqper: nr err code: 0
nioqper: ns main err code: 12547
nioqper: ns (2) err code: 12560
nioqper: nt main err code: 517
nioqper: nt (2) err code: 54
nioqper: nt OS err code: 0
nioqer: entry
nioqce: entry
nioqce: exit
nioqer: exit
nioqrc: exit
nioqbr: entry
nioqbr: state = normal (0)
nioqsm: entry
nsdo: cid=0, opcode=67, bl=1, what=17, uflgs=0x100, cflgs=0x3
nsdo: rank=64, nsctxrnk=0
nsdo: nsctx: state=1, flg=0x420d, mvd=0
nsdo: nsctxrnk=0
nioqsm: send-break: failed to send break...
nioqper: error from send-marker
nioqper: nr err code: 0
nioqper: ns main err code: 12583
nioqper: ns (2) err code: 0
nioqper: nt main err code: 0
nioqper: nt (2) err code: 0
nioqper: nt OS err code: 0
nioqsm: exit
A google search returned one page that suggests the culprit here is the line:
ntt2err: soc 660 error - operation=5, ntresnt[0]=517, ntresnt[1]=54, ntresnt[2]=0
This apparently indicates that the network timed out, a sign of a busy network.
Can anyone:
a) Confirm this or otherwise;
b) Suggest how I may go about proving this to a corporate network operations team;
Cheers, Si.I think the reason can be timeout on one of the firewalls. Network administrators
quite often configure following setting:
"Disconnect idle connection after 15 minutes" - I facedd this problem several
times.
Best Regards
Krystian Zieja / mob -
A query runs in under 1 minute is sql plus, but takes 15 in Discoverer
I have a query that runs in under 1 minute is sql plus, but takes 15+mins in Discoverer. I use 3 parameters in discoverer which i specify as conditions in sql plus query. Any ideas on how to make it run faster??? BTW the query returns 10,000+ records. There is no formatting or sorting involved. Any ideas??? Seems the query execution plan is wrong...
Hi,
I agree with Michael to check your preference settings. Particulary since Plus/Viewer reads the pref.txt on the middle-tier and Desktop reads each individual PC registry.
I would start with checking Query Prediction setttings.
Try turning off Query Prediction. If it is not setup properly it can cause a delay. This is one difference between Discoverer and SQL*PLUS
See forum post:
Re: 20 mins and still predicting!!
Re: Different Performance between Desktop-Query and SQL-Plus
Hope that helps,
Steve. -
SQL * PLUS formatting issue
Hi, Could anyone please tell me how to BREAK on multiple columns in SQL * PLUS.
create table test (a number, b number, c number);
insert into test values(1,2,5);
insert into test values(1,3,5);
insert into test values(2,2,6);
insert into test values(2,3,6);
Before formatting
=============
SQL> select * from test order by 1,3;
A B C
1 2 1
1 3 1
2 3 2
2 3 2
After formatting the result should be
=========================
A B C
1 2 1
3
2 3 2
3
That means break on A,C and skip first record.
I tried using "break on A,C skip 1", but its not working.
Using SQL * PLUS to fire this formatting.
Thanks.break on A,C and skip first record.
I tried using "break on A,C skip 1", but its not working.
Using SQL * PLUS to fire this formatting.
Just one advice for you: RTFM
SQL>
SQL> desc test
Name Null? Type
A NUMBER
B NUMBER
C NUMBER
SQL>
SQL> select * from test order by 1, 3;
A B C
1 2 5
1 3 5
2 2 6
2 3 6
4 rows selected.
SQL>
SQL> break on a on c skip 1
SQL>
SQL> select * from test order by 1, 3;
A B C
1 2 5
3
2 2 6
3
4 rows selected.
SQL>
SQL>Note that, in your post, the results of your SELECT statement do not match the data inserted by your INSERT statement.
pratz -
Set Column width in query (not using SQL*Plus)
How can I Set Column width in query
I understand you can set column width using
column col1 FORMAT A5
select col1 from table1;But this only works in SQL*Plus
I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
I am using a 'SQL window' in PL/SQL Developer IDE
and when I use this syntax it says:
ORA-00900: Invalid SQL statement
Any suggestions are appreciated...
thanks,
M.Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
e.g.
SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM -
The subject sums it up pretty well... I have a query that works fine from SQL*Plus, but throws a JDBC exception with "ORA-00904 invalid column name" if I create a PreparedStatement from it and call executeQuery().
The query itself is substantially similar to:
SELECT foo, t.bar.getStringVal() from some_table t
where "Some table" is an oracle 9i table, "foo" is a varchar2 column, and "bar" is a column that used to be varchar2 before I dropped and re-created the table with an xmltype column instead. "t" is an alias for the table that I didn't used to need (since it's only one table), but apparently is required for getStringVal() to work.
... And, of course, .getStringVal() is being used as a convenient way to treat technically LOB-like xmltype columns as big ersatz varchar2 columns so I won't have to screw around with stream i/o just to read a 4,001-byte value into a String ;-)
I'm using the ojdbc14.jar thin driver and a fairly recent j2sdk (1.4.1_02, I think). I made a point of anihilating every copy of classes12.zip on my PC just to make sure it wasn't lurking in a classpath somewhere to screw things up.
Strangely enough, it DOES work from within Netbeans' database explorer (itself connecting to the same Oracle database using the ojdbc14.jar thin driver).
For the sake of being comprehensive, here's an example of the actual JDBC code that won't work:
public ResultSet doQuery(Connection conn, int val) throws SQLException {
String sql = "SELECT foo, t.bar.getStringVal() from some_table t where anothercolumn = ?";
PreparedStatement sth = conn.prepareStatement(sql);
sth.setInt(1, val);
ResultSet rs = sth.executeQuery();
// everything past this point is moot,
// because sth.executeQuery throws an exception...
// however, the ResultSet would ultimately be
// returned to the method's caller, and
// its values read using getString(fieldname)
// including 'bar', the xmltype field...OK, this particular problem was my fault. The original table was on a server running 8i. To spare myself the grief of having to deal with CLOBs on 8i's terms and take advantage of 9i's new conveniences for handling them, I created a new table on our other server that's running 9i and updated the app's config settings to reflect the new server. Unfortunately, I forgot that the debugging/testing main() method had the URL of the old database hardcoded (it was written before the rest of the class). Ergo... it was still looking at the old database. Oops. (*blush*).
-
Question about setting column width in SQL*Plus using info retrieved w SQL
Good morning,
Is there a way to tell SQL*Plus to set the width of a column to the greatest width of the elements found in the column ? (as opposed to the default which is the width declared in the DDL)
In other words, I'd like to do something functionally equivalent to this:
COL <columname> format a[select max(length(<columnname>)) from <thetablethatcontainscolumname>]
I'm doing the above manually in two steps
1. select max(length(columnname)) from .....
2. col columnname format a[resultofstep1]
Is there a way of doing it in one step ?
Thank you for your help,
John.Hi Munky,
>
you should consider whther you are using the correct tool for the job, SQLplus isn't exactly ideal for doing presentation layer stuff
>
I'm not really doing presentation stuff, I asked because it would be very convenient for everyday stuff. I commonly query the tables that I am going to deal withm just to have a look at the column names and a few values, something like:
select * from EMP where rownum <= 10; -- just to have a look at the table and some values
when the table contains a wide column then the display gets all messed up. It would be nice to have an option or a mechanism to tell SQL*Plus to automatically use the width of the widest value, instead of having to determine the value and then manually set the column.
thank you for your help, it's good to know that I didn't miss some trivial setting in the documentation that would do it ;)
John. -
Oracle SQL Developer 3.2, SQL*Plus COLUMN FORMAT bug
SQL*Plus command COLUMN truncates output result in SQL Developer.
Script in Worksheet:
column nn format 999
select level nn from dual connect by level<=10;The Run Script (F5) result contains only 8 lines in Script Output window:
NN
1
2
3
4
5
6
7
8
Changing column alias:
select level nn2 from dual connect by level<=10NN2
1
2
3
4
5
6
7
8
9
10
10 rows selected
The output can contain no data for more formatted columns.
===============================================================
About
Oracle SQL Developer 3.2.09
Version 3.2.09
Build MAIN-09.30
Copyright © 2005, 2012 Oracle. All Rights Reserved.
IDE Version: 11.1.1.4.37.59.48
Product ID: oracle.sqldeveloper
Product Version: 11.2.0.09.30
Version
Component Version
========= =======
Java(TM) Platform 1.7.0_02
Oracle IDE 3.2.09.30
Versioning Support 3.2.09.30sqldeveloper64-3.2.09.30-no-jre.zip.
My jdk now is 1.7.07 x64, Windows 7 x64.
C:\Java\jdk17\bin>java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
Gary Graham wrote:Also, I don't understand what you mean by
The output can contain no data for more formatted columns.
Sript:
col owner format a10
col table_name format a20
col column_name format a20
col comments format a50
select
row_number() over(order by column_name) r11,
count(*) over() c11,
owner ow,
table_name tn,
column_name cn,
comments co
from all_col_comments t
where owner='SYS' and table_name='INDEX_STATS';
select
row_number() over(order by column_name) r,
count(*) over() c,
owner,
table_name,
column_name,
comments
from all_col_comments t
where owner='SYS' and table_name='INDEX_STATS';
select 1 from dual;
prompt abcThe output truncated after headers of second queryR11 C11 OW TN CN CO
1 25 SYS INDEX_STATS BLKS_GETS_PER_ACCESS Expected number of consistent mode block gets per row. This assumes that a row chosen at random from the table is being searched for using the index
2 25 SYS INDEX_STATS BLOCKS blocks allocated to the segment
3 25 SYS INDEX_STATS BR_BLKS number of branch blocks in the b-tree
4 25 SYS INDEX_STATS BR_BLK_LEN useable space in a branch block
5 25 SYS INDEX_STATS BR_ROWS number of branch rows
6 25 SYS INDEX_STATS BR_ROWS_LEN sum of the lengths of all the branch blocks in the b-tree
7 25 SYS INDEX_STATS BTREE_SPACE total space currently allocated in the b-tree
8 25 SYS INDEX_STATS DEL_LF_ROWS number of deleted leaf rows in the index
9 25 SYS INDEX_STATS DEL_LF_ROWS_LEN total length of all deleted rows in the index
10 25 SYS INDEX_STATS DISTINCT_KEYS number of distinct keys in the index
11 25 SYS INDEX_STATS HEIGHT height of the b-tree
12 25 SYS INDEX_STATS LF_BLKS number of leaf blocks in the b-tree
13 25 SYS INDEX_STATS LF_BLK_LEN useable space in a leaf block
14 25 SYS INDEX_STATS LF_ROWS number of leaf rows (values in the index)
15 25 SYS INDEX_STATS LF_ROWS_LEN sum of the lengths of all the leaf rows
16 25 SYS INDEX_STATS MOST_REPEATED_KEY how many times the most repeated key is repeated
17 25 SYS INDEX_STATS NAME name of the index
18 25 SYS INDEX_STATS OPT_CMPR_COUNT optimal prefix compression count for the index
19 25 SYS INDEX_STATS OPT_CMPR_PCTSAVE percentage storage saving expected from optimal prefix compression
20 25 SYS INDEX_STATS PARTITION_NAME name of the index partition, if partitioned
21 25 SYS INDEX_STATS PCT_USED percent of space allocated in the b-tree that is being used
22 25 SYS INDEX_STATS PRE_ROWS number of prefix rows (values in the index)
23 25 SYS INDEX_STATS PRE_ROWS_LEN sum of lengths of all prefix rows
24 25 SYS INDEX_STATS ROWS_PER_KEY average number of rows per distinct key
25 25 SYS INDEX_STATS USED_SPACE total space that is currently being used in the b-tree
25 rows selected
R C OWNER TABLE_NAME COLUMN_NAME COMMENTS
- - ---------- -------------------- -------------------- --------------------------------------------------
Maybe you are looking for
-
BT can't fix and won't let me cancel!
Since the 18th of April we have had either no connection or intermittent connection on our BT services of phone, BT you view & unlimited broadband. I have spent hours on the phone to India, had at least six engineers visit and still have a noisy phon
-
Why does my Yahoo and Facebook account keep resetting in the 2nd profile I created?
I have 2 profiles, one for my wife and one for me. When either of us in on profile 2, our Yahoo and Facebook accounts keep logging us out. I was just on Facebook writing a response to a friend and I get a "Your not logged in" message pop up and it lo
-
Nokia E71: Messaging Button and Name and Date Form...
Two questions: 1. When in stand-by mode and I click on the Messaging button, it always directs me to my e-mail. I would like to set it as such that it will go to my Inbox, instead. 2. Is there a name separator I can use? On my inbox, the name format
-
Strange audi sync problem & different, stranger video sync issu in sequence
I have two strange occurances with one particular set of media that was downloaded from the same original source mini-dv (recording in dvcam) tape. I have not found the same issue on any other footage. 1) when the media is imported into FCP, the audi
-
i have emptied cache, restarted, re-installed, and tried typing att.net direct e-mail, but firefox reverts to att.yahoo and i get the list of topics.