Home » SQL & PL/SQL » SQL & PL/SQL » calling a procedure based on a distinct resultset
calling a procedure based on a distinct resultset [message #443396] Mon, 15 February 2010 08:40 Go to next message
pyscho
Messages: 134
Registered: December 2009
Senior Member
I've got this query here that return me a set of distinct records..

I need to go and call a procedure CASH_REBAL(CASH_BAL_ID) on the distinct results returned.. can anyone show me how this can be done?

SELECT 
DISTINCT ACCOUNT_ID || '~' || TXN_CCY 
AS CASH_BAL_ID 
FROM TMP_CASH_TRANS;



    PROCEDURE CASH_REBAL( CASH_BAL_ID IN VARCHAR2 ) IS
    BEGIN
        
        -- ....
    END CASH_REBAL;
Re: calling a procedure based on a distinct resultset [message #443398 is a reply to message #443396] Mon, 15 February 2010 08:44 Go to previous message
Michel Cadot
Messages: 64145
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
FOR X IN (<your query>) LOOP
   <your procedure> (X.<id>);
END LOOP;

Now you should investigate if you can't write a new procedure that will directly do the same thing for all id without calling it for each one.

Regards
Michel
Previous Topic: Time taken to modify a column datatype
Next Topic: how to convert number into binary format.
Goto Forum:
  


Current Time: Fri Dec 09 11:51:25 CST 2016

Total time taken to generate the page: 0.05036 seconds