plsql - Use of Decode() if not equal condition in pl sql -


i working on cursors. in have 1 task such if column1=21 column2 can in ('item1','item2','item3') if column1 other 21 column2 can 'item1'. , both column1 , column2 part of primary_key.

so tried approach..

i provide value in column2 above 3 values , in processing check if column1 21 can use of above 3 values , if column2 other 21 have use 'item1'.

but using 2 columns in cursor , part of primary key , have fetch rowid in cursor check duplicate record.

but not rowid change value of column2 in processing.

so thinking use decode() not getting idea how use case:

if column1 =21    column2:={item1,item2,item3}//any 3 values end if;  if column1 <> 21    column2:='item1' end if; 

please suggest me.

you can do:

column2 := decode(column1, 21, '{item1,item2,item3}', item1) 

by way, "any 3 values" - non-deterministic why entered string '{item1,item2,item3}'.

if know 1 of these values want - can replace string '{item1,item2,item3}' value.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -