![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Mar 2008
Posts: 35
Rep Power: 0
![]() |
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');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 ![]() |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Mar 2008
Posts: 35
Rep Power: 0
![]() |
Re: Oracle 10g
the fields' names and data type
|
|
|
|
|
|
#4 |
|
PFO Founder
![]() ![]() |
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. |
|
|
|
|
|
#5 |
|
Programmer
Join Date: Mar 2008
Posts: 35
Rep Power: 0
![]() |
Re: Oracle 10g
?????????????
![]() |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#7 |
|
Programmer
Join Date: Mar 2008
Posts: 35
Rep Power: 0
![]() |
Re: Oracle 10g
![]() here it is |
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#9 |
|
Programmer
Join Date: Mar 2008
Posts: 35
Rep Power: 0
![]() |
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??
|
|
|
|
|
|
#10 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ORA-01034: ORACLE not available -- Why does this occur??! | Thecy | ASP | 4 | Apr 8th, 2008 9:33 AM |
| Is Oracle any good? | UnKnown X | Other Programming Languages | 22 | Apr 3rd, 2008 8:47 AM |
| ORACLE Database Setup | hbe02 | Other Programming Languages | 1 | Nov 2nd, 2006 12:47 PM |
| Will a project developed in VB and Oracle run on any windows machine ?? | mohitdhaigude | Visual Basic | 2 | Feb 24th, 2006 1:00 PM |
| creating user problem ORACLE database | gpreetsingh | Coder's Corner Lounge | 1 | Feb 19th, 2006 3:33 AM |