Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL
One option would be to make it a function and use only IN parameters, but have the function return a record TYPE you declared, to be composed of custid,cn and ref. You could even create a dummy table with custid,cn,ref and make the return of the function be dummy_table%ROWTYPE. You would also need to set the PRAGMA for the function to work in a SELECT statement. When you then typed "SELECT YOURFUNC(57,'Joe','Dell') FROM dual" you would get the kind of output you were looking for. It might be easier just to use a procedure instead -- but its a little more a hack.
You could make it a procedure and you need only use IN parameters for
custid, cn and ref.
In the procedure body, use a DBMS_OUTPUT.PUT_LINE (RPAD(custid,10)||'
'||RPAD(cn,15)||' '||RPAD(ref,15)); Make sure you first issue the "set
serveroutput on" command prior to executing the procedure, to the
DBMS_OUTPUT will be displayed to the screen. You could get the output you
mentioned by using several DBMS_OUTPUT statements, as follows:
DBMS_OUTPUT.PUT_LINE (RPAD('custid',10)||' '||
RPAD('cn',15)||' '|| RPAD('ref',15));DBMS_OUTPUT.PUT_LINE (RPAD('-',10)||' '||RPAD('-',15)||' '||RPAD('-',15)); DBMS_OUTPUT.PUT_LINE (RPAD(custid,10)||' '||RPAD(cn,15)||' '||RPAD(ref,15));
Regards,
Scott
"Alexander Penev" <penev_at_cska.net> wrote in message
news:39383F38.DD1628E6_at_cska.net...
> To display where?
>
> SP wrote:
>
> > I have this program body having parameters custid 57, cn Joe and ref
Dell.
> >
> > CREATE PROCEDURE /*or function*/newShopper(custid in /*or out*/number,cn
in
> > /*or out*/varchar2,ref /*or out*/in varachar2)
> > as
> > begin
> >
> > end newshopper2;
> > /
> >
> > It should to display the values as
> >
> > custid cn ref
> > ----------- ------------------ --------------------
> > 57 Joe Dell
> >
> > Can anyone help me ? What do I need to do?
>
Received on Fri Jun 02 2000 - 00:00:00 CDT