aliasname [message #296859] |
Tue, 29 January 2008 06:14  |
user71408
Messages: 585 Registered: November 2007 Location: NE
|
Senior Member |
|
|
Hi all,
select ordeR_no ord ||','||
item prod from orders;
when I execute the above query I am getting the folowing error.
i. e " ORA-00923: FROM keyword not found where expected"
I am getting the error because of giving alias names. ut I need to give alias name.
please help me in this issue.
Thank you.
|
|
|
Re: aliasname [message #296862 is a reply to message #296859] |
Tue, 29 January 2008 06:21   |
dhananjay
Messages: 635 Registered: March 2002 Location: Mumbai
|
Senior Member |
|
|
is this what you are trying to do
select first_name||','||last_name Name from employees
regards
|
|
|
Re: aliasname [message #296867 is a reply to message #296862] |
Tue, 29 January 2008 06:39   |
user71408
Messages: 585 Registered: November 2007 Location: NE
|
Senior Member |
|
|
No ..
select first_name fname||','||
last_name lname from names
I need to give alias names as above mentioneed..
Thank u.
|
|
|
|
Re: aliasname [message #296874 is a reply to message #296859] |
Tue, 29 January 2008 06:48   |
scorpio_biker
Messages: 154 Registered: November 2005 Location: Kent, England
|
Senior Member |
|
|
Just do it like this
select first_name fname,
last_name lname from names
otherwise you are trying to concatenate fname, a semicolon and last_name together.
|
|
|
Re: aliasname [message #296875 is a reply to message #296874] |
Tue, 29 January 2008 06:53   |
user71408
Messages: 585 Registered: November 2007 Location: NE
|
Senior Member |
|
|
If I am giving semisolumn also it's giving the same error.
can you please tell me the solution for this.
Thank you.
|
|
|
Re: aliasname [message #296879 is a reply to message #296875] |
Tue, 29 January 2008 07:00   |
sjordan
Messages: 19 Registered: October 2007
|
Junior Member |
|
|
From what other people are posting and what you are saying, you are either missing a colon (between the columns) or putting the alias in the wrong position.
You have:
select ordeR_no ord ||','||
item prod from orders;
If ord is your alias, then you need to have the comma concatenated to ordeR_no. What is item and prod? Are you trying to make ord an alias of ordeR_no and then concatenate it with a comma and item? For instance:
Select ordeR_no||','||item prod from orders;
That will give you one column, with the alias name of prod.
[Updated on: Tue, 29 January 2008 07:02] Report message to a moderator
|
|
|
|
Re: aliasname [message #296888 is a reply to message #296880] |
Tue, 29 January 2008 07:11   |
user71408
Messages: 585 Registered: November 2007 Location: NE
|
Senior Member |
|
|
select ordeR_no ord ||','||
item prod from ordloc;
ORA-00923: FROM keyword not found where expected
|
|
|
|
Re: aliasname [message #296890 is a reply to message #296888] |
Tue, 29 January 2008 07:14   |
sjordan
Messages: 19 Registered: October 2007
|
Junior Member |
|
|
you cannot alias ordeR_no with ord and then concatenate it. Try the following query and see if it gives you the results you need:
select ordeR_no ||','||item prod
from orderloc;
|
|
|
|
Re: aliasname [message #296895 is a reply to message #296892] |
Tue, 29 January 2008 07:21   |
 |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
dhananjay wrote on Tue, 29 January 2008 13:21 |
is this what you are trying to do
select first_name||','||last_name Name from employees
regards
|
Just add the alias you want to the expression:
select first_name||','||last_name "fname,lname" from employees
Regards
Michel
[Updated on: Tue, 29 January 2008 07:22] Report message to a moderator
|
|
|
Re: aliasname [message #296902 is a reply to message #296895] |
Tue, 29 January 2008 07:42   |
user71408
Messages: 585 Registered: November 2007 Location: NE
|
Senior Member |
|
|
for two columns it's working . But I have 7 columns to mention like this. Then it shows the error as
"ORA-00972: identifier is too long"
can you pls look into this.
|
|
|
Re: aliasname [message #296903 is a reply to message #296902] |
Tue, 29 January 2008 07:50  |
 |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Identifier must be at most 30 characters long.
If you are using SQL*Plus use "column" command.
In the end, if you said what you want to do, it should be easier to help you than shooting in the dark.
Regards
Michel
[Updated on: Tue, 29 January 2008 07:50] Report message to a moderator
|
|
|