Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ORA-00904 error on date and View question

Posted on 2006-10-29
8
Medium Priority
?
1,138 Views
Last Modified: 2012-08-14
Hello experts;

I'm taking a class that will hopefully prepare me for the oracle certification exam.  I am using oracle version 9i.   To give you some background, the assignment is as follows:  

I've gone through questions 1-4 and i'm now on question 5

1. Create a user without any role or system or object privileges.
2. create role called "connection". give the role privileges, including connect, resource.
3. create another role called "object", give the role rights to access scott.emp and scott.dept and allow to erform select, insert, update and delete.
4. Grant the user created in 1 with the roles created in 2 & 3.
5. log in as the new user. insert two records into scott.emp table.
6. create a view based on scott.emp and scott.dept.
7. query scott.emp and scott.dept using the view created in 6.

Q5:  I'm trying to insert records to scott.emp table this is my sql
insert into scott.emp(empno, ename, job, mgr, hiredate, sal, comm, deptno)
values ('77935','Norton', 'SALESMAN','7654','29-OCT-06',6000, null, '30');

I get the following error:
ORA-00904: "HIREDATE" invalid identifier.  

Q6:  What is a view, and how do you create one?

What am I doing wrong?
TIA,

Lisa
0
Comment
Question by:AnneYourPointIs
[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
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 18

Expert Comment

by:rbrooker
ID: 17829893
Hi,

invalid identifier is usually a spalling mistake in a column name, could it be "hire_date"?

creating a view is :
create or replace view my_view_name as
select * from scott.emp .....

good luck. :)
0
 

Author Comment

by:AnneYourPointIs
ID: 17829967
no, the column name is HIREDATE
0
 
LVL 18

Expert Comment

by:rbrooker
ID: 17831198
Ok, hiredate is hiredate.

but :

ORA-00904: string: invalid identifier
Cause: The column name entered is either missing or invalid.
Action: Enter a valid column name. A valid column name must begin with a letter, be less than or equal to 30 characters, and consist of only alphanumeric characters and the special characters $, _, and #. If it contains other characters, then it must be enclosed in double quotation marks. It may not be a reserved word.

this would suggest that a column is misspelled, or you have an extra one.  can you check the other columns?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 17832222
do a desc of scott.emp and see whether the column names/data types are ok or not.

desc scott.emp

Thanks
0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 400 total points
ID: 17832233
in my scott.emp i have empno as number (4 ) but you are trying to insert '77935'. Your value could be too large though i am not sure of your table structure.

If your scott.emp is also number(4), then insert some other empno which is <=9999

Thanks
0
 
LVL 13

Assisted Solution

by:anand_2000v
anand_2000v earned 1600 total points
ID: 17832246
Are you doing a
Begin
insert into scott.emp(empno, ename, job, mgr, hiredate, sal, comm, deptno)
values ('77935','Norton', 'SALESMAN','7654','29-OCT-06',6000, null, '30');
end;
/
if yes then  try after removing the begin and end. it might also be that you  are using some tool other than SQlplus for giving the insert command

0
 
LVL 10

Expert Comment

by:ravindran_eee
ID: 17832426
Hope this link will help u in understanding about views in oracle..

http://www.psoug.org/reference/views.html

Try the below query.. Am assuming that u are using the same standard SCOTT schema.. I have made some small changes to the query.. Let me know whether this helps..
INSERT INTO scott.emp(empno, ename, job, mgr, hiredate, sal, comm, deptno)
VALUES ('7793','Norton', 'SALESMAN','7654',TO_DATE('29-OCT-06','DD-MON-YYYY'),6000, NULL, 30);
0
 
LVL 13

Accepted Solution

by:
anand_2000v earned 1600 total points
ID: 17840843
At times Oracle gives out the wrong messages(Don't askme how, I have seen this happen) Can you do a
desc scott.emp first and get back to us.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

670 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