Validating detail records in same table..
Hi all,
I'm stuck in problem..
i've a detail table where there are 4 Dates field. First User A fills the date field A.... Then User B comes enters date field B.
now user B should filll the date field in such a way that if User A has filled like
Date Field A Date Field B
12-Apr-2010 22-Apr-2010 should be +8 days
20-Apr-2010 25-Apr-2010 should be +5 days
30-Apr-2010 05-May-2010 should be +5 days But the problem is how i validate this ? how i know that users B's cursor is on second record & that should be validated with 20-Apr-2010 Only? 12-Apr should be validated wiht 22-apr...20-apr should be with 25-apr..same goes for remaining..
Any help will be appreciate.
Regards!
Thanks for the reply.
But how do user get to know that which field/record date is wrong? it'll show up an error for all the fields/records..
Do you have any idea regarding COPY,NAME_IN :SYSTEM.????? variables..? it'll be better if we'd put up validation on field itself?
Regards...
Similar Messages
-
DELETING child record of same table.. qry required( complicated)
hai
how to delete the child record of same table...?
Here is the example...
CREATE TABLE TDA
( PKNODAVE VARCHAR2(7 BYTE) NOT NULL ENABLE,
DTCREATION DATE,
DAVETRANSFERT VARCHAR2(7 BYTE),
PKPARC NUMBER(5,0)
ALTER TABLE TDA ADD CONSTRAINT PK_TDAV8 PRIMARY KEY (PKNODAVE)
ALTER TABLE TDA ADD CONSTRAINT FK_TDA1 FOREIGN KEY (DAVETRANSFERT)
REFERENCES TDA (PKNODAVE) ENABLE
REM INSERTING into TDA
Insert into TDA (PKNODAVE,DTCREATION,DAVETRANSFERT,PKPARC) values ('1',to_date('05-JAN-10','DD-MON-RR'),'1',10);
Insert into TDA (PKNODAVE,DTCREATION,DAVETRANSFERT,PKPARC) values ('2',to_date('05-JAN-10','DD-MON-RR'),'2',10);
Insert into TDA (PKNODAVE,DTCREATION,DAVETRANSFERT,PKPARC) values ('3',to_date('05-JAN-10','DD-MON-RR'),'3',10);
Insert into TDA (PKNODAVE,DTCREATION,DAVETRANSFERT,PKPARC) values ('4',to_date('05-JAN-10','DD-MON-RR'),null,10);
Insert into TDA (PKNODAVE,DTCREATION,DAVETRANSFERT,PKPARC) values ('5',to_date('05-JAN-10','DD-MON-RR'),'4',14);
Insert into TDA (PKNODAVE,DTCREATION,DAVETRANSFERT,PKPARC) values ('6',to_date('05-JAN-10','DD-MON-RR'),'5',15);
DELETE FROM TDA WHERE davetransfert IN ( SELECT PKNODAVE FROM TDA WHERE PKPARC='10')
ERROR: FK_TDA1 CHILD RECORD FOUND...
Pls give me the suggestions to solve this
SYou could try with a recursive procedure like this
Processing ...
select *
from TDA
Query finished, retrieving results...
PKNODAVE DTCREATION DAVETRANSFERT PKPARC
1 05/01/10 1 10
2 05/01/10 2 10
3 05/01/10 3 10
4 05/01/10 10
5 05/01/10 4 14
6 05/01/10 5 15
6 row(s) retrieved
Processing ...
declare
cursor c is
SELECT PKNODAVE FROM TDA WHERE PKPARC='10';
procedure tda_cascade_delete(
del_PKNODAVE in varchar2
as
cursor sons is
select PKNODAVE
from TDA
where DAVETRANSFERT = del_PKNODAVE
and PKNODAVE <> DAVETRANSFERT;
begin
for x in sons loop
tda_cascade_delete(x.PKNODAVE);
end loop;
delete TDA
where PKNODAVE = del_PKNODAVE;
end;
begin
for x in c loop
tda_cascade_delete(x.PKNODAVE);
end loop;
end;
Processing ...
select *
from TDA
Query finished, retrieving results...
PKNODAVE DTCREATION DAVETRANSFERT PKPARC
0 row(s) retrievedPS. A connect by subquery of the type
delete tab
where pk in (
select fk
from tab
start with <my condition>
connect by fk = prior pk
) or <my condition>l;wouldn't generally work because it could try to delete a record before its children.
Bye Alessandro -
Problem in Master-Details - Inserting Records to same Table
I have 3 column of one table in master as primary key and 3 column of same table in detail as primay key. These 6 column collection as the composite primary key. when i try to insert the records in detail table it showing me Too many objects match the primary key oracle.jbo.Key Error.
I have done the Following things:
In HR Schema, I have created one Transient View Object for Master and Employee View Object for Details.
I have taken EmployeeId, FirstName and LastName columns in the Master i.e., From Transient View Object and droped it as the Form.
And I have taken E-mail, JobId, ManagerId columns in Details i.e From and droped it as the Table.
When I entered values in master and click CreateInsert in the details record. It showing me Too many objects match the primary key errors.
Help me out!!! for this problem.Hi Kumar,
I was not in office for couple of days. Thats you couldnt reply for your earlier post. You had mentioned how can we set the value of the import parameter.
What i wanted to tell you is not to set the value for that Binary_flag, but that flag influences the data download in ASCII FORMAT.
You just try this: Try attaching a file through CL_CRM_DOCUMENTS~CREATE_WITH_TABLE. Before read the contents of a file into SAP using GUI_DOWNLOAD and read it in ASCII mode. Now when you try to pass this to Ascii internal table of the method specifing the MIME type, it will attach the document to the opportunity, but the document content will be still in ASCII.
If you try to download this file using GET_WITH_TABLE, then you can see BINARY_FILE is not set to 'X' and the content gets downloaded to Ascii internal table.
This is my observation.
I think when attaching documents in Opportunities by default, it reads the file in Binary mode. Because when i tried to attach a file directly in Opportunity transaction, and tried the method GET_WITH_TABLE, the BINARY_FLAG was set.
Hope now you understood, why i was mentioning that BINARY_FLAG influences the download of content in binary and Ascii format.
Regards,
karthik. -
Mix overview and detail records in same report
Hello, in substance I need to mix results from overview table and records from details table in same report.
For creating the scenario:
CREATE TABLE ALPHA
ALPHA_ID NUMBER,
ALPHA_NR NUMBER,
ALPHA_TOTCT NUMBER,
ALPHA_FUND NUMBER
ALTER TABLE ALPHA ADD (
CONSTRAINT ALPHA_PK PRIMARY KEY (ALPHA_ID));
ALTER TABLE ALPHA ADD (
CONSTRAINT ALPHA_NR_UNI UNIQUE (ALPHA_NR));
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 1, 7 );
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 2, 11 );
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 3, 15 );
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 4, 17 );
CREATE TABLE HIST
HIST_ID NUMBER,
HIST_NR NUMBER,
HIST_ALPHA_NR NUMBER,
HIST_CT NUMBER,
HIST_VAL NUMBER,
HIST_DATE DATE
ALTER TABLE HIST ADD (
CONSTRAINT HIST_PK PRIMARY KEY (HIST_ID));
ALTER TABLE HIST ADD (
CONSTRAINT HIST_NR_UNI UNIQUE (HIST_NR));
ALTER TABLE HIST ADD (
CONSTRAINT HIST_ALPHA_NR_FK FOREIGN KEY (HIST_ALPHA_NR) REFERENCES ALPHA ( ALPHA_NR ) );
TRUNCATE TABLE HIST;
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 1 ,1 ,7 ,1 ,10 , TO_DATE('01.02.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 2 ,6 ,7 ,1 ,10 , TO_DATE('01.05.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 3 ,3 ,7 ,3 ,30 , TO_DATE('01.02.2010' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 4 ,4 ,11 ,1 ,10 , TO_DATE('01.03.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 5 ,5 ,11 ,-2 ,-20 , TO_DATE('01.06.2010' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 6 ,8 ,11 ,1 ,10 , TO_DATE('01.02.2011' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 7 ,2 ,15 ,2 ,20 , TO_DATE('01.03.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 8 ,7 ,15 ,5 ,50 , TO_DATE('01.06.2010' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 9 ,9 ,15 ,-4 ,-40 , TO_DATE('01.02.2011' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 10 ,10 ,17 ,1 ,10 , TO_DATE('01.03.2011' , 'dd.mm.yyyy' ) );For updating the overview table, I used a view
CREATE OR REPLACE VIEW HIST_AGG ( HIST_ALPHA_NR, TOT_CT , TOT_VAL )
AS
SELECT HIST_ALPHA_NR
,SUM ( NVL(HIST_CT, 0 ) ) TOT_CT
,SUM( NVL(HIST_VAL, 0) ) TOT_VAL
FROM HIST
GROUP BY HIST_ALPHA_NR;
DECLARE
CURSOR cur
IS
SELECT
HIST_ALPHA_NR
,TOT_CT
,TOT_VAL
FROM HIST_AGG
BEGIN
FOR rec IN cur
LOOP
UPDATE ALPHA
SET ALPHA_TOTCT = rec.TOT_CT
, ALPHA_FUND = rec.TOT_VAL
WHERE ALPHA_NR = rec.HIST_ALPHA_NR;
END LOOP;
END;First report should the overview line from table alpha followed by all detail records from
table HIST, and this for each alpha_nr. At the end of the report a total from the overview
table alpha.
"SUMMARY";"ALPHA_NR";"ALPHA_TOTCT";"ALPHA_FUND";
;7;5;50;
;7;1;10;01.02.2009
;7;1;10;01.05.2009
;7;3;30;
;11;0;0;
;11;1;10;01.03.2009
;11;-2;-20;01.06.2010
;11;1;10;01.02.2011
;15;3;30;
;15;2;20;01.03.2009
;15;5;50;01.06.2010
;15;-4;-40;01.02.2011
;17;1;10;
;17;1;10;01.03.2011
"TOTAL_ALPHA_NR";4;9;90;Second report should display the overview per time period (year), but the records from
e.g. year 2009 start counting in year 2010. At the end of each year again a summary for
the actual status.
"YEAR";"ALPHA_NR";"ALPHA_TOTCT";"ALPHA_FUND"
2009;7;0;0
;11;0;0
;15;0;0
;17;0;0
"Total 2009";4;0;0
2010;7;2;20
;11;1;10
;15;2;20
;17;0;0
"Total 2010";4;5;50
2011;7;5;50
;11;-1;-10
;15;7;70
;17;0;0
"Total 2011";4;11;110
2012;7;5;50
;11;0;0
;15;3;30
;17;1;10
"Total 2012";4;9;90Hi,
This is quite a different problem from what you first posted.
wucis wrote:
This is what I want to get
ALPHA_DATE ALPHA_NAME ALPHA_NR ALPHA_TOTCT ALPHA_FUND TRANS_DATE
01.01.2009 seven 7 5 50
7 1 10 01.02.2009
7 1 10 01.05.2009
7 3 30 01.02.2010
01.03.2009 eleven 11 0 0
11 1 10 01.03.2009
11 -2 -20 01.06.2010
11 1 10 01.02.2011
03.05.2010 twelve 12 0 0
02.02.2009 fifteen 15 3 30
15 2 20 01.03.2009
15 5 50 01.06.2010
15 -4 -40 01.02.2011
10.10.2010 seventeen 17 1 10
17 1 10 01.03.2011
TOTAL_ALPHA_NR 5 9 90
Do you really want to include alphr_nr=12? If so, what do you mean when you say
I have an approach but there are "unnecessary" rows ( the line with just alpha_nr = 12 ) and why don't you want alpha_nr=13?
so my join is buggyExactly! The join
... from hist, alpha b
WHERE b.alpha_nr = hist.hist_alpha_nr (+) ...means "include all rows from alpha, whether of not they have any corresponding rows in hist or not". If you want to exclude alpha_nrs 12 and 13, you probably want to do an inner join there.
You don't need any sub-queries to do that:
SELECT CASE
WHEN GROUPING (h.hist_alpha_nr) = 0
AND GROUPING (h.hist_date) = 1
THEN MAX (a.alpha_date)
END AS alpha_date
, CASE
WHEN GROUPING (h.hist_alpha_nr) = 1
THEN 'TOTAL_ALPHA_NR'
WHEN GROUPING (h.hist_date) = 1
THEN MAX (a.alpha_name)
END AS alpha_name
, CASE
WHEN GROUPING (h.hist_alpha_nr) = 0
THEN h.hist_alpha_nr
ELSE COUNT (DISTINCT (alpha_nr))
END AS alpha_nr
, SUM (h.hist_ct) AS alpha_totct
, SUM (h.hist_val) AS alpha_fund
, h.hist_date AS trans_date
FROM hist h
, alpha a
WHERE h.hist_alpha_nr = a.alpha_nr
AND a.active = 'Y'
GROUP BY ROLLUP ( hist_alpha_nr
, hist_date
ORDER BY GROUPING (h.hist_alpha_nr)
, h.hist_alpha_nr
, GROUPING (h.hist_date) DESC
, h.hist_date
;Output:
ALPHA ALPHA ALPHA
ALPHA_DATE ALPHA_NAME _NR _TOTCT _FUND TRANS_DATE
01.01.2009 seven 7 5 50
7 1 10 01.02.2009
7 1 10 01.05.2009
7 3 30 01.02.2010
01.03.2009 eleven 11 0 0
11 1 10 01.03.2009
11 -2 -20 01.06.2010
11 1 10 01.02.2011
02.02.2009 fifteen 15 3 30
15 2 20 01.03.2009
15 5 50 01.06.2010
15 -4 -40 01.02.2011
10.10.2010 seventeen 17 1 10
17 1 10 01.03.2011
TOTAL_ALPHA_NR 4 9 90If this is not what you want (e.g., if you want alpha_nr=12 in the results) then point out where these results are wrong, post the correct results, and explain how you get the correct results in those places. -
BC4J - Inserting Master/Detail records in same transaction.
I know this is possible, but I seem to be missing something to allow it to happen within BC4J.
I'm creating a RowSet off of a View Object and inserting new Rows into this RowSet. This RowSet represents my child/detail records for insert into a child table.
I then create a new Row off of another View Object. This row represents my Master/parent record for insert into a parent table.
All of the above is being done in the same applicationModule transaction with locking mode set to Optimistic.
Before I commit the transaction, I grab the next sequence # to use as the primary key for the master record and the foreign key for the child records. I apply those to the newly created child rows and the newly created master row.
However, when I commit I continue to get a JBO-26041: Failed to post data to database during "Insert": error due to ORA-02291: integrity constraint (CUST_LICENSES_FK4) violated - parent key not found
If everything was created in the same transaction, why won't this allow me to insert into both tables with the correct primary/foreign keys? It's almost as if the child records are being inserted first prior to the parent record.
Any ideas?
Thanks in advance..
Teri Kemple
TUSC
[email protected]However, when I commit I continue to get a JBO-26041: Failed to post data to database during "Insert": error due to ORA-02291: integrity constraint (CUST_LICENSES_FK4) violated - parent key not found
If everything was created in the same transaction, why won't this allow me to insert into both tables with the correct primary/foreign keys? It's almost as if the child records are being inserted first prior to the parent record.This is due to the order of rows being posted. In this case it seems the detail row is getting posted before the master.
To avoid such situations, either you may implement your own post ordering by making sure that when a detail is to
be inserted, it's master is inserted or you may use "Composition Association" flag in the association wizard between
the master and the detail entities to let the framework manage a tight composition relationship between the two entity
types. BTW, there was another definitive thread recently on inserting master-detail in the
same transaction, but the forum search engine is so useless I can't find it. Anyone
have the msgid handy or know how to find that thread again??
FYI: the help describes the Composition flag functionality in terms of the Master record already existing in the DB. In our problem here, the Master is being inserted in the same transaction. Thus needs to be posted FIRST.
I got a integrity constraint exception too, then set the composition flag and now I get:
500 Internal Server Error
oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity.
void oracle.jbo.server.EntityImpl.create(oracle.jbo.AttributeList)
void gov.ga.gdc.otf.bc.JotfWithdrawalsImpl.create(oracle.jbo.AttributeList)
void oracle.jbo.server.ViewRowStorage.create(oracle.jbo.AttributeList)
void oracle.jbo.server.ViewRowImpl.create(oracle.jbo.AttributeList)
oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewObjectImpl.createInstance(oracle.jbo.server.ViewRowSetImpl, oracle.jbo.AttributeList)
oracle.jbo.server.RowImpl oracle.jbo.server.QueryCollection.createRowWithEntities(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.server.ViewRowSetImpl, oracle.jbo.AttributeList)
oracle.jbo.Row oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.AttributeList)
oracle.jbo.Row oracle.jbo.server.ViewRowSetImpl.createRow()
oracle.jbo.Row oracle.jbo.server.ViewObjectImpl.createRow()
void gov.ga.gdc.otf.appmodule.JOtfOffenderAppModuleImpl.insertWithdrawal(java.lang.String, java.lang.String, java.math.BigDecimal, oracle.jbo.domain.Number, java.lang.Integer, int)
void gov.ga.gdc.otf.appmodule.JOtfOffenderAppModuleImpl.payOneObligation(java.lang.String, java.lang.String, java.lang.Integer, oracle.jbo.domain.Number, java.math.BigDecimal, int)
void gov.ga.gdc.otf.appmodule.JOtfOffenderAppModuleImpl.payObligations(java.lang.String, java.lang.String, java.math.BigDecimal, oracle.jbo.domain.Number)
void gov.ga.gdc.otf.appmodule.JOtfOffenderAppModuleImpl.receiveFunds(java.lang.String, java.lang.String, int, java.math.BigDecimal, java.lang.String, java.lang.String, java.lang.String, java.math.BigDecimal, long)TIA much! curt -
Parent/child records from same table
I want to create a query that is a union such that the 2nd resultset is based on the 1st resultset. I have a table that has parent/child records in the same table.
Table: EVENTS
EVENT_ID
PARENT_EVENT_ID
CREATED_DATE
(other columns)
if PARENT_EVENT_ID is null then it is a parent record, else it is a child record. I want to select all parent records then union them with all the associated child records...something like this:
select * from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null -- All parents
union
select * from EVENTS where PARENT_EVENT_ID in (select EVENT_ID from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null) -- include any children of parents selected from above
This works but it's kind of ugly, I want to avoid using the sub-select in the 2nd because it is a repeat of the 1st statement, is there a way to alias the first statement and just refer to it in the 2nd query?Hi,
kev374 wrote:
Thanks, one question...
I did a test and it seems the child rows have to also satisfy the parent row's where clause, take this example:
EVENT_ID|PARENT_EVENT_ID|CREATED_DATE
2438 | (null) | April 9 2013
2439 | 2438 | April 11 2013
2440 | 2438 | April 11 2013
select * from EVENTS where CREATED_DATE < sysdate - 9
start with EVENT_ID = 2438
connect by PARENT_EVENT_ID = prior EVENT_IDSo you've changed the condition about only wanting roots and their children, and now you want descendants at all levels.
This pulls in record #2438 (per the sysdate - 9 condition) but 2439 and 2440 are not connected. Is there a way to supress the where clause evaluation for the child records? I just want to pull ALL child records associated with the parent and only want to do the date check on the parent.Since the roots (the only rows you want to exclude) have LEVEL=1, you can get the results you requested like this:
WHERE created_date < SYSDATE - 9
OR LEVEL > 1However, since you're not ruling out the grandchildren and great-grandchildren any more, why wouldn't you just say:
SELECT *
FROM events
WHERE created_date < SYSDATE - 9
OR parent_event_id IS NOT NULL;?
CONNECT BY is slow. Don't use it if you don't need it.
If you x-reference my original query:
select * from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null -- All parents
union
select * from EVENTS where PARENT_EVENT_ID in (select EVENT_ID from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null) -- include any children of parents selected from above
The 2nd select does not apply the created_date < sysdate - 90 on the children but rather pulls in all related children :)Sorry; my mistake. That's what happens when you don't post sample data, and desired results; people can't test their solutions and find mistakes like that. -
How to apply data into 2 tables AND to more than one record in same table?
Hello,
I am trying to apply/insert data into 2 tables AND at the same time apply data to more than one record (in the same table). How would I do this in APEX?
I have updated using one table with no problem, however, when I try updating with the two tables/ multiple record sets, I get errors.
I appreciate the help.
Thanks.
LindaYou can achieve what you want using PL/SQL. Can you post ur code?
-
Inserting Record In same table through triggers.
Hi,
I've a table cus_mst ( cus_div_cd vachar2(1), cus_cd varchar2(5), cus_nm varchar2(100) )
Records are inserted in this table through forms ...
We need to automatically insert a record with a diff div_cd for any record inserted in the table .
If div_cd 'I' is entered automatically a record with div cd 'S' with other coulmns having same values should get inserted .
In case div_cd is 'S' then record with div_cd 'I' should get created.
Eg : If in insert ( 'S', 'A0001', 'ABC COmpany' ); another record with values ( 'I', 'A0001', 'ABC Comapny' ) gets created;
One way to do is to insert records in a view ( on the table ) and use instead of trigger to insert the corresponding record. But that is not possible as development team has to change form and use view instead of table.
Have tried doing it by populating a collection in-each-row trigger and then using statment level trigger to insert from the collection. But this leads to recursive error.
Would be great to get more insights into this..
thanks
cheers
JaaniHi,
Within the following script you need to make adjustments according to your needs about the columns you need to test. But this might help you.
Sorry for the layout. But I was not able to adjust it in a short time.
drop table ad_test
create table ad_test ( col1 varchar2(1), col2 varchar2(5), col3 varchar2(100) )
create or replace package ad_test_pkg is
procedure initialize_postpone ;
procedure postpone_record( r_atst in ad_test%rowtype ) ;
procedure handle_postponed_records ;
end ad_test_pkg ;
create or replace package body ad_test_pkg is
type type_atst is table of ad_test%rowtype index by binary_integer ;
t_atst type_atst ;
procedure initialize_postpone is
begin
t_atst.delete ;
end initialize_postpone ;
procedure postpone_record( r_atst in ad_test%rowtype ) is
begin
t_atst(t_atst.count) := r_atst ;
end postpone_record ;
procedure handle_postponed_records is
cursor c_test( cpiv_col1 in ad_test.col1%type ) is
select 'x'
from ad_test
where col1 = cpiv_col1
r_test c_test%rowtype ;
r_atst ad_test%rowtype ;
begin
for i in t_atst.first .. t_atst.last
loop
r_atst := t_atst(i) ;
if r_atst.col1 = 'I'
then
r_atst.col1 := 'S' ;
else
r_atst.col1 := 'I' ;
end if ;
open c_test( cpiv_col1 => r_atst.col1 ) ;
fetch c_test into r_test ;
if c_test%found
then
close c_test ;
else
close c_test ;
insert into ad_test
( col1
, col2
, col3
) values
( 'S'
, r_atst.col2
, r_atst.col3
end if ;
end loop ;
end handle_postponed_records ;
end ad_test_pkg ;
create or replace trigger test_ad_bis
before insert on ad_test
begin
ad_test_pkg.initialize_postpone ;
end ;
create or replace trigger test_ad_air
after insert on ad_test for each row
declare
r_atst ad_test%rowtype ;
begin
r_atst.col1 := :new.col1 ;
r_atst.col2 := :new.col2 ;
r_atst.col3 := :new.col3 ;
ad_test_pkg.postpone_record( r_atst => r_atst ) ;
end ;
create or replace trigger test_ad_ais
after insert on ad_test
begin
ad_test_pkg.handle_postponed_records ;
end ;
insert into ad_test values ( 'I', 'A0001', 'ABC COmpany') ;
select * from ad_test ;
Greets,
Ad
Edited by: loaddev on 10-nov-2010 4:47 -
Create a Master-Detail Records in target table
hi,
I have a source in a table that contains the infos of customers and for each customer record, we have three fields representing the customer ID
(Identity card, SIN, passport ID) and I want to create 3 record in the target table for each customer, each record contains information for each ID
How can we do with OWB?
thanks.hello
i belive you need to use pivot operator
check out this blog
https://blogs.oracle.com/warehousebuilder/entry/pivoting_data_in_owb
rgds -
Ruleframe + Updates in same table on different records
I have following problem :
Change event with DML for one column in one record have to result in an update of different records in same table
if business rule is validated, I get a problem in the cg$AUS trigger, No data found.
In the business rule (on after row triggering level), I call a procedure, which do the updates on the same table.
What do I do wrong. Do I have to start a new transaction for this ?
I hope someone can help me.
Regards
Jo-anJo-an,
You definitely don't have to start a new transaction, you should just use the tapi upd procedure to perform the update, as described in the Headstart User's Guide.
Could you try again and report back if you still have the problem?
kind regards,
Sandra -
Delete master record if detail records are empty
I have a simple question and response system
the user enters their details (record stored in table called source - pkey as id_src)
the user then goes on to answer questions (in a form)
those responses are kept in a separate table (responses)
with a foreign key in each response row telling me the ID of the source ie fk_id_src
the form has a SUBMIT and CANCEL button
PROBLEM
If a user registers their details (created a source record with an ID)
but fails to answer and questions (the response table does not have any foreign keys to that ID source)
what is the best way to AUTOMATICALLY delete the user record (if there are no detail records in the response table)
(note: the main response form IS NOT an ADDT form)
the checking process needs to be triggered by the CANCEL button
ie if the user presses submit - responses will be made to the questions - ie they will be empy answers - but in this case it is valid to do so
I was wondering about a custom transaction - with delete SQL -
or using check detail records - but cant see how to get that to fire the delete record transaction?
any guidance appreciated
tia
PaulOK
I can create a separate page that checks if a detail record exists
and display an error if it does
on the same page I can add a delete transaction
pass the master record id
Both work, all OK so far
BUT, the check detail throws its error message if detail records DOES EXIST
I need to allow the delete transaction to run, if detail records DO NOT EXIST
AND then
redirect then page - wether the delete occurs or not
any ideas?
Paul -
URGENT Select Query Returning No Records take same time as that of insert
Hello Everrybody,
I am facing a wierd problem...
I have table with 15 fields and I am selecting a record with some condition...
for e.g
select field1,field2,field3....... from tablea where field1=123
Now I have index on field1
When I do SQL Trace it show me time taken as
00:00:00:60 in oracle 817 SQL PLUS
and using
oracle 92 sql plus it show as
00:00:00:01 in oracle 817 SQL PLUS
Now Query is what does this 60 denotes milliseconds or what in oracle 92 and in oracle 817 sql plus.....
Also this query does not return any rows...
When I run the SP that insert records in same table...That sp take about same time as that of select returning no rows......
Why is ORACLE Taking so much time for that select ????
Please help.....8i measures timings in 100th of a second but I believe that 9i measures stuff in 1000th of a second. However, from your output it looks like SQL*Plus trace is rounding up to the nearest centisecond.
Time is a very poor way of judging performance when you're talking less than a second per operation. You'd be better off looking at CPU usage and IO activity.
Anyway, here are some questions for you to research:
(1) Is field1 a unique index?
(2) How many rows does this table hold?
(3) How fresh are the statistics on the table and the index?
(4) What's the explain plan? What's the TKPROF output?
(5) Are all of the above the same on both databases?
Cheers, APC -
Trying to edit newly inserted detail record
Hello,
I'm using Jdev 3.2. I have a JSP which successfully submits the insertion of a new master (job) record, and then successfully inserts a detail (jrefs) record using a view link.
I then want to go to a new JSP and edit the newly inserted detail record. The way my pages are at the moment, I always get the first detail record in the table, but I need to access the newly inserted one. I've messed around a bit with trying to pass the ROWKEY or retrieve the primary key from the master - but I'm just not getting it. Please can someone tell me how to set the current record to be the new detail record when I use EditCurrentRecord with the detail record view in the second JSP.
Here's some code from the first JSP, which successfully inserts the master and detail records:
<jsp:useBean id="RowEditor" class="oracle.jbo.html.databeans.EditCurrentRecord" scope="request">
<%
RowEditor.initialize(application, session , request, response, out, "JtrackJSPSPRJjpr_jtrackpkg_JtrackpkgModule.JtjobsView1");
RowEditor.execute();
%>
</jsp:useBean>
<html>
<head>
<%
// this is submitting the master row
Row row = RowEditor.getRowSet().getCurrentRow();
String wprov = (String) session.getAttribute("WPROV");
row.setAttribute("WpCode",wprov);
String sprov = (String) row.getAttribute("SpCode");
// the incremental part of the job number is temporarily
// stored in task_status by the business components
String jobcode = wprov + sprov + row.getAttribute("TaskStatus");
row.setAttribute("JobCode",jobcode);
// get the view link to Jtjrefs and create a linked record
ApplicationModule appModule = RowEditor.getRowSet().getApplicationModule();
ViewLink vl = appModule.findViewLink("JobJrefViewLink");
ViewObject voMaster = vl.getSource();
ViewObject voDetail = vl.getDestination();
Row newRow = voDetail.createRow();
voDetail.insertRow(newRow);
RowEditor.getRowSet().getApplicationModule().getTransaction().commit();
%>
<META HTTP-EQUIV="refresh" CONTENT="1; URL=JobRefAdd.jsp">
</head>
<body>
Here is the code from the second JSP which needs to edit the new row (newRow)
<jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
<%
rsn.setReleaseApplicationResources(false);
rsn.initialize(pageContext,"JtrackJSPSPRJjpr_jtrackpkg_JtrackpkgModule.JtjrefsView");
rsn.render();
%>
</jsp:useBean>
<jsp:useBean id="RowEditor" class="oracle.jbo.html.databeans.EditCurrentRecord" scope="request">
<%
RowEditor.initialize(application, session , request, response, out, "JtrackJSPSPRJjpr_jtrackpkg_JtrackpkgModule.JtjrefsView");
Row row = RowEditor.getRowSet().getCurrentRow();
RowEditor.setUseRoundedCorners(true);
RowEditor.setTargetUrl("JobRefSubmit.jsp");
RowEditor.setDisplayAttributes("Ref1,Ref2");
RowEditor.getFieldRenderer("Ref1").setPromptText("Job Ref 1");
RowEditor.getFieldRenderer("Ref2").setPromptText("Job Ref 2");
RowEditor.setReleaseApplicationResources(true);
RowEditor.render();
%>
</jsp:useBean>
</body>
</html>
Any assistance would be gratefully received...if you want to see the info that is on the track then look to the top right of the window and there is a button you can drag up and down and it closes or expandes the information so you can see if it is recording in stereo or not.
It looks like a marker pointing to the left with lines running parellel.
-Frisco -
Master and Detail records in the same table
Hi Steve,
I have master and detail address records in the same table (self-reference). The master addresses are used as templates for detail addresses. Master addresses do not have any masters. Detail addresses have three masters: a master address, a calendar reference and a department. Addresses change from time to time and every department has its own email-account, but they refer to the same master to pre-fill some common values.
Now I need to edit the master and detail address records on the same web page simultaneously.
My question is: Can I implement a Master-View and Detail-View which refer to the same Entity-Object? Or should I implement a second Entity-Object? Or can it be done in a single Master-Detail-View?
Thanks a lot.
Kai.At a high level, wouldn't this be similar to an Emp entity based on the familiar EMP table that has an association from Emp to itself for the Emp.Mgr attribute?
You can definitely build a view object that references two entity usages of the same entity like this to show, say, an employee's ENAME and at the same time their manager's ENAME.
If there are multiple details for a given master, you can also do that with separate VO's both based on the same entity, sure. Again, just like a VO that shows a manager, and a view-linked VO of all the employees that report to him/her. -
Inserting multiple records in a table through detail block
hi,
i am new to oracle forms. i want to enter more than one records in a table through a master detail forms.
the records will be entered by user in the detail section. can any ody help me?Hi Lance,
Try creating records in detail block in the when new block instance trigger of
detail block. Set the validation unit property of the form to FORM before trying this.
Hope this might be helpful to you.
V.Senthil Kumar
Maybe you are looking for
-
Remote session via RDGW fine with Windows - not possible with Mac ...?
Hi, I've configured a fresh single RDS Server (all roles on one Server including Gateway) based on Windows Server 2012 R2. Everything works fine when we use Windows 7 with current RDP Client to connect via Gateway/HTTPS. When we use a Mac (OS X 10.9.
-
Request for little enhancement in APEX 3.0
At definition page it would be nice to see if a region is conditional or not. Thanks
-
Xalan libraries in 1.4.2
Why in gods name is the xalan library included in the rt.jar. I can understand that you want to distribute xml parsing and transformation functionality along with your jdk, but why has it to be in the boots path? Was it not possible to put it in the
-
I can't download pdfs on my mac using Adobe Reader XI
I use Mac OS X (version 10.6.8) and have downloaded Adobe Reader XI (11.0). I now can't download any pdfs. Please could someone give any advice?
-
Hi, I am trying to merge different crystal reports into one and email out the merged pdf document to user from BOBJ Enterprise XI3.1. I created a publication and added different crystal reports, configured step by step as per the admin document and s