Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can we access a bucketset from Business Rules Function

Hi

How are you doing!

I have a scenario where there is a holiday list stored in a BucketSet. I have a funciton which calculates the next business day by checking if the next day to the input is in saturday/sunday and in the list of values in the bucketset.

For saturday/sunday check, Rules have already pre-defined functions

          nxtDayCalObj.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY

But I could not iterate over the bucketset to check if the value is in this list.

     My code would look like if nxtDayCalObj in <BucketSet_HolidayList>

But seems like Bucketset is not visible in Funcitons. Gloabls are visible however.

Do you have any idea on how to access a bucketset in Function?

Regards

RaviKiran

Comments

561093
create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is
l_Sum Number;
l_Multiple Number;
Begin
For I in 1..12 Loop
If mod(i,2) = 0 Then
l_Multiple := 3;
Else
l_Multiple := 1;
End If;

l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple;
End Loop;
If Floor(l_Sum/10) - Mod(l_Sum, 10) = Substr(P_Str, 13) Then
Return('TRUE');
Else
Return('FALSE');
End If;
End;
/


SQL> select ean_13('2741023456884') from dual;

EAN_13('2741023456884')
-------------------------------------------------------
TRUE

SQL> select ean_13('2741023456881') from dual;

EAN_13('2741023456881')
-------------------------------------------------------
FALSE
547235
Thanks for you prompt response,

why it does not work for the following:
2741012605644
2741012605651
2741000000017
it returns false.
561093
create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is
l_Sum Number;
l_Multiple Number;
Begin
For I in 1..12 Loop
If mod(i,2) = 0 Then
l_Multiple := 3;
Else
l_Multiple := 1;
End If;

l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple;
End Loop;

If 10 - Mod(l_Sum, 10) = Substr(P_Str, 13) Then
Return('TRUE');
Else
Return('FALSE');
End If;
End;
/


SQL> select ean_13('2741012605644') from dual;

EAN_13('2741012605644')
------------------------------------------------
TRUE


SQL> select ean_13('2741012605651') from dual;

EAN_13('2741012605651')
--------------------------------------------------
TRUE


SQL> select ean_13('2741000000017') from dual;

EAN_13('2741000000017')
------------------------------------------------
TRUE
547235
THANKS BUDDY...YOU SAVED MY DAY
547235
HI CITRUS,

DO YOU HAVE THE OUTPUT PROCEDURE FOR GENERATING TEXT FILE FOR THE AIRMILES PROGRAMME

THANKS.
572471
SQL> with t as (select '2741023456884' str from dual)
  2  --
  3  select decode(substr(10 - mod(sum(substr(str, level, 1) *
  4                             decode(mod(level, 2), 1, 1, 3)),
  5                         10),-1,1),
  6                substr(str, -1, 1),
  7                'TRUE',
  8                'FALSE')
  9    from t
 10  connect by level < length(str)
 11  /

DECODE(SUBSTR(10-MOD(SUM(SUBST
------------------------------
TRUE

SQL> 
547235
thanks volder
1 - 7
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 16 2014
Added on Dec 19 2013
0 comments
130 views