RE: Conditional Order clause

RE: Conditional Order clause

 

  

I guess i should have explained that one.

Its running through an application server. So they are all web pages.
The loops are easier than using Cursors.




"Jankiewicz Bill - wjanki "
<oracledba-ezmlmshield-x46951723.[Email address protected]
05/30/2008 01:17 PM

To
"LazyDBA Discussion" <[Email address protected]
cc

Subject
RE: Conditional Order clause






Why on earth would you put a perfectly good sql statement into a pl/sql
for loop?

Undefined ordcol
Undefined req1
Undefined req2
Define req1=&1
Define req2=&2
Define ordcol=&3


Select column1, column2, column3, etc
From table1
Where table1.column1 = upper(&&req1)
And table1.column4 = upper(&&req2)
Order by &&ordcol
/

Save file and run

SQL> @file.sql req1 req2 ordcol



-----Original Message-----
From: Keith S Ward
[mailto:oracledba-ezmlmshield-x43026252.[Email address protected]
Sent: Friday, May 30, 2008 2:57 PM
To: LazyDBA Discussion
Subject: Conditional Order clause

( Oracle pl/sql)

Guys,
I have a pl/sql report, but i want to be able to just pass a variable
in
order to determine the Ordering.
Is this possible

Here is an example.


For my_records in (Select column1, column2, column3, column4, column5
from table1
where table1.column1 = 'Req1'
and table1.column4 = 'Req2'
Order by column2)
loop
print results;
end loop;

I want to be able to order by Column1, column 2 or Column 5 depending on

what variable is passed.


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html


*************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be
legally privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank you.
*************************************************************************



---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html






Oracle LazyDBA home page