Home » SQL & PL/SQL » SQL & PL/SQL » Subquery
Subquery [message #20840] Tue, 25 June 2002 06:03 Go to next message
Andy Murphy
Messages: 2
Registered: June 2002
Junior Member
Any ideas why the following code works in Oracle 8.0.5 but not in 8.1.7:

INSERT INTO table1
VALUES
(20,(SELECT max(mykey) FROM table2), 96, 2)
Re: Subquery [message #20841 is a reply to message #20840] Tue, 25 June 2002 06:46 Go to previous messageGo to next message
vivek
Messages: 59
Registered: October 2001
Member
hi andy,
this code works in 9i also. Can u give the exact error message it is giving.

Regards
vivek
Re: Subquery [message #20843 is a reply to message #20840] Tue, 25 June 2002 07:49 Go to previous messageGo to next message
Andy Murphy
Messages: 2
Registered: June 2002
Junior Member
It's giving me ORA-00936 missing expression (even though the sub-query itself does actually return a single value)
Re: Subquery [message #20847 is a reply to message #20843] Tue, 25 June 2002 09:33 Go to previous message
vivek
Messages: 59
Registered: October 2001
Member
This is the code i gave in my 8.1.7 db. It works perfectly. The error u are getting normally comes when u miss a clause or use a reserved word but u'r syntax looks fine.
Can't understand what the problem may be.

SQL> insert into dept values(90,(select max(sal) from emp),'vivek');

1 row created.

SQL> select * from dept;

DEPTNO DNAME LOC
---------- -------------- -------------
10 hh NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
90 5000 vivek
Previous Topic: help in simple select statement (regarding chr(10) or line break usage)
Next Topic: Re: Reading next line of text file using UTL_FILE
Goto Forum:
  


Current Time: Fri Apr 26 00:29:28 CDT 2024