| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.misc -> Re: HTML -> Oracle Procedure question
> An option which might do what you want is below :
> create or replace procedure showemps (i_emp_id   NUMBER DEFAULT NULL )
>
> as
>
> CURSOR c_emps
>     IS SELECT employee_id
>          FROM employee_table ;
>
> v_emp_details  employee_table%ROWTYPE ;
>
> BEGIN
>      -- Start by generating Page header
>      htp.htmlOpen;
>      htp.headOpen;
>      htp.title('Employee Information');
>      htp.headClose;
>      htp.bodyOpen( cattributes => 'BGCOLOR="#000000" TEXT="#FFFFFF"');
>
>      -- If procedure called with no options then display selection page
>      if  i_emp_id is null THEN
>          BEGIN
>             htp.p('<H1> Select an Employee : </H1>');
>             htp.formOpen( curl =>
> OWA_UTIL.GET_OWA_SERVICE_PATH||'showemps' );
>             htp.formSelectOpen( cname   => 'i_emp_id',
>                                 cprompt => 'Please choose an ID : ' );
>             FOR empid_rec IN c_emps LOOP
>                 htp.formSelectOption( cvalue => empid_rec.employee_id );
>
>             END LOOP;
>             htp.formSelectClose;
>             htp.formSubmit('Send','Submit Search');
>             htp.formClose;
>          END ;
>      else
>       -- If procedure called with options then display details
>         BEGIN
>             htp.p('<H1> Employee Details : </H1>');
>
>             SELECT *
>               INTO v_emp_details
>              WHERE empid_rec = i_emp_id ;
>             htp.p('ID :'||v_emp_details.employee_id);
>             -- Continue here with additional details.
>
>          EXCEPTION
>              WHEN NO_DATA_FOUND THEN
>                  HTP.p('Employee Not Found');
>          END ;
>      END ;
>      htp.bodyClose;
>      htp.htmlClose;
> end;
> /
>
>
Received on Sun Oct 31 1999 - 21:10:36 CST
|  |  |