Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Subquery within PL/SQL fails
Nathan wrote:
> Hi:
> When i try running the following query in my pl/sql block,
> SELECT chatsessiontoken into latesttoken,assignedstatus into
> assignstatusfromdb FROM (SELECT * FROM from tbl_crmvisitorinfo where
> visiturl=url and clientip=ip order by chatsessiontoken desc) WHERE
> ROWNUM<2;
>
> i get the following error:
> Line # = 24 Column # = 59 Error Text = PL/SQL: ORA-00923: FROM keyword
> not found where expected
> Line # = 24 Column # = 3 Error Text = PL/SQL: SQL Statement ignored
>
> I run oracle version: 9.0.1.1.1
>
> Any help is appreciated.
>
> I am trying to get the top 1 row, after ordering desc.
>
> Thanks,
> Nathan
your INTO is incorrect:
SELECT chatsessiontoken,assignedstatus
into latesttoken,assignstatusfromdb
FROM (SELECT * FROM from tbl_crmvisitorinfo where
visiturl=url and clientip=ip order by chatsessiontoken desc)
WHERE ROWNUM<2;
Received on Thu Oct 02 2003 - 16:25:02 CDT