Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 1st, 2008, 4:35 AM   #1
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Oracle 10g

hi....
could anybody help me???

oracle is driving me to maddness ...

for project i have to create tables and indetify their primary keys and foreign keys so i entered values for primary keys in this part everything went good...

but for other fields, i couldn't if i typed this code
 
INSERT INTO tbl_lease (lease_name, rental_amount, lease_signdate, begin_date, end_date)
VALUES ('Gardern1', '120 000', '1-Jan-2008', '10-Jan-2008', '10-Jan-2009');
it gave my error for missing comma


and for this code it gave me not enough values
 
INSERT INTO tbl_lease VALUES ('Gardern1', '120 000', '1-Jan-2008', '10-Jan-2008', '10-Jan-2009');


i am lost i have to finish this database soon
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 1st, 2008, 8:59 AM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: Oracle 10g

What does this return:

desc tbl_lease;
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Apr 1st, 2008, 9:36 AM   #3
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Oracle 10g

the fields' names and data type
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 1st, 2008, 9:56 AM   #4
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
Re: Oracle 10g

I think IR was looking for you to post the output of desc tbl_lease;
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Apr 1st, 2008, 1:29 PM   #5
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Oracle 10g

?????????????
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 1st, 2008, 2:06 PM   #6
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: Oracle 10g

Hah. We need to see the results of that 'desc' command in order to help you.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Apr 2nd, 2008, 3:57 AM   #7
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Oracle 10g



here it is
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 2nd, 2008, 8:48 AM   #8
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: Oracle 10g

Your first problem regarding the missing comma is because the RENTAL_AMOUNT is defined
as "120 000", there is no such value that is a number. You have use a comma or remove the space:
120,000 or 120000. The insert command you listed will still fail after you fix the comma problem,
with your next problem regarding the amount of values.

Your table has 6 fields, you only supply 5 values. My assumption is that you left out the LEASE_NAME
value in your insert statement, so just append that on the end of your insert statement and it will work.

For example:

INSERT INTO tbl_lease (lease_name, rental_amount, lease_signdate, begin_date, end_date)
VALUES ('Gardern1', '120000', '1-Jan-2008', '10-Jan-2008', '10-Jan-2009','Test');

I simply removed the space from the RENTAL_AMOUNT and added a value (Test) for LEASE_NAME.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Apr 2nd, 2008, 10:29 AM   #9
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Oracle 10g

first i tried insert command for lease_id to check if it is going to work or not so it worked but when i tried to add other values it didn't work, notice that i selected the fields.... so should i drop the tables and create them again?? would that fix the problem??
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 2nd, 2008, 11:01 AM   #10
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: Oracle 10g

Sorry for my initial posts... they were a bit inaccurate. I missed the part where you were defining which rows you wanted to insert into. I think a large part of your problem is that the numeric you are entering for rental_amount is enclosed in quotes (its not a string, so they need to be removed), the space in the rental_amount still needs to be removed, then you will need to make sure your dates are in the correct format that Oracle expects.

I recreated your table in MySQL and added a line to test...

mysql> desc tbl_lease;
+----------------+---------------+------+-----+---------+-------+
| Field          | Type          | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| LEASE_ID       | char(14)      | NO   |     |         |       | 
| RENTAL_AMOUNT  | decimal(10,0) | YES  |     | NULL    |       | 
| BEGIN_DATE     | date          | YES  |     | NULL    |       | 
| END_DATE       | date          | YES  |     | NULL    |       | 
| LEASE_SIGNDATE | date          | YES  |     | NULL    |       | 
| LEASE_NAME     | varchar(15)   | YES  |     | NULL    |       | 
+----------------+---------------+------+-----+---------+-------+
6 rows in set (0.05 sec)

mysql> INSERT INTO tbl_lease VALUES ('Gardern1', 120000, '2008-01-01', '2008-01-10', '2009-01-10','Test');
Query OK, 1 row affected (0.00 sec)

mysql> select * from tbl_lease;
+----------+---------------+------------+------------+----------------+------------+
| LEASE_ID | RENTAL_AMOUNT | BEGIN_DATE | END_DATE   | LEASE_SIGNDATE | LEASE_NAME |
+----------+---------------+------------+------------+----------------+------------+
| Gardern1 |        120000 | 2008-01-01 | 2008-01-10 | 2009-01-10     | Test       | 
+----------+---------------+------------+------------+----------------+------------+
1 row in set (0.00 sec)
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ORA-01034: ORACLE not available -- Why does this occur??! Thecy ASP 4 Apr 8th, 2008 10:33 AM
Is Oracle any good? UnKnown X Other Programming Languages 22 Apr 3rd, 2008 9:47 AM
ORACLE Database Setup hbe02 Other Programming Languages 1 Nov 2nd, 2006 1:47 PM
Will a project developed in VB and Oracle run on any windows machine ?? mohitdhaigude Visual Basic 2 Feb 24th, 2006 2:00 PM
creating user problem ORACLE database gpreetsingh Coder's Corner Lounge 1 Feb 19th, 2006 4:33 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:47 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC