Home » SQL & PL/SQL » SQL & PL/SQL » Unable to parse a PL/SQL Block
Unable to parse a PL/SQL Block [message #19881] Tue, 16 April 2002 02:58 Go to next message
Krish
Messages: 13
Registered: November 2001
Junior Member
Hi,
I have a sql that gets executed when run as a standalone sql, but gives
compilation errors when we enclose it in a PL/SQL block.
The query is similar to this:

SELECT 1
,NULL consist_string
,(SELECT '1' from dual)
from dual;

When I execute the above query at sql prompt, it executes without any
error.
But when I enclose this in a PL/SQL block as

begin
SELECT 1
,NULL consist_string
,(SELECT '1' from dual)
from dual;
end;

I get the pls compilation error PLS-00103.
The problem here is in the second column that is getting selected which
is again a sql itself. Is there any restriction on usage of this kind of
a sql in a pl/sql block?
Any pointers would be greatly helpful.

Thanks,
Krish
Re: Unable to parse a PL/SQL Block [message #19887 is a reply to message #19881] Tue, 16 April 2002 06:28 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
hi...
is this what you are expecting?
-----------------------------------
SQL> ed
Wrote file afiedt.buf

1 declare
2 cursor c1 is SELECT 1 a ,NULL consist_string,
3 (SELECT '1' from dual) b from dual;
4 begin
5 for mag in c1 loop
6 exit when c1%notfound;
7 dbms_output.put_line(mag.a||','|| mag.consist_string||','||mag.b);
8 end loop;
9* end;
SQL> /
1,,1
Previous Topic: while commiting how the table will be locked
Next Topic: Problem related to ref cursor and collections
Goto Forum:
  


Current Time: Fri Apr 26 04:51:42 CDT 2024