Thursday, June 23, 2011

Bagaimana nak panggil Satu Query Dari Coldfusion ke Oracle

contoh nak panggil package procedure dari oracle


contoh ini akan tarik query... so processing adalah dari database server bukan web server... jimattttttt


create or replace 
package test_sel_query
as
    type cursorType 
     is ref cursor;

    function test_func 
     return cursorType;

end;
/

create or replace 
package body test_sel_query
as

   function test_func 
    return cursorType
   as
      cursor_v   cursorType;
   begin
        /* 
        Put whatever SQL and/or processing here.
        I use the Oracle dictionary table 
        all_objects as an example.
        */
       open cursor_v 
         for 
         select object_id, 
                object_type, 
                  object_name 
         from all_objects 
         where rownum <= 15;

       return cursor_v;

   end test_func;

end test_sel_query;
/


Terbaekk... kata tok aba...


<cfstoredproc 
 procedure="test_pkg.test_sel_query" 
 datasource="yourDSN">
    <cfprocresult name="q">
</cfstoredproc> 
<cfdump var="#q#">