Solved

ORA-00904 error on date and View question

Posted on 2006-10-29
8
1,112 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help with Oracle syntax 4 56
join 2 views with 5 conditions 3 44
oracle 11g 23 48
PL SQL Search Across Columns 4 19
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…
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 video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

911 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

16 Experts available now in Live!

Get 1:1 Help Now