sql - Update row value for column with increment on Oracle Database -


i trying write stored procedure update on oracle database want 'labelcount' incremented one.

member_num field not allowed same value twice.

any advice?

labelcount:= 1    if (major_count >=1 ) , (min_count >=1 )           update  tbl_members           set     member_num = major || 'm' || labelcount             member_id = minor , member_num = 'xxx';   end if;  

so this:

member_id   | member_num    |       | xxx       |       | 4444      |       | xxx       |       | xxx       | 

becomes

member_id   | member_num    |       | am1       |       | 4444      |       | am2       |       | am3       | 

not quite sure understand requirement due "4444" value on member_num column i'd give shot:

ddl:

create table tbl_members (     member_id       number   , member_num      varchar2(100) );  create sequence labelcount start 1;  create or replace procedure inc_label_count (p_major_count number, p_min_count number)      l_stage varchar2(100);  begin      l_stage := 'checking count values';      if (p_major_count >=1 ) , (p_min_count >=1 )            update  tbl_members           set     member_num = 'major' || 'm' || labelcount.nextval             member_id =  'minor'                         ,     member_num = 'xxx';      end if;    exception     when others         dbms_output.put_line('error in stage: '||l_stage||' '||sqlerrm);         end inc_label_count;     

that's far can go, since that's information have.

can provide more?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -