Home » SQL & PL/SQL » SQL & PL/SQL » column name length Alias
column name length Alias [message #276760] Fri, 26 October 2007 05:12 Go to next message
srinivas.k2005
Messages: 404
Registered: August 2006
Senior Member
Hi,

I have a requirement where i should give a column name more than 30 characters.


Example:

SQL> select cust_code from ar_cust where rownum<=1;

CUST_CODE
----------
03004009

SQL> select cust_code abcdefghijklmnopqrstuvwxyz1234 from ar_cust where rownum<=1;

ABCDEFGHIJ
----------
03004009

SQL> select cust_code abcdefghijklmnopqrstuvwxyz12345 from ar_cust where rownum<=1;
select cust_code abcdefghijklmnopqrstuvwxyz12345 from ar_cust where rownum<=1
                 *
ERROR at line 1:
ORA-00972: identifier is too long


SQL> select cust_code as abcdefghijklmnopqrstuvwxyz12345 from ar_cust where rownum<=1;
select cust_code as abcdefghijklmnopqrstuvwxyz12345 from ar_cust where rownum<=1
                    *
ERROR at line 1:
ORA-00972: identifier is too long



is there any way i can do this.

please guide me.

[Updated on: Fri, 26 October 2007 06:22] by Moderator

Report message to a moderator

Re: column name length Alias [message #276764 is a reply to message #276760] Fri, 26 October 2007 05:22 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Have a look at this.

By
Vamsi
Re: column name length Alias [message #276765 is a reply to message #276760] Fri, 26 October 2007 05:22 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
In short: No and you shouldn't. You can add a column comment if you feel that a column name on it's own is not clear.

MHE
Re: column name length Alias [message #276766 is a reply to message #276760] Fri, 26 October 2007 05:28 Go to previous messageGo to next message
srinivas.k2005
Messages: 404
Registered: August 2006
Senior Member
Can't we try this in pl/sql block also?
Re: column name length Alias [message #276767 is a reply to message #276765] Fri, 26 October 2007 05:30 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Maaher wrote on Fri, 26 October 2007 12:22

In short: No and you shouldn't.


MHE
Re: column name length Alias [message #276779 is a reply to message #276760] Fri, 26 October 2007 05:49 Go to previous messageGo to next message
srinivas.k2005
Messages: 404
Registered: August 2006
Senior Member
In sql * plus this worked.

column col1 heading 'abcdefghijklmnopqrstuvwxyz12345' 

select rpad(ename,60)  as col1 from emp;
Re: column name length Alias [message #276784 is a reply to message #276779] Fri, 26 October 2007 05:56 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
That is not column alias. Razz

By
Vamsi

[Updated on: Fri, 26 October 2007 06:04]

Report message to a moderator

Re: column name length Alias [message #276788 is a reply to message #276765] Fri, 26 October 2007 06:01 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
No you can not and you shouldn't. No "if this" or "but that". You can NOT do that. Plain and simple.

MHE

What is it with people these days? This is thread N from someone who just won't listen. Confused


Re: column name length Alias [message #276797 is a reply to message #276788] Fri, 26 October 2007 06:06 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
but...
Re: column name length Alias [message #276803 is a reply to message #276797] Fri, 26 October 2007 06:10 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
if.... Laughing
Re: column name length Alias [message #276804 is a reply to message #276803] Fri, 26 October 2007 06:12 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
NON ES POSSIBILE. Comprende?

Mad

MHE

Embarassed wrong forum?
Re: column name length Alias [message #276842 is a reply to message #276788] Fri, 26 October 2007 07:46 Go to previous message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Maaher

What is it with people these days? This is thread N from someone who just won't listen.

Well, there's that ignore all messages by this user link. Perhaps they ("someone") pressed it frequently in the past, but they've chosen wrong people to ignore. Now they see only a few posts, written by other users (who are still not on their ignore list), but that confuses the rest of you.

Or is this just another conspiracy theory?
"No message body"? Who deleted my body? OraFAQ did!

[Updated on: Fri, 26 October 2007 07:48]

Report message to a moderator

Previous Topic: How to find the number of connections in oracle?
Next Topic: I want to insert only integer values in table (merged)
Goto Forum:
  


Current Time: Fri Apr 19 16:11:17 CDT 2024