Solved

ORA-00904 error on date and View question

Posted on 2006-10-29
8
1,111 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
  • 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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 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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now