Link to home
Start Free TrialLog in
Avatar of celtician
celticianFlag for American Samoa

asked on

Retreiving column names in Windows but not in Unix

Certain SQL sentences return a value, however, the SAME sentence, against the same database would return also the column (field) name by doing it in windows, and write out to the output file, and from unix it will not.

The SQL file is the same in both windows and unix

So i guess it has to do with environment? What environment variables or what should i do in order to get in unix also the output column names?

Thank you!!!
Avatar of Sean Stuber
Sean Stuber

please post screen captures   of a Windows cmd session using sql*plus  and a Unix sh (or ksh,bash, etc) using sql*plus  where both windows demonstrate the problem you are trying to describe.
Look for a glogin.sql or a local login.sql in the folder you are running the SQL scripts from.

Those can change sqlplus' environment.

http://docs.oracle.com/database/121/SQPUG/ch_two.htm#SQPUG337
Avatar of celtician

ASKER

Sure, im trying to demonstrate this. When i run this code:

set feedback off
col user for a25
select nvl(username,'???') USUARIO, count(*) SESIONES from v$session
group by nvl(username,'???');
set feedback on

Open in new window


In windows i get this output (within a file)

USER   SESSIONS                                                                                                                  
------------------------- ----------                                                                                                                  
???                               23                                                                                                                  
AB3                                                                                                                  
SISTEMA                            1                                                                                                                  
SOPORTE                            2                                                                                                                  
SU                                10       

Open in new window

What does it look in in unix?
Sorry i was trying to edit this, as i posted before i finished the unix part. this is what i get in unix:

???                               23                                                                                                                  
AB                                3                                                                                                                  
SYSTEM                            1                                                                                                                  
SUPPORT                            2                                                                                                                  
SB                                10  

Open in new window


The same ouput but with no column names (fields)
From each system post the results of (from inside sqlplus):
show all

Look for differences.

Look specifically for pagesize and heading.  If there are differences, then something is setting them for you.  That is likely a login.sql or a glogin.sql file.
Whre do i check for those differences?
In sqlplus a "show all" will return all the curent parameters set in the sqlplus environment.

There aren't that many.  Can you not check them manually?

If you want you can spool them out and use some diff program.

SQL> spool myfile.txt
SQL> show all
SQL> spool off

That places all the output into a file in the current folder named myfile.txt.  Change the names on both servers and compare them.
ASKER CERTIFIED SOLUTION
Avatar of awking00
awking00
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
When i change that i dont see a change in the output file

it must be something else
Please post the complete output from a SHOW ALL on the Unix server.