Harald,
The original sql is valid Oracle SQL, and works fine with cx_Oracle.
The only time you need to provide an alias is when you directly refer to the subquery
somewhere else in your query.
You may be thinking of another RDBMS (like MS Sql Server).
Dehong,
Perhaps you could provide the error you're getting and, as Amaury mentioned,
the exact sql statement you're trying.
Massa, Harald Armin wrote on 2011-05-23:
> Dehong,
>
> that is no valid Oracle SQL.
>
> To use a query within a FROM-Clause, you have to give an alias. As in
>
> select count(*) from
> (
> select * from employee
> ) emp
>
>
> ( I assume we are talking test-sql; no production system should use
> "select *" or unrestricted count)
>
> Harald
>
>
> It seems that cx_Oracle will return syntax error if the sql string has
> the
>
>
> embedded sql selection statements.
>
> such as,
> select count(*) from
> (
> select * from employee
> )
>
> Is there any solution for it?
>
>
>
>
Regards,
Gerrat
|