CrystalizeCanada
Instructor
Hi there,
I have to use a sub select statement (or perhaps this is referred to as an inline statement) within a main statement and have come across the missing right parentesis issue when using an Order By clause in oracle PL-SQL.
Heres a example to explain:
SELECT EmpId, HireDate
(
SELECT EmpId AS PreviousHire
WHERE EmpId <> E.EmpId and HireDate < E.HireDate and RowNum =1
ORDER BY HireDate DESC
)
From Emp E
In the above example which is similar in concept I'm trying find the previously hired employee. I want to use an ORDER BY clause but I'm not allowed to due to the fact that it is an sub select.
Is there an alternative way of doing this that works as a subselect statement. (I have to use a subselect because I'm using a reporting tool where I can take advantage of subselect statements.)
Any help would be greatly appreciated.
Thanks
Gordon
Gordon BOCP
Crystalize
I have to use a sub select statement (or perhaps this is referred to as an inline statement) within a main statement and have come across the missing right parentesis issue when using an Order By clause in oracle PL-SQL.
Heres a example to explain:
SELECT EmpId, HireDate
(
SELECT EmpId AS PreviousHire
WHERE EmpId <> E.EmpId and HireDate < E.HireDate and RowNum =1
ORDER BY HireDate DESC
)
From Emp E
In the above example which is similar in concept I'm trying find the previously hired employee. I want to use an ORDER BY clause but I'm not allowed to due to the fact that it is an sub select.
Is there an alternative way of doing this that works as a subselect statement. (I have to use a subselect because I'm using a reporting tool where I can take advantage of subselect statements.)
Any help would be greatly appreciated.
Thanks
Gordon
Gordon BOCP
Crystalize