Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Order by must be construct by variable

Re: Order by must be construct by variable

From: Sybrand Bakker <gooiditweg_at_nospam.demon.nl>
Date: Sat, 15 Mar 2003 19:03:29 +0100
Message-ID: <eiq67v45f5o2ajp5v0i7rc1sfqnfohtqi6@4ax.com>


On Sat, 15 Mar 2003 17:20:32 +0100, "Oraclion" <inferno74_at_caramail.com> wrote:

>Hi
>
>I don't want use DBMS_SQL (Code translation of my query to DBMS is too hard,
>700 lines ... hum)
>
>For example i want to create my query
>SELECT * FROM T WHERE ... ORDER by Buff
>
>Is there a way to compute order by in buff
>=> CURSOR C1(buff) Is SELECT * FROM T WHERE ... ORDER by Buff;
>begin
> buff := field1 ASC, Field2 DESC;
> OPEN C1(buff);
> ....
>end;
>
>if no solution i'll go in DBMS_SQL but not cool for this query.
>
>Besrs regards
>Oraclion
>

You must distinguish between static (pre-compiled) and dynamic sql. In static sql you should replace hardcoded literals in where clauses by variables. This is at the same time the only application for variables in static sql. In all other cases -------> dynamic sql, either by means of Native Dynamic Sql (open <cursor variable> for ) in 8i and higher, or dbms_sql (all versions)

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Sat Mar 15 2003 - 12:03:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US