Journal table business rules
We have a package in the database in which we use the TAPI INS procedure to insert data into a table.
How should we open an close the transaction so that for every insert record a record in the journal table is created.
We have created journalling business rules. A normal INSERT INTO statement works (because we also use the TAPI triggers). But if we use a cursor loop and within the loop the TAPI INS statement, only 1 record is created in the journal table (the first record that was inserted).
Should we place the openening and closing of the transaction inside or outside of the cursor loop?
The current code is outside the loop, like this:
qms_transaction_mgt.open_transaction
( p_trans_opened_by => 'myprocedure'
for r_import in c_import
loop
l_rec.id := Null;
l_rec.code := r_import.code;
l_rec.description := r_import.description;
l_ind.id := False;
l_ind.code := True;
l_ind.description := True;
cg$my_table.ins(l_rec, l_ind);
end loop;
qms_transaction_mgt.close_transaction
( p_trans_opened_by => 'myprocedure'
commit;
Anyone have a suggestion how solve this?
The only way we can circumvent this problem is by not using the TAPI procedure, but use normal DML (INSERT, UPDATE).
Similar Messages
-
Is there any table to log ODI business rules alone?i could see business rules stored in backend table SNP_TXT.
But that table contains information other than buisness rules also..
My requirment is, i need to show the business rules in the GUI screen set by users in ODI .Hi,
You can print the content of an Interface or Package by following steps -
1. Open the ODI Designer
2. Go to project, expand the objects under the project tree
3. Select a folder in the project, right click> Print option.
You can choose to print Interface/Package/Procedure or Folder
Thanks -
Designer TAPIs, business rules, and journalling
Is it possible to create table APIs, as with Designer, when using either SQL Developer or the Data Modeler?
If not, is the practice of encapsulating tables considered redundant and do you have any suggestions as to where business rules should be placed (assuming we're not placing them all in an ADF middle tier)?
I also noticed a previous post stating that the creation of journal tables, again as in Designer, was not possible with SQL Developer / Data Modeler. Are there any plans to add this very useful functionality?
Thanks,
DavidMaybe this project will be helpful.
http://code.google.com/p/tapig/
Table API Extension for Oracle SQL Developer
Regards -
Error creating 'Journalling Business Rules'
When running 'Maintain Journalling Business Rules' for a table with 19 columns an EMPTY 'BR_xxx_JRN_DEL' trigger is created , hence the CAPI definition fails.
If I add 1 more column to make it 20 columns the 'BR_xxx_JRN_DEL' and the CAPI are both generating correctly.
Has anyone else found this ?????Sandra,
Ok we have the modified version of hsd and we still have similar problem. Here is the detailed log
Log Messages
Utility Maintain Journalling Business Rules
Revision 6.5.3.2
Parameters
Prompt Value
Table to be Journalled app/ my table
Errors
Message
Activity aborted with ORACLE internal errors.
-6502 ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Debug Detailed
Message
BLAPI.OPEN_ACTIVITY
Number of Tables to create/delete Journalling Rules for: 1
Business Rule Design Definition for BR_xxx_JRN_UPD
No Update Trigger Columns specified. Business Rule BR_xxx_JRN_UPD will fire when any column is updated.
end of initial_checks
Create/maintain message with constraint_name = HRS_BR_xxx_JRN_UPD
Message QMS-00151 already exists in Headstart message tables, no new message was created.
Activity aborted with ORACLE internal errors.
-6502 ORA-06502: PL/SQL: numeric or value error: character string buffer too small
and this is the piece of code from bltext
-- 6.5.2.3 changed if condition
-- if length(l_text_lines(l_ctr + 1))+ 2 + length(l_build_string) > 1990
if length(replace(l_text_lines(l_ctr + 1), chr(10), NL_CR)||NL_CR)
+
length(l_build_string) > 2000
then
exit;
end if;
end loop; -- compose 1 build string
-- 6.5.2.3 changed if condition
-- if nvl(length(l_build_string),'') > 0
if nvl(length(l_build_string),0) > 0
then
-- 6.5.0.1 column element_type_for added.
insert into cdi_text
( txt_ref
, txt_seq
, txt_type
, txt_text
, element_type_for
values
( p_el_id
, l_insert_at_seq
, p_text_type
, l_build_string
, p_el_type
end if; -- nvl(length(l_build_string),'') > 0
if l_ctr >= p_text_counter
then
exit;
else
l_build_string:= '';
l_insert_at_seq:= l_insert_at_seq + 1;
end if; -- l_ctr = p_text_counter
end loop; -- (maximum) over all lines in local text-store
end if; -- l_lock
exception
when others
then
bllog.write
('Exception: '||sqlerrm
, bllog.debug
bllog.write
(' Length Buildstring '||to_char(length(l_build_string))
, bllog.debug
bllog.write
(' Line number '||to_char(l_insert_at_seq)||' Text type = '||p_text_type
, bllog.debug
bllog.write
( 'Exception; Note that the text for this element may have been corrupted.'
, bllog.errors
end write_lines_to_repository; -
Business rules to implement - BEST way - triggers and mutating table
I have the following table where it has Foreign Key defined on itself(self reference for parent_id column which can be null or valid site_id)
create table test_virtual_site
site_id number CONSTRAINT site_id_pk primary key,
parent_id number CONSTRAINT parent_site_id_unq UNIQUE ,
closed_date date default NULL ,
CONSTRAINT check_self_ref CHECK(parent_site_id <> site_id), --avoid self refernce
CONSTRAINT check_valid_site foreign key(parent_site_id) references test_virtual_site(site_id)
I have the following business rules to implement and my problem is related to their implementation
1) A check should be made that Site_id specified as parent_id should not be a child of any other store (parent should have its parent_id column as NULL)
Site_id Parent_id
1
2 1
3 2 =>NOT VALID 2 is a child of another store
2) Parent is not closed
Site_id Parent_id Closed_date
1 10-May-2005
3 1 =>NOT VALID 1 is a closed
3)
when parent store is closed - updated so at closed_date is not null
Want to set the parent_id as NULL for the child store.
OR
SET the closed_date for child store too same as the parent_store.
Example
Site_id Parent_id Closed_date
1
1 2
Update test_virtual_site
SET closed_date = sysdate
Where site_id = 1 ;
Through Trigger
Site_id Parent_id Closed_date
1 22-Mar-06
1 2 22-Mar-06
OR
Site_id Parent_id Closed_date
1 22-Mar-06
1
When I am trying to do the above mentioned through constraints I am running into mutating trigger problem. Can you please guide me what is the best way to handle the above-mentioned scenarios.
I am aware that I can avoid the 3rd problem using the following
-- - Initialize an array in the before statement trigger.
-- - Add the processed rowid to the array in the after row
-- trigger.
-- - In the after statement trigger: get each rowid from the
-- array and process it. When all rowids are processed, clear
-- the array.
BUT for 1 and 2 I need to look at the parent specified , the parent exists in the same table BUT I can not perform the lookup from the BEFORE INSERT ROW LEVEL trigger but I want to ensure at the row level , so if the parent store is closed or parent specifed itself is a child(not permissible) I want to rollback the insert RAISE_APPLICATION_ERROR.
Can you please guide me what is the best way to handle the above mentioned conditions .I have the following table where it has Foreign Key defined on itself(self reference for parent_id column which can be null or valid site_id)
create table test_virtual_site
site_id number CONSTRAINT site_id_pk primary key,
parent_id number CONSTRAINT parent_site_id_unq UNIQUE ,
closed_date date default NULL ,
CONSTRAINT check_self_ref CHECK(parent_site_id <> site_id), --avoid self refernce
CONSTRAINT check_valid_site foreign key(parent_site_id) references test_virtual_site(site_id)
I have the following business rules to implement and my problem is related to their implementation
1) A check should be made that Site_id specified as parent_id should not be a child of any other store (parent should have its parent_id column as NULL)
Site_id Parent_id
1
2 1
3 2 =>NOT VALID 2 is a child of another store
2) Parent is not closed
Site_id Parent_id Closed_date
1 10-May-2005
3 1 =>NOT VALID 1 is a closed
3)
when parent store is closed - updated so at closed_date is not null
Want to set the parent_id as NULL for the child store.
OR
SET the closed_date for child store too same as the parent_store.
Example
Site_id Parent_id Closed_date
1
1 2
Update test_virtual_site
SET closed_date = sysdate
Where site_id = 1 ;
Through Trigger
Site_id Parent_id Closed_date
1 22-Mar-06
1 2 22-Mar-06
OR
Site_id Parent_id Closed_date
1 22-Mar-06
1
When I am trying to do the above mentioned through constraints I am running into mutating trigger problem. Can you please guide me what is the best way to handle the above-mentioned scenarios.
I am aware that I can avoid the 3rd problem using the following
-- - Initialize an array in the before statement trigger.
-- - Add the processed rowid to the array in the after row
-- trigger.
-- - In the after statement trigger: get each rowid from the
-- array and process it. When all rowids are processed, clear
-- the array.
BUT for 1 and 2 I need to look at the parent specified , the parent exists in the same table BUT I can not perform the lookup from the BEFORE INSERT ROW LEVEL trigger but I want to ensure at the row level , so if the parent store is closed or parent specifed itself is a child(not permissible) I want to rollback the insert RAISE_APPLICATION_ERROR.
Can you please guide me what is the best way to handle the above mentioned conditions . -
Different tables used in Consolidation Business Rules
I was going through the documentation of different tables that needs to be maintained for consolidation business rules. I am a little confused and need some clarifications.
These are different tables that needs to be maintained for consolidation -
clcELIM - This table will tell what each source account needs to be divided into what 4 destination accounts.
clcRULES - The RULES will tell how this source account needs to be divided (percentage wise as stored in the OWNERSHIP application) into these 4 destination accounts.
clcMETHOD - This table lists down the different methods (along with their types and description) and its used in the clcRULES table
clcELIMH_- What does this table do and where does it come into picture?
*clcELIM_ - Is this same as clcELIM table mentioned above?
clcRULESH - What does this table do and where does it come into picture?
Also, what am I looking at is what is the sequence in which these tables needs to be defined.
For example -
1. clcELIM has a field called RULE whose details are mentioned in clcRULES.
2. clcRULES has a field called METHOD and I_METHOD whose detailes are mentioend in clcMETHOD.
3. .... I am not sure what other tables do? Please fill in the gaps.
Thanks everyone for their help so far.
Ameya Kulkarni
Edited by: Ameya Kulkarni on Sep 18, 2008 7:19 PM
Edited by: Ameya Kulkarni on Sep 18, 2008 7:21 PM
Edited by: Ameya Kulkarni on Sep 18, 2008 7:21 PMGreat explanation Alwin!
Since I am new to SAP BPC world and to tell the truth, consolidation world as well (I am a planning & forecasting guy), my follow up questions are -
(Sorry if the questions are naive).
So according to what you have explained, clcELIM and clcELIMH work together along with clcMETHOD to define the elimination rules for entities.
What do clcRULES and clcRULESH do?
Also you said that these are the SQL tables (clcELIM, clcRULES, clcELIMH etc.) and its advisable not to configure them directly. So what business rules from the administration side update these tables. I am sure the METHOD administration will update clcMETHOD while RULES administration will update clcRULES and clcRULESH, is that right? what about ELIM and ELIMH.
I am asking these questions since I dont have the system to work on yet but will be getting it on Monday next week. Right now I am trying to grasp as much as I can. So if you can send me some snapshots to amey420 at gmail dot com, that will be really appreciated.
Also you can send me the other documents you were talking about. I will shoot you an email as well.
Thanks a lot for your help.
Ameya Kulkarni -
Use of decision table in Oracle Business Rule
hello,
I am using Oracle Business Rule beta version to develop a rule base application.
I want to know that how i can make use of table to make decision on the basis of table data .
thanx
saleemhello,
I am using Oracle Business Rule beta version to develop a rule base application.
I want to know that how i can make use of table to make decision on the basis of table data .
thanx
saleem -
Difference between use of decision table and if/then in business rules
Hello ,
Could some one please explain me difference between use of decision table and if/then in business rules in short.
- ShirishHi,
They are equivalent, pretty much what you can do with a decision table you can also do with if/then...
However, decision tables provide automated features that can reduce the number of required rules, as compared to the if/then rules (this is called rule coalescing).
Have a look on this document... Search for 5.1.1 What is a Decision Table?
http://docs.oracle.com/cd/E23943_01/user.1111/e10228/decision.htm#CJHFIAHG
Cheers,
Vlad -
Error when opening business rules table in BPC 4.2
Hi,
I get the error "Unexpeted server error" when I try to open the business rules table in BPC 4.2 SP6.
I've tried the optimisation, processing the cubes and restarting the send governor services.
Rregards,
MosaHI,
Hope you had a goo festive season.
Yes, I'm still experiencing the problem. I can't even create a new table in eAdmin.
Is there another way to access the tables or is there a setting I need to modify in order to get this to work?
Regards,
Mosa -
Business Rule error: Accounts are not available in the rule table
Hi everybody,
I have a problem running the Business Rule for the profit/loss copy to the equity account.
The Business Rule I set reads from all P&L accounts, P&L specific flow, acual category, all datasources and then it writes everything keeping the source settings apart from the account destination (the equity profit/loss account) and the flow destination (I write in two different flows, so the rule is made up of two equal lines differing only in the flow destination). "PROFIT" is the ID I chose.
Then I created the related script logic (ID=CALCACCOUNT):
*RUN_PROGRAM CALC_ACCOUNT
CATEGORY_M = %CATEGORY_M_SET%
CURRENCYLABEL = %CURRENCYLABEL_SET%
TID_RA = %TIME_SET%
CALC=PROFIT
*ENDRUN_PROGRAM
Finally, the prompt ( process chain: CPMB/RUNCALCACCOUNT):
PROMPT(SELECTINPUT,,,,"CATEGORY_M,CURRENCYLABEL,TIME")
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SUSER,%USER%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SAPPSET,%APPSET%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SAPP,%APP%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SELECTION,%SELECTION%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,LOGICFILENAME,CALCACCOUNT.LGF)
But anytime I run the package it fails giving me the message error: "Accounts are not available in the rule table".
I tried every possible change but nothing; if someone could help me somehow I'd be really grateful!!
Thanks
FilippoHi James,
Thanks for your quick response. There is no currency dimension in the application... I've tested with the correct businessrule as CALC value, but this didn't do the trick.
Any other suggestions?
Regards,
Vincent -
How to incorporate table data with Oracle Business Rule
hello
I want to use table with data in Oracle Business Rule can i do it.
if yes please write how .
with regs
saleemHi,
like with coloring of cell according to value and so many.How to do that?
Answer is, you can't
Frank -
Hi,
What is/are the tables that stores business rules information in the database?
Thanks,
lakshmi.You can write a rulebase provider plug-in to load your rulebase .zip file from wherever you wish. The rulebase must always be authored with Oracle Policy Modeling in the first place.
Davin. -
Oracle Business Rules decision tables - export
This is a beginner's question.. Suppose that you want to use an Oracle Business Rules (OBR) decision table, for example to check company’s eligibility for financing based on their country and business type (PRIVATE or PUBLIC). You would define a corresponding decision table in JDeveloper with true/false assignments in the Actions. Is it possible to export this decision table somehow? Ideally we would want to have a web service returning the decision table data as XML, which would then be used to generate PDF or a dynamic webpage etc. Then we would have OBR as the only point of data entry.
I moved this to "SOA Suite and OC4J 11g Technology Preview"
Business Rules - Decision Tables and Buckets
Chandresh -
Is it possible to have business rules as a table
Hello Friends,
I have an application where in which I had altogether some x procedures, y fucntions and z triggers .
Right now I have implemented all the business rules in the procedures, triggers , and fucntons. Is it possible to have
the implementatkon of business rules as a table so that i can use the table as a rules engine .
I have done with java technologory usaing the business rules as a seperate external file and reading the file for business rules. How about oracle is it possible. If yes can any one give a scenario how i can implement.
thanks/kumarAs posted, your whole procedure could be replaced with:
procedure update_paycheck_deductions is
cursor c1 is select * from MINC ;
cursor c2 is select * from FINC ;
v_flag_boolean boolean := false;
v_famid number ;
BEGIN
for i in c2 loop
for j in c1 loop
if ( i.famid = j.famid ) then
v_flag_boolean := true;
v_famid := j.famid;
end if ;
end loop ;
if ( v_flag_boolean = true ) then
update FINC set famtfedx = 0 WHERE famid = v_famid ;
update FINC set fgovretx = 0 WHERE famid = v_famid ;
update FINC set fpripenx = 0 WHERE famid = v_famid ;
update FINC set frrdedx = 0 WHERE famid = v_famid ;
update FINC set fsltaxx = 0 WHERE famid = v_famid ;
end if;
v_temp_sum_anfedtx := 0;
v_temp_sum_angovrtx := 0;
v_temp_sum_anprvpnx := 0;
v_temp_sum_anrrdedx := 0;
v_temp_sum_ansltx := 0;
end loop;
end;Since none of the j.column != null and predicates will ever be true. This is roughly equivalent to your code:
SQL> WITH t AS (
2 SELECT 10 amount, 'Y' col2 FROM dual UNION ALL
3 SELECT null, 'Y' FROM dual UNION ALL
4 SELECT 25, 'N' FROM dual)
5 SELECT amount, col2, CASE WHEN amount != NULL and
6 col2 != 'N' THEN amount
7 ELSE 0 END eval_amount
8 FROM t;
AMOUNT C EVAL_AMOUNT
10 Y 0
Y 0
25 N 0This would simplify Toon's merge statement to:
merge
into FINC f
using (select distinct j.famid, 0 amount
from MINC j) m
on (f.famid = m.famid)
when matched then
update set f.famtfedx = m.amount
,f.fgovretx = m.amount
,f.... = m.amount
,f.... = m.amount
,f.... = m.amountWhich could be further simplified to:
update finc
set famtfedx = 0,
fgovretx = 0,
where famid in (select famid from minc)Whiich strikes me as an odd business rule, specially for one dealing with (apparently) payroll.
I won't go into the fact that you will scan every record in once for every record in minc. I hope these are not large tables.
I have seen a number, and even worked on a a couple of payroll systems based on "business" rules in tables to avoid putting the rules in code. None of them were very good and perfomance tended to lag when there were more than a few people to pay.
You need to explain a lot more about what sort of business rules you want to put into tables.
John -
BPC NW - Error in Business Rule for Account transformation rule table
hi
I have given the Account transformation Rule to move Amount from Account A to Account B and then I have given the following script logic in the default script
**RUN_PROGRAM CALC_ACCOUNT*
*CATEGORY = Category*
*CURRENCY = RptCurrency*
*TID_RA = %TIME_SET%*
*CALC=A*
*OTHER = ENTITY=C1000*
**ENDRUN_PROGRAM*
But when I try to load data through Input schedule in Account A and expect amount to transfer to Account B, I m getting an error
Book Name:Book4
Application : PLANNING*
Status : Failed*
Submitted Count : 1*
Accepted Count : 1*
Rejected Count : 0*
- Error Message -*
Error running default logic (Business rules are not available)
- Rejected record list -*
Error converting records: The root element is missing.
Can someone please advice me what to do ....hi Marcel,
Lot of thanks for your answer.
But I have used your logic after removing GROUPS as I dont have GROUPS dimension in my application.
*RUN_PROGRAM CALC_ACCOUNT
CATEGORY = %CATEGORY_SET%
TID_RA = %TIME_SET%
CALC=FX
OTHER = [ENTITY=%ENTITY_SET%]
*ENDRUN_PROGRAM
This is the error I m getting
Book Name:Book3
Application : PLANNING
Status : Failed
Submitted Count : 1
Accepted Count : 1
Rejected Count : 0
- Error Message -
Error running default logic (Business rules are not available)
- Rejected record list -
Error converting records: The root element is missing.
Can you please advice
a) Does it mean some issue with my client installation as I dont see these LGF files. I even dont see the data folder in which lgf files are supposed to be present
b) Where to find information for this interface CALC_ACCOUNT? How did you decide to use 'FX' and how do you know which dimensions to use. Like I dont have GROUPS.
Please give me your comments.
regards
Gaurav
Maybe you are looking for
-
Error catching in process chains
Hi experts I need to know if it's possile to catch errors while executing a process chain; actually if one of my process chains fails, it brutally stops without reaching the last process that resets some flags and sends an email to the client. Instea
-
Problem with Cross-tab report (RTF Template) null values, current-group()
Hi, experts! I generate Cross-tab report using RTF Tamlpate and I have problem with grouping. My XML file have to be with one group only because I want to using dynamic regrouping inside the RTF template. Here is my data structure (XML file):(Look th
-
How can I completely and safely remove iTunes, QuickTime, iPod from my system? I am running Vista Ultimate and can not upgrade/uninstall without receiving HKLM\...\Current Version\Run errors. Microsoft insists this is an Apple problem and have not re
-
HT1657 Where do I find my rented movie on my iPad. Then how do I get it to play
Where do I find my rented movie and how do I play it. It shows it was downloaded.
-
VAT identification number.
Hi all,where i could change the VAT identification number in the invoice. there is going the wrong nor and i need to modificate that. Thanks in advance and regards. William