How to display fields and values in sql+ for Oracle DB


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to display fields and values in sql+ for Oracle DB
# 1  
Old 06-11-2010
How to display fields and values in sql+ for Oracle DB

Hello,

I'm trying to do a select for an Oracle table but the output gives me only filelds values without fields name as in Informix.
Is there anyway to display both in output ?
For instance, the output will be :

Code:
 
Name      Rico
Age        30
Position   Engineer


Thx,
# 2  
Old 06-11-2010
Hi
Are you trying this from sqlplus? If so, make sure the "set header off" is not done.


Guru.
# 3  
Old 06-11-2010
?
The field names are usually the first line printed...
The output would have been:
Code:
NAME   AGE     POSITION
-----   ---    ----------

First    20     blahblah
Rico     30     Engineer
third
etc

# 4  
Old 06-11-2010
Hi,

For Guru,
yes, I'm using sqlplus but I don't have this variable "header" ...

For vbe,
I put pages to 0 so that's why filelds name were not displayed. But the problem is that if I don't put it to 0, it displays for me all fields which are not null and null and the output becomes hard to read.
So is there anyway to display only not null fields with their values with a select command ?

Thx,
# 5  
Old 06-11-2010
Quote:
Originally Posted by rany1
... if I don't put it to 0, it displays for me all fields which are not null and null and the output becomes hard to read.
sqlplus does that anyway, whether or not you set pagesize to 0.
That is, sqlplus fetches all column values (NULL as well as NOT NULL) as specified in your SELECT <column_list>, irrespective of the pagesize setting.

Quote:
...
So is there anyway to display only not null fields with their values with a select command ?
...
Do you mean something like this ?

Code:
select x, y, z from t where x is not null and y is not null and z is not null;

This query will fetch all rows from table T that have NON NULL values for each column X, Y and Z.

Otherwise, please post a simple and reproducible example of what the problem is and what you are trying to accomplish.

tyler_durden
# 6  
Old 06-11-2010
Hi,

Thx to all. I have to put fields names in the select to get it work as suggested by Tyler, before I was putting select * ...

thx & Regs,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get the values of multipledot(.) separated fields?

Hello, I have a file which has the following contents : thewall............0000000000200000 kmemfreelater......0000000000000000 kmemgcintvl........0000000000000002 kmeminuse..........00000000223411C0 allocated..........0000000029394000 bucket.......... @.F1000A02800C2158 The mentioned... (4 Replies)
Discussion started by: rahul2662
4 Replies

2. Programming

SQL*PLUS How to display a count of 0

Hi, I have been frantically googling and checking some sqlplus forums, but can't find the correct syntax. Basically within sqlplus I want to do a count on a table and if the count is 0 it displays 0 instead of "no rows found". For eample: select count(*) from tableA where... (3 Replies)
Discussion started by: chris01010
3 Replies

3. Shell Programming and Scripting

Cannot get literal ampersand to display in SQL output

Gurus, Thanks so much for your help, in advance. I'm using ksh and outputting a literal string value to an output file, however, Unix isn't playing by SQL's rules. The ampersand character which I'm trying to disply as a knowledge base link is screwing up the output. Typically, the "&&" is... (1 Reply)
Discussion started by: WhoDatWhoDer
1 Replies

4. UNIX for Advanced & Expert Users

v$sql not display correct sql_text

Hi folks, I am facing one problem with v$sql, i need to store updating sql query in temp table when one trigger get fired on some update sql statement. but with "sql_text" , i am not getting correct update statement in temp table. I am getting sql_text with this cursor statement. select... (0 Replies)
Discussion started by: apskaushik
0 Replies

5. Programming

SQL Oracle error

Am trying to run this : DECLARE CURSOR c1 IS SELECT customer_id, num3 FROM table1 WHERE text1 = 'pp' AND customer_id IS NOT NULL; custcount INTEGER; oldtext24 VARCHAR2 (80); commit_counter INTEGER := 0; BEGIN FOR i IN c1 ... (1 Reply)
Discussion started by: maiooi90
1 Replies

6. Shell Programming and Scripting

find values between values in two different fields

Hi, I need help to find values between two different fields based on $6 (NUM) AND $1 (CD), within the same ID. The result should show the values between the NUMs which will be extracted from within $3 and $2 in data.txt file below. data.txt ex 139 142 Sc_1000004 ID 4 CD ... (2 Replies)
Discussion started by: redse171
2 Replies

7. Shell Programming and Scripting

distinct values of all the fields

I am a beginner to scripting, please help me in this regard. How do I create a script that provides a count of distinct values of all the fields in the pipe delimited file ? I have 20 different files with multiple columns in each file. I needed to write a generic script where I give the number... (2 Replies)
Discussion started by: vukkusila
2 Replies

8. UNIX for Dummies Questions & Answers

distinct values of all the fields

I am a beginner to scripting, please help me in this regard. How do I create a script that provides a count of distinct values of all the fields in the pipe delimited file ? I have 20 different files with multiple columns in each file. I needed to write a generic script where I give the number... (1 Reply)
Discussion started by: vukkusila
1 Replies

9. Shell Programming and Scripting

sql loader for inserting the data from multiple fields from unix

Hi , I have my log file something like this (07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011 (07/29/2009 00:02:26.236) 367524 (07/29/2009 00:02:28.207) 949395117 (07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864 I am trying to insert the data... (3 Replies)
Discussion started by: rdhanek
3 Replies

10. UNIX for Dummies Questions & Answers

how to pass values from oracle sql plus to unix shell script

how to pass values from oracle sql plus to unix shell script (2 Replies)
Discussion started by: trichyselva
2 Replies
Login or Register to Ask a Question