Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL

Re: PL/SQL

From: S Bunker <bunkers_at_bigfoot.com>
Date: 2000/06/02
Message-ID: <aA0_4.605$Ko2.17042@wormhole.dimensional.com>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US