Solved

ORA-00998: must name this expression with a column alias

Posted on 2009-05-11
13
2,501 Views
Last Modified: 2013-12-07
Hi experts,

             I am getting the error ORA-00998 on attempting to create the following table.
CREATE TABLE SUMMARY AS
select AG1."a_id", S1."s_id", AG1."i_id",
trim(TX1."datetime") , TX2."delta_msec", TX3."del_u",
TX4."con", P1."p_id"
from
AG1, S1, TX1, TX2, 
TX3, P1

Open in new window

0
Comment
Question by:aman0711
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
13 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24359420
>trim(TXN_MEASUREMENT."datetime")

you are missing a column name for that.
0
 
LVL 10

Author Comment

by:aman0711
ID: 24359459
hi angell,

                       Please forgive if I am asking too many dumb question. i am very new to this and trying to learn.

   I just put an extra trim for TXN_MEASUREMENT."datetime"

my other columns are like SLOT_META_DATA."slot_id" ... why it claims for a column when I am using datetime
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24359469
I presume you actually want to TRUNC() instead of TRIM(), but that's you to clarify what you need.

the ora error you get can be solved like this:
CREATE TABLE SUMMARY AS
select AG1."a_id", S1."s_id", AG1."i_id",
trim(TX1."datetime") "datetime" , TX2."de_m", TX3."del_u",
TX4."con", P1."p_id"
from
AG1, S1, TX1, TX2, 
TX3, P1

Open in new window

0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 10

Author Comment

by:aman0711
ID: 24359565
Thanks angel :)

 Actually there was lot of white space in that particular column, so I was trying to trim it up.

Please correct me if I am wrong:-

after using the trim function on a column, I have to again the declare the column name like you did:
trim(TXN_MEASUREMENT."datetime") "datetime

right?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24361257
yes
0
 
LVL 10

Author Closing Comment

by:aman0711
ID: 31580341
Thanks :)
0
 
LVL 10

Author Comment

by:aman0711
ID: 25852840
Code to be replaced in the question body:



CREATE TABLE SUMMARY AS
select AG1."a_id", S1."s_id", AG1."i_id",
trim(TX1."datetime") , TX2."delta_msec", TX3."del_u",
TX4."con", P1."p_id"
from
AG1, S1, TX1, TX2, 
TX3, P1

Open in new window

0
 
LVL 10

Author Comment

by:aman0711
ID: 25852848
Morphed code for ID: 24359469

CREATE TABLE SUMMARY AS
select AG1."a_id", S1."s_id", AG1."i_id",
trim(TX1."datetime") "datetime" , TX2."de_m", TX3."del_u",
TX4."con", P1."p_id"
from
AG1, S1, TX1, TX2, 
TX3, P1

Open in new window

0
 
LVL 10

Author Comment

by:aman0711
ID: 25854732
Hi Angel,

                Thanks for helping me out with this issue. Your comment made me confused here, I was actually following the way you are suggesting to edit a question (Post code in the Request Attention page ), but then I was told that, thats the wrong way of doing it and I have to post the code here itself.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 25854901
As you where told here:
http://www.experts-exchange.com/Community_Support/General/Q_24904088.html

>Usually, you go into the related question, and press "Request Attention" there (exclamation mark button). This provides us with the link to this question.

in the RA text, you say you want to change some code snippets
you will find the relevant CS question here (in your profile):
http://www.experts-exchange.com/QH_4650528.html

you can then there post the "new" code.

a3
0
 
LVL 10

Author Comment

by:aman0711
ID: 25855001
OH thanks :)

 I will follow this process now.

What will happen to all the changes I requested already, Angel?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 25855051
you have indeed requested plenty of those.
from what I read in the admin comments of those questions, they will be processed.
one by one.

you really put a lot of work for the admins last night ... ;/

a3
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and theā€¦
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question