Re: Pl/SQL Question

  • From: Ram K <lambu999@xxxxxxxxx>
  • To: davidsharples@xxxxxxxxx
  • Date: Tue, 23 Aug 2005 10:56:23 -0400

Hi,
   
   Cant we select directly from a sequence without having to use a
function? Is there any advantage to using a function?
   
Thanks


On 8/23/05, David Sharples <davidsharples@xxxxxxxxx> wrote:
> a function would be better here
> 
> create or replace function ds_func (seq_name  in varchar2) return number
> as
> seq_result number(38);
> begin
> execute immediate 'select '||seq_name||'.nextval from dual' into
> seq_result;
> return seq_result;
> end;
> / 
> 
> Function created.
> 
> 
> 
> 
> SQL> select test_func('dave_seq') from dual;
> 
> TEST_FUNC('DAVE_SEQ')
> ---------------------
>                    15
> 
> why you would want to do this is probably a better question
> 
> On 8/23/05, savitha malve <savithamalve@xxxxxxxxx> wrote:
> 
> > I have been given a task to write a piece of pl/sql code/procedure which
> > should accept a sequence name as IN  parameter and output the nextval
> using
> > OUT parameter. Any tips, ideas, suggestions will be very much
> apprectaited.
> --
> //www.freelists.org/webpage/oracle-l
> 

-- 
Thanks,
Ram.
--
//www.freelists.org/webpage/oracle-l

Other related posts: