Home » SQL & PL/SQL » SQL & PL/SQL » While inserting record i got error ORA-00903: invalid table name
While inserting record i got error ORA-00903: invalid table name [message #636551] Tue, 28 April 2015 01:41 Go to next message
pandilakshmanan1989@gmail
Messages: 3
Registered: April 2015
Location: chennai
Junior Member
INSERT INTO TEST_LINK(h_id,h_person_id,pr_code)
(SELECT P_id FROM P_LINK_COUNT,'P','l')
;

If i run above query i got error like "ORA-00903: invalid table name"

Can anyone help with this?

Please guide me if am wrong with query.

Thanks in Advance

Pandi

[Updated on: Tue, 28 April 2015 01:42]

Report message to a moderator

Re: While inserting record i got error ORA-00903: invalid table name [message #636552 is a reply to message #636551] Tue, 28 April 2015 01:49 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Wrong syntax, should be
INSERT INTO TEST_LINK
  (h_id, h_person_id, pr_code)
  (SELECT P_id, 'P', 'l'
   FROM P_LINK_COUNT
  );
Re: While inserting record i got error ORA-00903: invalid table name [message #636553 is a reply to message #636551] Tue, 28 April 2015 02:14 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Hi,

Welcome to the forum!

Please read and follow the OraFAQ Forum Guide and How to use [code] tags, to enable us to help you.
Re: While inserting record i got error ORA-00903: invalid table name [message #636554 is a reply to message #636552] Tue, 28 April 2015 02:27 Go to previous messageGo to next message
pandilakshmanan1989@gmail
Messages: 3
Registered: April 2015
Location: chennai
Junior Member
while i run this query i getting error
Could anybody help me with this?

INSERT INTO TEST_LINK(h_id,h_person_id,pr_code)
((SELECT P_ID FROM P_LINK_COUNT),'PANDI','laksh')
;


Error starting at line : 99 in command -
INSERT INTO TEST_LINK(h_id,h_person_id,pr_code)
((SELECT P_ID FROM P_LINK_COUNT),'PANDI','laksh')
Error at Command Line : 100 Column : 45
Error report -
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:


thanks in advance
Re: While inserting record i got error ORA-00903: invalid table name [message #636555 is a reply to message #636554] Tue, 28 April 2015 02:28 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
You need to close all your parenthesis/brackets
icon5.gif  Re: While inserting record i got error ORA-00903: invalid table name [message #636556 is a reply to message #636555] Tue, 28 April 2015 02:42 Go to previous messageGo to next message
pandilakshmanan1989@gmail
Messages: 3
Registered: April 2015
Location: chennai
Junior Member
Hi team,
i try to insert p_id,'pandi','laksh' to test_link table. i have to get p_id from another table called p_link_count, so i using subquery. but while run below query i getting error.
could anybody assist me whether i have done any mistake with this query?

INSERT INTO TEST_LINK(h_id,h_person_id,pr_code)
(SELECT P_ID FROM P_LINK_COUNT,'PANDI','laksh')
;
Error starting at line : 99 in command -
INSERT INTO TEST_LINK(hie_id,hie_person_id,practice_code)
(SELECT PATIENT_ID FROM PATIENT_LINK_COUNT,'PANDI','laksh')
Error at Command Line : 100 Column : 54
Error report -
SQL Error: ORA-00903: invalid table name
00903. 00000 -  "invalid table name"
*Cause:    
*Action:


Thanks in advance
Re: While inserting record i got error ORA-00903: invalid table name [message #636557 is a reply to message #636554] Tue, 28 April 2015 02:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You didn't read Littlefoot's answer, did you?
Or you are just unable to read?

Don't you see the difference between (I format Littlefoot's query like yours):
INSERT INTO TEST_LINK(h_id, h_person_id, pr_code)
(SELECT P_id, 'P', 'l' FROM P_LINK_COUNT)
;

INSERT INTO TEST_LINK(h_id,h_person_id,pr_code)
((SELECT P_ID FROM P_LINK_COUNT),'PANDI','laksh')
;

Re: While inserting record i got error ORA-00903: invalid table name [message #636559 is a reply to message #636556] Tue, 28 April 2015 03:17 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
pandilakshmanan1989@gmail wrote on Tue, 28 April 2015 13:12

(SELECT P_ID FROM P_LINK_COUNT,'PANDI','laksh')

Error starting at line : 99 in command -
(SELECT PATIENT_ID FROM PATIENT_LINK_COUNT,'PANDI','laksh')


The column name and table name in the SELECT statement and in the error are different. How?
Re: While inserting record i got error ORA-00903: invalid table name [message #636566 is a reply to message #636556] Tue, 28 April 2015 05:36 Go to previous message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
Maybe, before any attempt of calling INSERT statement (or any other one), you should get acquainted with its syntax.
Some good guys from Oracle already did that job of writing it down and it is available in the documentation, e.g. online on http://docs.oracle.com/en/.
I recommend you to open SQL Language Reference book for your Oracle version.

In fact, there are two INSERT statement variants:
INSERT INTO <table_name> (<column_list>) <select_query>;
or
INSERT INTO <table_name> (<column_list>) VALUES (<expression_list>);

Your attempt does not meet any of them (note the keyword VALUES in the second case).
Previous Topic: SQL Query
Next Topic: Reg Spliting line using instr,substr and regexp
Goto Forum:
  


Current Time: Thu Apr 18 02:07:11 CDT 2024