Entry 3018

sample junk pl/sql

   

Submitted by Ray on Jan. 16, 2010 at 6:13 a.m.
Language: SQL. Code size: 593 bytes.

declare
  /* declare some junk */
  tt number := 3.509;
  /* an inline function */
  function do_it(p_num number) return varchar2 is
     l_ret varchar2(32676) := null;
  begin
     for i in ( select cola, colb from me.taba where colc = tt )
     loop
          l_ret := l_ret || 'testing -> ' || i.cola || chr(9) || i.colb;
    end loop;
    return l_ret;
  exception when no_data_found then
    return 'Nothing';
  when others then
     dbms_output.put_line('Error');
     raise;
  end;
begin -- start the anonymous pl/sql block
   dbms_output.put_line( do_it(tt) );
end;

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).