SQL PLUS set column output side by side
I am trying to match my colum data with my row so when i query the data at least its readable side by side inside of top and bottom
cus_id
cus_name
999996
Allen
999997
Cameran
I want the ouput to look like this
cus-id cus_name
999996 Allen
999997 Cameran
thanks
Edited by: user11232525 on Dec 10, 2009 10:37 AM
i tried that the the ouput this look messy - see below
CUS_ID
CUS_NAME
999901
Eaton
999902
Lane
999903
Cody
thanks
Similar Messages
-
Preference equivalents for relevant SQL*Plus set commands?
I know that the SQL*Plus set command is not supported in Raptor (as per http://www.oracle.com/technology/products/database/project_raptor/sql_worksheet_commands.html), but there are a number of set options that are relevant.
For example, set define (for which "set define off" is covered in Ampersand in scripts We have a number of existing SQL scripts where we have set the define character to something apart from & to avoid issues where this is a required value in the code.
Setting server output size is another option - as per set serveroutput on size unlimited .
Is there any proactive plan to provide preferences equivalent to the set options that are relevant (to either SQL scripts or the various output tabs)? Or is the exclusion of the SQL*Plus set command only for the current version and it will be included later? From the discussion on the forums so far, it seems as though you are looking at each set option as it is raised, rather than being proactive about it.
Even if Raptor does provide preferences, it would still be useful for the equivalent set commands to work. Lets say that we do get a preference for the define character - 99% of the time, scripts want this to be & - however there are some where the script wants it to be $ (or whatever). With a preference, I need to know what the script wants and change the preference before running the script and then change it back afterwards.Hi Turloch,
When is this script executed ?
In 3.1EA2 I created a sql script where a variable is defined and set this script as you suggested.
Script:
define varname=abc
When I open a connection, a worksheet is automatically opened. I run this statements:
select '&varname' from dual;
define varname=xyz
select '&varname' from dual;
Running the first select statement results in a popup window for entering a value for the substitution variable, while I was expecting the value abc as the result of the query.
See also this blog where the login script is explained.
But in my SQL Developer 3.1EA2 64-bit on Windows 7 it doesn't work like that.
Is this a bug?
Dennis -
W'azup with SQL Developer barfing on SQL*Plus "set" commands
Check out this short script and the results it generates, as pasted below.
I can't find anything in the SQL Dev documenation re: what SQL*Plus set commands it supports and which it considers "passe." I'm particularly puzzled by the "column ... format ..." command getting ignored.
set heading off
set pagesize 0
set linesize 80
set feedback off
prompt ...start...
column x format a5
select 'abcdefghij' x from dual;
prompt ...end...
line 1: SQLPLUS Command Skipped: set heading off
line 2: SQLPLUS Command Skipped: set pagesize 0
line 3: SQLPLUS Command Skipped: set linesize 80
...start...
X ----------
abcdefghij 1 rows selected
...end...For supported SQL*Plus commands: SQL Developer Help > SQL Developer Concepts and Usage > Using the SQL Worksheet > SQL*Plus Statements Supported and Not Supported in SQL Worksheet.
The "column ... format ...." command is not supported. A workaround is to use substr in your select statement.
See also How to set a column size in sqldeveloper? -
SQL * PLUS - setting wrap on for column
hi all, i am playing around with sql plus and i encountered the following problem.
1) is length 10 the default column length for columns with number datatype in sqlplus, i done a select statement and all my column for number have a length of 10
2) why cant i format the length of a number column. i type column empno format 999
although my numbers become #### but "empno" and a length of 10 is still shown at the column name instead of just "emp"
3) how come a column name canot be wrapped
when i set wrap on.
set wrap on
column ename format a3
only the values of ename are wrap
but the column name "ename" isnt wrap
into ena
me
thanks.Some examples :
TEST@db102 > select 1234567890123 from dual;
1234567890123
1.2346E+12
TEST@db102 > set numwidth 15
TEST@db102 > /
1234567890123
1234567890123
TEST@db102 > col ename for a3 wrapped
TEST@db102 > select ename from emp where empno=7902;
ENA
FOR
D
TEST@db102 > You can find everything in the documentation -
SQL*PLUS: Setting a concrete RETURN CODE
I don't know how to force a concrete EXIT CODE for in a SQL*PLUS process.
I use "WHENEVER SQLerror EXIT SQL.SQLCODE" and a "EXIT SQL.SQLCODE;" at the end of the process.
But I need to be able to exit the process with a sqlcode "54" or "23" or whatever I want...
Any suggestions?
WHENEVER SQLerror EXIT SQL.SQLCODE
DECLARE
BEGIN
END;
EXIT SQL.SQLCODE;
-------------------------------------------------------You can just do EXIT n to exit with integer return code n.
$ sqlplus dqm
SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jan 11 11:48:46 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> exit 54
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
$ echo $?
54 -
Sql Plus Setting where It must searching Scripts
Hi
How can I to define inside Sql Plus with command , where It must search scripts
Why when I put :
@myscript.sqland inside there is other scripts, It not found
unable to open file "CONTIG_PS_LOC_ITM_TYPE.SQL"CONTIG_PS_LOC_ITM_TYPE.SQL is in same directory myscript.sqlHey
inside the your first script you can execute the second one as "@@CONTIG_PS_LOC_ITM_TYPE.SQL"
for the first script you can give the absolut path or the default path is $ORACLE_HOME/rdbms...
Regards -
Hi,
I have a requirement for a report , report output should be in Excel.
I created a sql query using user defined functions and inline query. I registered the query in concurrent program with XML output. When I run the request i'm getting the below error
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'http://opusapp1.co.pinellas.fl.us:8010/OA_CGI/FNDWRR.e...
If the output is text then i got the output. I need the XML output, so that i can create XML template.
Thanks for your help.Please post the details of the application release, database version and OS.
Please see if (Report Output Error: The XML page cannot be displayed. Cannot view XML input using style sheet. [ID 753620.1]) helps.
Also, see old threads for similar discussion about generating Excel output format -- http://forums.oracle.com/forums/search.jspa?threadID=&q=Excel+AND+XML+AND+Publisher&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
SQL Plus: Set pagesize and line size
Can anyone help me make my output look better...... output below....what do I need to set?
CUST_ID
CUS_NAME
1
Leroy
2
Rama
3
Riley
4
Adena
5
Stuart
6
Jena
7
Tanisha
8
Shellie
9
Ignacia
10
Reubenbtw you can use ** tags for preserving formatting code and results in this forum. See the FAQ for more formatting help.
-
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
- - ---------- -------------------- -------------------- -------------------------------------------------- -
A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql
Hello everybody,
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>
OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
So, here is how I proceed
SET SERVEROUTPUT ON; -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
SET SQLBLANKLINES ON;
VARIABLE mysid NUMBER
VARIABLE myserial# NUMBER;
VARIABLE saved_sql_id VARCHAR2(13);
-- So first I store sid and serial# for the current session
BEGIN
SELECT sid, serial# INTO :mysid, :myserial#
FROM v$session
WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
END;
PL/SQL procedure successfully completed.
-- Just check to see the result
SQL> SELECT :mysid, :myserial# FROM DUAL;
:MYSID :MYSERIAL#
129 1067
SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
BEGIN
SELECT prev_sql_id INTO :saved_sql_id
FROM v$session
WHERE sid = :mysid AND serial# = :myserial#;
END;
PL/SQL procedure successfully completed.
SQL> SELECT :saved_sql_id FROM DUAL;
:SAVED_SQL_ID
9babjv8yq8ru3
SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
SELECT child_number, sql_id, sql_text
FROM v$sql
WHERE sql_id = :saved_sql_id;
CHILD_NUMBER SQL_ID SQL_TEXT
0 9babjv8yq8ru3 BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
Problem with dbms_xplan.display_cursor
This was precisely what I did
SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
Could anyone kindly make some clarification?
thanks in advance,
Regards,
Dariyoosh>
and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
Hi Dariyoosh,
SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
Here below what Tom Kyte is explaining in this page:
Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
Al -
SQL*Plus and NLS_DATE_FORMAT
So, I haven't visited this topic in a long time, so I'm trying to refresh my memory on how everything works ...
We set our NLS_DATE_FORMAT at the system level ... what ... 4 years ago to 'MM/DD/RR'. Despite the fact that I set this to something more commonly-used than the default of 'DD-Mon-RR', we've adopted the standard of always using TO_DATE() with an explicit format, just in case it's ever changed.
There were some applications that missed the standard, and now that a driver (for ColdFusion) has been updated, these SQL statements are now failing.
When I started looking into it, I realized that the system-level default of 'MM/DD/RR' should work fine. But, after experimenting in SQL*Plus and TOAD, I am thinking that either:
1) the system-level format is not being used
2) and/or there are login scripts which are setting these to something else
Coincidentally, both SQL*Plus and TOAD return the exact same query results:
SQL> select *
from NLS_INSTANCE_PARAMETERS
where parameter = 'NLS_DATE_FORMAT';
PARAMETER VALUE
NLS_DATE_FORMAT MM/DD/RR
SQL> select *
from NLS_SESSION_PARAMETERS
where parameter = 'NLS_DATE_FORMAT';
PARAMETER VALUE
NLS_DATE_FORMAT DD-MON-RRSo I looked into the glogin.sql script (which both tools share), and there's nothing mentioned about the NLS_DATE_FORMAT
-- Copyright (c) 1988, 2003, Oracle Corporation.
-- All Rights Reserved.
-- NAME
-- glogin.sql
-- DESCRIPTION
-- SQL*Plus global login "site profile" file
-- Add any SQL*Plus commands here that are to
-- be executed when a user starts SQL*Plus, or
-- uses the SQL*Plus CONNECT command
-- USAGE
-- This script is automatically run
-- Used by Trusted Oracle
COLUMN ROWLABEL FORMAT A15
-- Used for the SHOW ERRORS command
COLUMN LINE/COL FORMAT A8
COLUMN ERROR FORMAT A65 WORD_WRAPPED
-- Used for the SHOW SGA command
COLUMN name_col_plus_show_sga FORMAT a24
COLUMN units_col_plus_show_sga FORMAT a15
-- Defaults for SHOW PARAMETERS
COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME
COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE
-- Defaults for SHOW RECYCLEBIN
COLUMN origname_plus_show_recyc FORMAT a16 HEADING 'ORIGINAL NAME'
COLUMN objectname_plus_show_recyc FORMAT a30 HEADING 'RECYCLEBIN NAME'
COLUMN objtype_plus_show_recyc FORMAT a12 HEADING 'OBJECT TYPE'
COLUMN droptime_plus_show_recyc FORMAT a19 HEADING 'DROP TIME'
-- Defaults for SET AUTOTRACE EXPLAIN report
COLUMN id_plus_exp FORMAT 990 HEADING i
COLUMN parent_id_plus_exp FORMAT 990 HEADING p
COLUMN plan_plus_exp FORMAT a60
COLUMN object_node_plus_exp FORMAT a8
COLUMN other_tag_plus_exp FORMAT a29
COLUMN other_plus_exp FORMAT a44
-- Used to alter the TOAD environment so that users do not have to
-- use the SET DEFINE OFF command prior to compiling code
-- Charles Forbes 10.17.2005
SET scan offIf I expressly go into either tool and execute, the following, setting the format to that already delcared at the system-level:
alter session set nls_date_format = 'MM/DD/RR'Then these SQL statements start running just fine again.
There's something that I'm missing in my basic understanding of how this works. I assumed that the driver update for ColdFusion perhaps enabled a different "glogin.sql"-type script equivalent for that tool ... until ... I started checking into how the NLS_DATE_FORMAT is supposed to work ... but isn't. Could someone help me clarify where the hole is in my understanding?
Thanks,
Chuckchuckers wrote:
What's the difference, then, between NLS_SESSION_PARAMETERS and NLS_INSTANCE_PARAMETERS in my initial post? The glogin.sql script isn't altering the NLS_DATE_FORMAT for the desktop version of SQL*Plus, so I'm perplexed that the SESSION format differs from the INSTANCE format.NLS_SESSION_PARAMETERS are the NLS parameters that are in force for your particular session (i.e. the particular connection you have). Most client applications cause things like NLS_DATE_FORMAT to be set, overriding the NLS_INSTANCE_PARAMETERS. Instance-level NLS settings are most commonly used only for purely back-end processing (i.e. background jobs scheduled via DBMS_JOB or DBMS_SCHEDULER, etc.) 9 times out of 10, the client application is going to override the instance-level paramters.
I even opened SQL Developer, and got
select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
PARAMETER VALUE
NLS_DATE_FORMAT DD-MON-RR
1 rows selected
select * from nls_instance_parameters where parameter = 'NLS_DATE_FORMAT'
PARAMETER VALUE
NLS_DATE_FORMAT MM/DD/RR
1 rows selected
That's not unexpected. Java applications are going to use the Java regional properties at least to specify a date format. SQL Developer has a config option for the date format, so it may well be specifying a different format.
They're all 3 (Toad, SQL*Plus, TOAD) so suspiciously consistent, that I'm questioning some of the fundamentals of the NLS setup.
I went ahead and looked via SQL*Plus from the server-side, & things are looking more consistently in-line with my expectations:
[oracle@dvsrvr13 ~]$ sqlplus forbesc@d13
SQL*Plus: Release 10.1.0.4.0 - Production on Thu Mar 19 12:44:57 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
PARAMETER VALUE
NLS_DATE_FORMAT MM/DD/RR
SQL> select * from nls_instance_parameters where parameter = 'NLS_DATE_FORMAT';
PARAMETER VALUE
NLS_DATE_FORMAT MM/DD/RR
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@dvsrvr13 ~]$ locate glogin.sql
/u01/app/oracle/product/10.1.0/db_1/sqlplus/admin/glogin.sql
[oracle@dvsrvr13 ~]$ more /u01/app/oracle/product/10.1.0/db_1/sqlplus/admin/glogin.sql
-- Copyright (c) 1988, 2003, Oracle Corporation. All Rights Reserved.
-- NAME
-- glogin.sql
-- DESCRIPTION
-- SQL*Plus global login "site profile" file
-- Add any SQL*Plus commands here that are to be executed when a
-- user starts SQL*Plus, or uses the SQL*Plus CONNECT command
-- USAGE
-- This script is automatically run
-- Used by Trusted Oracle
COLUMN ROWLABEL FORMAT A15
-- Used for the SHOW ERRORS command
COLUMN LINE/COL FORMAT A8
COLUMN ERROR FORMAT A65 WORD_WRAPPED
-- Used for the SHOW SGA command
COLUMN name_col_plus_show_sga FORMAT a24
COLUMN units_col_plus_show_sga FORMAT a15
-- Defaults for SHOW PARAMETERS
COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME
COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE
-- Defaults for SHOW RECYCLEBIN
COLUMN origname_plus_show_recyc FORMAT a16 HEADING 'ORIGINAL NAME'
COLUMN objectname_plus_show_recyc FORMAT a30 HEADING 'RECYCLEBIN NAME'
COLUMN objtype_plus_show_recyc FORMAT a12 HEADING 'OBJECT TYPE'
COLUMN droptime_plus_show_recyc FORMAT a19 HEADING 'DROP TIME'
-- Defaults for SET AUTOTRACE EXPLAIN report
COLUMN id_plus_exp FORMAT 990 HEADING i
COLUMN parent_id_plus_exp FORMAT 990 HEADING p
COLUMN plan_plus_exp FORMAT a60
COLUMN object_node_plus_exp FORMAT a8
COLUMN other_tag_plus_exp FORMAT a29
COLUMN other_plus_exp FORMAT a44
[oracle@dvsrvr13 ~]$ So in all, I'm just perplexed by the differences.
--=cfI'm not surprised that SQL*Plus from the Unix database server is going to have session-level settings that match the instance-level settings because there is probably nothing set in the Unix environment that would override the instance-level settings. There is probably no NLS_LANG or NLS_DATE_FORMAT set as environment variables and probably no central place to look for regional settings. Most applications, particularly Windows and Java apps, are going to have multiple places to look for that sort of information.
Justin -
SQL Plus giving SP2-0024: Nothing to change error
I'm just about to lose my mind.
I'm running the following in SQL Plus -
set echo off
set feedback off
set linesize 1000
set sqlprompt ''
spool c:\TEMP2\App_Eng1.csv replace
Select A.OBJECTOWNERID||','||B.OBJECTVALUE1 from PSPROJECTITEM B, PSAEAPPLDEFN A
Where B.PROJECTNAME = 'PRJ732075'
and B.SOURCESTATUS = 2
and B.TARGETSTATUS = 1
and B.OBJECTVALUE2 = ' '
and B.OBJECTTYPE=33
and A.AE_APPLID = B.OBJECTVALUE1
spool off
and I get the following in return -
SQL> set echo off
SQL> set feedback off
SQL> set linesize 1000
SQL> set sqlprompt ''
spool c:\TEMP2\App_Eng1.csv replace
SP2-0024: Nothing to change.
Select A.OBJECTOWNERID||','||B.OBJECTVALUE1 from PSPROJECTITEM B, PSAEAPPLDEFN A
2 Where B.PROJECTNAME = 'PRJ732075'
3 and B.SOURCESTATUS = 2
4 and B.TARGETSTATUS = 1
5 and B.OBJECTVALUE2 = ' '
6 and B.OBJECTTYPE=33
7 and A.AE_APPLID = B.OBJECTVALUE1
8
spool off
SP2-0042: unknown command "off" - rest of line ignored.
Why am I getting these errors?
Also, when I clear the SQL, rerun the SQL and try to open the App_Eng1.csv file
I get a window telling me the file is locked. The only way for me to unlock the file is to shutdown the SQL Plus window. Why is this?
All I am trying to do is to download data from an Oracle table to an Excel spreadsheet. Is there a relatively easy way to do this using SQL Developer code or should I continue to fight with SQL Plus? I'm trying to automate a process so I don't want to use the manual steps like the DTS Import by Excel.
Any help? Please?Thanks for the info. I have another issue. I'm not sure that my Spool Off command is being recognized. Here's the script I'm running -
set echo off
set feedback off
set linesize 1000
set sqlprompt ''
SELECT COUNT(*) FROM PSPROJECTITEM;
spool c:\TEMP2\App_Eng1.csv replace
Select A.OBJECTOWNERID||','||B.OBJECTVALUE1
from PSPROJECTITEM B, PSAEAPPLDEFN A
Where B.PROJECTNAME = 'PRJ732075'
and B.SOURCESTATUS = 2
and B.TARGETSTATUS = 1
and B.OBJECTVALUE2 = ' '
and B.OBJECTTYPE=33
and A.AE_APPLID = B.OBJECTVALUE1;
spool off
Most of the time the App_Eng1.csv file is telling me that it can't be opened because it's being used by another user, even after I close SQL Plus. I have to physically perform the Spool Off command from the menu. But even then the csv file is blank. Any ideas? -
Hi how to add javascripts to the HTML reports generated using SQL*plus :
SET MARKUP HTML ON SPOOL ON
If we want to modify the dynamically generated HTML page by SQL*PLUS how does one do that??
Please helpIf you create a script containing the following it should work:
set markup html on spool on
spool <your file>
run sql-commands here
spool off
set markup html off -
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 -
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.
Maybe you are looking for
-
Question regarding cfimage and its' hotfix
Ok, I've browsed through numerous threads regarding cfimage issues and the various hotfixes. Seeing as I am not the administrator of my server's copy of ColdFusion, I wanted to see if I could verify that the latest hotfix was installed. I had seen so
-
Statistical Posting on cost center
Hi, I use FB70 for revenue posting. My true cost object is Profitability segment wherein I capture Cost center as well as Profit center. I have two problems with this. 1) In simulation, i am not able to see cost center in any of the view 2) I am not
-
I need to compute the percentage of each INTEGER, say, 4,5,6,3,2. So this is what I did: percent_value[] = (value[] / total) * 100; both percent_value and value[] are int arrays. I know there's something wrong, I don't know what... please help :)
-
How do I delete a partition so that I recover the disk space?
I partitioned my terabyte hard drive to run Mavericks (as well as Yosemite). I followed the Genius instructions from the local store and used Disk Utility to delete Macintosh HD Mavericks. The Disk Utility message said the partition was deleted but i
-
what is the use of miniapps and personalization tab in pfcg