Re: Stored Function
Incomplete spec. Does the table have just one row? Otherwise, how is the func to identify which row to update? Assuming it has just the one row ...
drop table if exists master;
create table master( callno int );
insert into master set callno=1;
select callno from master;
drop function if exists callnoincr;
delimiter go
create function callnoincr() returns int deterministic
begin
declare n int default 0;
set n = (select callno from master);
update master set callno=n+1;
return (select callno from master);
end;
go
delimiter ;
select callnoincr();
Edited 1 time(s). Last edit at 01/02/2017 04:46PM by Peter Brawley.
Subject
Written By
Posted
Re: Stored Function
January 02, 2017 04:38PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.