Home » SQL & PL/SQL » SQL & PL/SQL » order by variable
order by variable [message #788] Mon, 04 March 2002 10:56 Go to next message
Julia
Messages: 30
Registered: December 1999
Member
I need to create a procedure in which output data must be in order defined by customer (as a procedure parameter). How to do it?
Re: order by variable [message #790 is a reply to message #788] Mon, 04 March 2002 11:57 Go to previous message
monir
Messages: 22
Registered: February 2002
Junior Member
use cursor
SEE this exemple with cursor TO HAVE IDEA:

CREATE OR REPLACE procedure PROCEDURE_NAME
(
prm1 in type1,prm2 in type2

)

IS
-- DECLARE A CURSOR
CURSOR C1 IS
SELECT * FROM table_name
where column_name1 = prm1
and column_name2 = prm2
order by column_name3;

BEGIN
-- LOOP IN THE CURSOR
for c1_cur IN C1 LOOP
-- ANY INSTRUCTION WITH C1.COLUMN_NAME;
END LOOP;

END;

GOOD LUCK
MONIR
Previous Topic: Date conversion
Next Topic: Re: Cross Tab Report
Goto Forum:
  


Current Time: Thu Mar 28 04:57:33 CDT 2024