Solved

ORA-00904 error on date and View question

Posted on 2006-10-29
8
1,125 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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 100 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 400 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 400 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

734 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