Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ORA-00904 error on date and View question

Posted on 2006-10-29
8
Medium Priority
?
1,143 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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 setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

782 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