Home » SQL & PL/SQL » SQL & PL/SQL » without colum name
without colum name [message #235245] Fri, 04 May 2007 08:22 Go to next message
durai
Messages: 38
Registered: December 2006
Member
SQL>ed cur1;

set serveroutput on;
declare
cursor c1 is select * from emp;

begin
for emp_rec in c1
loop
dbms_output.put_line(emp_rec.name);
end loop;
end;
/


SQL> @cur4
SCOTT
JONES
MARTIN
BLAKE
CLARK
SYMONDS
KING
TURNER
JAMES
MILLER

PL/SQL procedure successfully completed

the table emp have 6 columns
i want to display the values of 1st column or 2nd column or any particular column, without using colum name
is it possible to diaplay the datas without using column name
i searched in our site and net also

advance thnx for the answer
Re: without colum name [message #235246 is a reply to message #235245] Fri, 04 May 2007 08:38 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't.
Moreover it is meaningless.
I don't see any business reason to say, I want to output first or second column. We always say we want id or name or 1st or 2d.

Regards
Michel
Re: without colum name [message #235253 is a reply to message #235245] Fri, 04 May 2007 09:22 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
i want is it possible to display the 1st column of a table without using column name
eg select column(1) from emp;
the above one is invalid but is there any commands similar to like this
Re: without colum name [message #235255 is a reply to message #235245] Fri, 04 May 2007 09:32 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
What part of "You can't" do you not understand?

[Updated on: Fri, 04 May 2007 09:32] by Moderator

Report message to a moderator

Re: without colum name [message #235256 is a reply to message #235253] Fri, 04 May 2007 09:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

NO AND IT IS MEANINGLESS.
WHY DO YOU WANT FIRST COLUMN? WHAT IS FIRST COLUMN? WHAT IS UITS MEANING?
THERE IS NO FIRST COLUMN.
THIS IS RELATIONAL DBMS.

Regards
Michel

Re: without colum name [message #235259 is a reply to message #235245] Fri, 04 May 2007 09:45 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
durai wrote on Fri, 04 May 2007 15:22
SQL>ed cur1;
[snip]
SQL> @cur4


Re: without colum name [message #235262 is a reply to message #235259] Fri, 04 May 2007 10:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Laughing

Even don't see it!

Regards
Michel
Re: without colum name [message #235264 is a reply to message #235253] Fri, 04 May 2007 10:20 Go to previous messageGo to next message
joy_division
Messages: 4644
Registered: February 2005
Location: East Coast USA
Senior Member
Well, I guess it's possible, but to me it's like killing a fly with a sledgehammer.

col {whatever} noprint


for every column except the first one and then do a
select * from yourtable;

Re: without colum name [message #235265 is a reply to message #235256] Fri, 04 May 2007 10:20 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The Db does have a concept of a default order for columns - if you do
INSERT INTO EMP VALUES (...)
you need to put the columns in the same order every time, and that order is detailed by the COLUMN_ID column in USER_TAB_COLUMNS.
Previous Topic: how do i sum columns
Next Topic: Create csv from table or query
Goto Forum:
  


Current Time: Sat Dec 10 12:42:51 CST 2016

Total time taken to generate the page: 0.04286 seconds