I want to write a PL/SQL search engine that does some complex checking of various tables for a client's website. I could write it all in a PHP $sql = "SELECT ..." but I want to put it the sql into PL/SQL and am having trouble figuring out how PL/SQL outputs results.
Basically, I want to call the procedure with some keywords and have it return the results. Something like this:
create package jonsearch is
procedure getrecords(kw IN varchar, results OUT ???) is
--complex sql goes here
jonsearch.getrecords("keywords") would return the results just like select * from table would return results.
My trouble is that every tutorial I have read relies on dbms_output.put_line to output data. I want to output the results as a set, with an output variable, but I can't find a tutorial that shows how to use output variables.
Any help, even pointing me to a tutorial, would be great.
How are you wanting to output the variables? If you want to simply return the values, you will use the DBMS_OUTPUT package. If you are returning to Apache through the modplsql module, you will use the HTP and HTF packages.
As to REF Cursors, here is a Reader's Digest version: