Oracle Streams setup for multiple schemas in a same database

We are on 11.1.0.7 and will be using Oracle 11g Streams that will replicate the data real-time for two schemas between the source and target set of schemas with in the same database. We will be doing DDL as well as DML replication.
I created the following plan and want your inputs. After implementing this, I created a table in SCOTT but it's get replicated to RPT_SCOTT later I tried inserting a row in the table created under SCOTT but that too didn't get replicated to RPT_SCOTT.
Here are the steps that I used to set up my STREAMS -
Database Instance:     TESTDB
Schemas:
     Source:          SCOTT
               HR
     Target:          RPT_SCOTT
               RPT_HR
Configuring Streams:
1.     Database is in Archive log mode
2.     Set up the Streams administrator.
create user STRMADMIN identified by STRMADMIN default tablespace USERS temporary tablespace temp;
grant resource, dba, AQ_ADMINISTRATOR_ROLE to STRMADMIN;
BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => 'STRMADMIN',
grant_privileges => TRUE);
END;
3.     Set up Streams queues
CONNECT STRMADMIN/****
BEGIN
DBMS_STREAMS_ADM.SET_UP_QUEUE(
queue_name => 'STREAMS_QUEUE',
queue_table => 'STREAMS_QUETAB',
queue_user => 'STRMADMIN');
END;
4.     Add the Apply rule
BEGIN
DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
schema_name      => 'RPT_SCOTT',
streams_type     => 'APPLY',
streams_name     => 'APPLY_CC_STREAM',
queue_name          => 'STRMADMIN.STREAMS_QUEUE',
include_dml     => true,
include_ddl     => true,
inclusion_rule     => true,
source_database     => 'TESTDB');
END;
BEGIN
DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
schema_name      => 'RPT_HR',
streams_type     => 'APPLY',
streams_name     => 'APPLY_AB_STREAM',
queue_name          => 'STRMADMIN.STREAMS_QUEUE',
include_dml     => true,
include_ddl     => true,
inclusion_rule     => true,
source_database     => 'TESTDB');
END;
BEGIN
DBMS_APPLY_ADM.ALTER_APPLY(
apply_name     => 'APPLY_CC_STREAM',
apply_user     => 'STRMADMIN');
END;
BEGIN
DBMS_APPLY_ADM.ALTER_APPLY(
apply_name     => 'APPLY_AB_STREAM',
apply_user     => 'STRMADMIN');
END;
5.     Add the Capture Rule
CONNECT STRMADMIN/*****
BEGIN
DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
schema_name     => 'SCOTT',
streams_type     => 'CAPTURE',
streams_name     => 'CAPTURE_CC_STREAM',
queue_name          => 'STRMADMIN.STREAMS_QUEUE',
include_dml     => true,
include_ddl     => true,
inclusion_rule     => true,
source_database     => 'TESTDB');
END;
BEGIN
DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
schema_name     => 'HR',
streams_type     => 'CAPTURE',
streams_name     => 'CAPTURE_AB_STREAM',
queue_name          => 'STRMADMIN.STREAMS_QUEUE',
include_dml     => true,
include_ddl     => true,
inclusion_rule     => true,
source_database     => 'TESTDB');
END;
6.     Set the instantiation system change number (SCN)
CONNECT STRMADMIN/******
DECLARE
source_scn NUMBER;
BEGIN
source_scn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN (
source_schema_name => 'SCOTT',
source_database_name => 'TESTDB',
instantiation_scn => source_scn);
END;
7.     Start the Apply
CONNECT STRMADMIN/******
BEGIN
DBMS_APPLY_ADM.START_APPLY('APPLY_CC_STREAM');
END;
BEGIN
DBMS_APPLY_ADM.START_APPLY('APPLY_AB_STREAM');
END;
8.     Start the Capture
CONNECT STRMADMIN/******
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE('CAPTURE_CC_STREAM');
END;
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE('CAPTURE_AB_STREAM');
END;
Waiting for your inputs!

If I understand from your code, you want to do this on the same DB :
SCOTT --> RPT_SCOTT
HR  --> RPT_HRSo there is a schema transformation, where is it coded ?
General info : http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_transform.htm
More specific on schema rename : http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_mtransform.htm#CHDGDHDE
Next : where are the initialisation of both capture schema ?
Missing :
execute DBMS_CAPTURE_ADM.PREPARE_SCHEMA_INSTANTIATION( schema_name          => 'scott'');
execute DBMS_CAPTURE_ADM.PREPARE_SCHEMA_INSTANTIATION( schema_name          => 'HR'');This tell Streams from where to capture the SCN.
Also there is an (WRONG) instantiation of SCOTT for the apply, which tells the apply to consider as valuable candidate all LCR after source_scn,
but where is the code or RPT_HR. Alas, you put for the APPLY target schema 'SCOTT' while it should have been 'RPT_SCOTT'.
the fact that is correct or false depends where you put the schema transformation. If you put the transformation at apply time then use the SOURCE schema name (SCOTT, HR) for the LCR will contains their name. If you put the transformation at capture time, then put target schema name for the LCR will contain their name (RPT_HR,RPT_SCOTT).
Let's say you put the schema transformation at capture time then
Missing:
DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN (
source_schema_name => 'RPT_HR',
source_database_name => 'TESTDB',
instantiation_scn => source_scn);If you attache the transformation on the apply process then the code is :
DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN (
source_schema_name => 'HR',
source_database_name => 'TESTDB',
instantiation_scn => source_scn);And this is useless:
-- useless code
BEGIN
DBMS_APPLY_ADM.ALTER_APPLY(
apply_name => 'APPLY_CC_STREAM',
apply_user => 'STRMADMIN');
END;
BEGIN
DBMS_APPLY_ADM.ALTER_APPLY(
apply_name => 'APPLY_AB_STREAM',
apply_user => 'STRMADMIN');
END;
/Last : You are using the same queue for 2 separated capture/apply transformation.
Do yourself a favor and give each couple capture/tranform/apply its own queue.

Similar Messages

  • Can I run the currency translation for multiple years at the same time?

    Dear Friends,
    I set up currency translation on our BPC NW 7.0 system and it is working fine ONLY if I run it for any one year at a time. But if I select multiple years in the data package (FX Restatment) selection it only calculates for the first year in that selection.
    say if I run the data package for years: 2009, 2010, 2011, 2012, it only performs currency translation for the year 2009.
    Can I run the currency translation for multiple years at the same time ?
    Note: The year is determined from the YEAR property of the "Time" dimension
    appreciate any inputs,
    thanks

    You can run currency translation for multiple years.
    I think the problem it is actually related to how you are sending the parameter to currency translation script.
    Just review the script logic log and you will see with what parameters was called currency translation FXTrans.
    My expectation is that actually the script is called just with first year and that's the problem.
    Log of script logic you can find it into:
    C:\BPC|DATA\Webfolder\YourAppset\YourApplication\Private Publications\Users used to run logic\Temp
    Regards
    Sorin Radulescu

  • Is it possible to search for multiple folders with the same name and...

    Is it possible to search for multiple folders with the same name and then select them all and change the permissions on just those folders .i.e. Search for the budget folders in all client folders and lock them down to just the project managers. Without having to go to each folder and apply the permissions.

    user11919409 wrote:
    Is it possible to create a Clone database with the same name of source db using RMAN ...
    yes
    >
    DB version is 11.2.0.2
    Is it possible to clone a 11.2.0.2 database to 11.2.0.3 home location directly on a new server . If it starts in a upgrade mode , it is ok ....yes
    Handle:     user11919409
    Status Level:     Newbie (10)
    Registered:     Dec 7, 2009
    Total Posts:     102
    Total Questions:     28 (22 unresolved)
    why do you waste time here when you rarely get any answers to your questions?

  • Export Limits for Multiple Sequences in the Same Sequence File for TS3.0

    Hi,
    I am using TestStand 3.0 to a test application. Because we want to have our limits in a csv-file I have tried to use the Import/Export tools in TS. But this application only supports to export limits for the selected sequence (e.g. main, or subseq1) at a time. This makes it a pretty hard job to export limits from 30 test sequences. What I need is a possibility to export my limits from �all sequences� in my seq-file.
    I have found an article on NI Dev. Zone about �Export Limits for Multiple Sequences in the Same Sequence File (TestStand 1.0.x)�.
    http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3D9CB56A4E034080020E74861&p_node=DZ52236&p_submitted=N&p_rank=&p_answer=&p_sourc
    e=External
    I have tried to use this code but because it�s for TS 1.0.2 the limits from my multi num test step and my custom steptypes isn�t exported. So that doesn�t fulfill my needs.
    Is there an updated version with �all sequences� added to TS 3.0? Is there other good solutions to my problem out there?
    Best Regards,
    Morten Pedersen
    CIM Industrial Systems A/S
    Denmark

    Hi David Mc,
    Thanks for your reply. I have already considered this solution because the source code is added in the folder described in your reply. But that is not a good solution. It will cost me a lot of time to establish the toolchain, reverse engineer the source code, make the implementations and build a new dll (most off these is already knowledge by NI). And when NI make future releases of TestStand I have some merge work to do every time NI have made some changes in the files I have changed.
    But as I write above: I have hoped that NI already has/or could made a solution like the one to 1.0.2 (see link in root) to me. And then they could include it in the next version.
    I don't think I am the only one in the TestStand world that ne
    ed this feature.
    Best regards,
    Morten Pedersen
    CIM Industrial Systems A/S
    Denmark

  • Single batch for multiple Valuation Type on same Plant

    Hi,
    Is it possible to have single batch for multiple valuation type on same Plant.
    Regards

    No you cannot have different valuation type for same batch of material for same plant.
    Regards
    Srinivas.P

  • Creating a database link to another schema in the same database

    Hello,
    I'm trying to create a database link to another schema in the same database. It was created without errors, but when I try to use it I receive "ORA-12154: TNS:could not resolve the connect identifier specified" message...
    I'm trying to do it because on my production enviroment the databases are separated, so there I can use database links without problem, but in my development environment it's all in one database separated by schemas...
    So I'm trying to simulate the same system to not need to rewrite the query every time I move from development to production environment.
    Any ideas?
    Thanks

    Hi,
    Yes, you can create a database link to your own database. I've done it before for exactly the same reason you want to.
    (By the way, I think it's a good reason. What are the alternatives?
    Having different versions of code for Development and Production? Absolutely not! Terrible idea!
    Using synonyms or substitution variables that are set differently in the different databases? That might be more efficient than a database link, but efficiency probably isn't such a big issue in Development.
    [Conditional compilation|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/fundamentals.htm#sthref250]? This might be good; it has all the efficienty of the above options, with more clarity.)
    Assuming you do want to stick with a database link, not all errors are caught when you create the link.
    Is the Development database in the tnsnames.ora file of the Development server? Do you have other database links, either in the Development server or pointing to it, that work? What is different about the ones that work, and the one that doesn't?
    Edited by: Frank Kulash on Oct 14, 2009 1:58 PM
    The more I think about this, the more I agree with the earlier respondent: synonymns are a good solution for this.
    To that suggestion you replied:
    On this way I might use "select * from SCHEMA.table" instead of "select * from table@SCHEMA"... I looking for an option to use the second way...Actually, the suggestion was that you say:
    select  *
    from    SCHEMA_table_ptr;where schema_table_ptr is a synonym.
    In Development, that synonym is defined as schema.table.
    In Production, that synonym is defined as table@SCHEMA
    Why are you "looking for an option to use the second way"?
    If you think that people reading the code should realize that the query is being done via a database link (at least in Production), then add a comment.

  • DBlink between two schema on the same database.

    Hello,
    I am facing a troublesome situation here regarding a database link. Usually I create my db links between two databases hosted on two different servers but in this current situation, am in short of machines. The database informations are contained in two different schema that were suppoded to be imported on two different databases(servers). As only one machine is available,I would like to know given the situation, whether I can create two schemas on the same database and link both schema using a database link. Is it possible? If yes, how do I achieve that?
    Thanks in advance.

    adomi wrote:
    Hello,
    I am facing a troublesome situation here regarding a database link. Usually I create my db links between two databases hosted on two different servers but in this current situation, am in short of machines. The database informations are contained in two different schema that were suppoded to be imported on two different databases(servers). As only one machine is available,I would like to know given the situation, whether I can create two schemas on the same database and link both schema using a database link. Is it possible? If yes, how do I achieve that?
    Thanks in advance.Cann't understand you. If you transfer data between two databases, then use database link. If you use only one database, then you don't need to use database link. Please elaborate more

  • What is icloud setup for Multiple users, multiple devices in family?

    What would be the recommended setup for iCloud to allow family members with multiple devices and multiple iTune accounts to share purchases, sync there own mail account, contacts, and reminders with multiple devices, and be able to sync calenders with all family calendars? Or better yet how can family members pick and choose what to sync with a common iCloud account?

    I'd like to know this to.
    We have 1 mac mini that serves as a media station that streams audio to Zeppelin air and photos & movies to our TV.
    My wife buys music on her iPhone. And takes pictures of the family.
    I buy apps and music on my iPad. And make movies of the family.
    I have a macbook pro ( itunes with home sharing,  iphoto home sharing ).
    She has a nice macbook (  itunes with home sharing, iphoto home sharing ).
    What we would want is that the mac mini collects all music / videos / media and streams it to all our apple devices via wifi ( not via internet ). But I with my appleID and she with her appleID.
    I wonder is Apple can make an GUInterface that I can understand to solve this.
    This iCloud seems not too suited.
    For families it would be easier if iOS5 would have 'home sharing' with upload and not transfer everything to CA first.

  • Dataguard setup for selected schemas

    Version:10.2, 11.2
    Platform : Solaris 5.10
    In our Production DB, we have some schemas which we do not want to be replicated at the standby site. Logical backup is enough for these schemas.
    Instead of replicating the entire database, Is there a way we could set up dataguard in which the logs are shipped only for selected schemas?

    With a Physical Standby Database , you always 'replicate' your whole Primary. With Logical Standby, though, you could exclude certain schemas from the 'replication'.
    Another option would be - as already mentioned by others - to do a regular replication with Streams or Golden Gate and only replicate the schemas resp. objects that you deem important.
    However, I would recommend that you review the requirement to exclude 'unimportant' schemas from your Standby Database. It makes the whole setup more complicated than necessary.
    Just go with Physical Standby and ignore those schemas - why bother?
    Kind regards
    Uwe Hesse
    http://uhesse.wordpress.com

  • Entry Channel setup for multiple company codes

    Hello,
    I have a question regarding the entry channel setup (for external requirements in the Plan-Driven Procurement scenario)
    In previous implementations, I 've created an entry channel below each company code (as the documentation says it should be). Now, for each entry channel, there was a EBP user assigned, which corresponded to an RFC entry in the backend system (I was connecting EBP to multiple backend systems)
    Now, what should I do in the following scenario?:
    1. SRM is only connected to one backend system
    2. There are 50 company codes
    Does that mean I have to create 50 users (for each channel) plus 50 RFC connections in the R/3 system (each with a different user in the backend system), pointing to the same SRM system?
    I was thinking of creating an Org iD in the SRM structure at the top (which would be the entry channel), assign only ONE user to it and then fill attribute BUK with all the company codes. However, I don't know if this will work, because the external requirement process might need the company code defined in the "Function" tab... =/
    Any help would be greatly appreciated.
    Regards,
    Gilberto.

    Hi Proyecto Genesis,
    I am also configuring the Entry channel (org unit) for multiple company codes.
    I tried your logic of defining the entry channel outside company code level. Assigned the BUK attribute and extended attribute for plants and storage locations.
    Also in my case the local Pur org and Pur group is defined outside the company code. Is it correct?
    However the system fails to transfer the external requisition to SRM.
    SLG1 displays following error message.
    "No address found for partner function type Ship-To Address"
    So if I move the Entry channel (org unit) under any one company code level then the external requisitions are transferred correctly to SRM.
    But then the issue is the requirements are not transferred with the backend Pur Org and Pur grp. Instead they are transferred to the Pur Org and Pur grp of the company code under which the entry channel is defined.
    Can you please share how do we need to define the entry channel, local pur org and pur grp for multiple company codes scenario, so that the ECC requisitions are transferred with the correct company code, pur org and pur grp to SRM?
    Or do we need to define Entry channel for each company code and RFC user actually mapping the same backend system?
    Please guide.
    Regards,
    Sandeep

  • Exchange setup for multiple domains

    We are planning to deploy Exchange server 2013, We have two companies and would like to create Email box for both the companies with same name.
    Example : [email protected], [email protected]
    We would like to have separte email boxes for the both companies. Please suggest us accordingly.

    That should be simple enough. Exchange can handle having multiple domains for sending / receiving and users can have multiple mailboxes configured in Outlook. The name field in Exchange doesn't need to be unique (the account name does obviously), so for
    instance there's no issue having "Fred Bloggs" <[email protected]> and "Fred Bloggs" <[email protected]> both setup.
    In a way the trickier part is setting it up in Outlook since different versions react differently. If you're using Outlook 2013 it should be quite straight forward. As you can see here
    http://technet.microsoft.com/en-us/library/ee815819.aspx the manual setup is easy enough for multiple exchange mailboxes, though auto mapping should work as well. If you're in a network AD
    environment (eg connecting using your local password), then realistically you'll want one mailbox to be primary which is associated to your network login, and then that login to have full access and send as permissions on the second mailbox.
    You may also need to deploy a reg key change to enable saving sent items from the second mailbox into that mailboxes sent items folder rather then the primary mailboxes (assuming you want to keep messages two and from both domains separate and in their own
    mailboxes). The reg key is listed here
    http://support.microsoft.com/kb/2843677 and is definitely needed in Outlook 2007 and 2010 but I'm not sure if it's still an issue if you're using Outlook 2013.

  • Oracle Query failing for multiple rows:

    Hey Guys,
    I have been given a task to produce an ad-hoc report based on the following conditions (I will give you the structure of the table and details in the table below the requirements)
    Requirements: Adhoc Report for Audit on CIT Income Allocation
    1. Select from the RETURNS table:
    • Id > 3600000 and
    • Prog_program_cd = '01' and
    • Return_status in ('ASSESSED', 'DU") and
    • Tax year ending in 2009 (i.e. year portion of the Period_end_date is in 2009)
    2. Retrieve the following fields from the RETURNS table :
    • Id
    • Entp_abn
    • Acct_id
    • Prog_program_cd
    • Period_start_date
    • Period_end_date
    • Amend_ind
    • Return_status
    • Status_date
    • Loctr_nbr
    3. If there are multiple entries from the same account and tax year, only retain the latest record: From the records selected in step 2, if there are multiple records with the same Acct_Id and Period_end_date, only retain the record with the most recent Status_date (i.e. MAX value on the date).
    4. Using the results from step 3, link to the applicable RETURN_LINE_ITEMS table where:
    • RETURNS.Id = RETURN_LINE_ITEMS.Rtrn_Id
    5. From the selected return on RETURN_LINE_ITEMS table, retrieve records where (value on Sch 000 Line 062 > 500,000) and (value on Sch 000 Line 066 < value on Sch 000 Line 062) :
    • Sched_nbr = '000', and Litm_line_item_nbr = '062', and Active_ind = 'Y', get Revise_val_amt as 'ab_taxable_income'
    • Sched_nbr = '000', and Litm_line_item_nbr = '066', and Active_ind = 'Y', get Revise_val_amt as 'amt_taxable_in_ab'
    • Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
    The tables used in this are : RETURNS and RETURN_LINE_ITEMS
    Structure of RETURNS table is:
    ID
    PROG_PROGRAM_CD
    ACCT_ID
    ACPE_ID
    JENT_ID
    PREV_RTRN_ID
    ENTP_ABN
    ACCT_OCCURNC_NBR
    SOURCE_TYPE
    RECEIVE_DATE
    AMEND_IND
    CMPLT_IND
    PENALTY_OR_IND
    RETURN_STATUS
    STATUS_DATE
    STATUS_USERID
    PERIOD_START_DATE
    PERIOD_END_DATE
    NOTICE_STATUS
    NOTICE_STATUS_DATE
    NOTE_TEXT
    PENALTY_OR_BY
    PENALTY_OR_TMST
    FILING_ID
    CASE_ID
    DOC_CONTRL_NBR
    LOCTR_NBR
    STATUTE_BARRED_DATE
    MEDIA_TYPE
    DISPSTN_TYPE
    AMEND_TYPE
    CALC_MODE
    PROCESS_PASS_CNT
    CONVRTD_IND
    LOSS_PERIOD_END_DATE
    MF_SYNC_CD
    CREATED_BY
    CREATED_TMST
    MODIFIED_BY
    MODIFIED_TMST
    Structure of RETURN_LINE_ITEMS is:
    ID
    RTSC_ID
    RTRN_ID
    SCLI_ID
    LITM_ID
    ENTP_ABN
    PROG_PROGRAM_CD
    ACCT_OCCURNC_NBR
    ACPE_END_DATE
    SCHED_NBR
    SCHD_VERSION_YR
    SCHD_VERSION_NBR
    RTSC_OCCUR_NBR
    LITM_LINE_ITEM_NBR
    SLIN_LINE_ITEM_ID
    OCCUR_NBR
    PREV_VAL_MOD_IND
    VIABLE_IND
    ACTIVE_IND
    ACTION_CD
    PREV_VAL_AMT
    REVISE_VAL_AMT
    PREV_VAL_TEXT
    REVISE_VAL_TEXT
    DISPLAY_SEQ_NBR
    SYS_VAL_AMT
    LITM_INNER_PASS_SEQ_NBR
    CREATED_BY
    CREATED_TMST
    MODIFIED_BY
    MODIFIED_TMST
    So scripts to create the able tables are:
    RETURNS
    CREATE TABLE RETURNS
    ID NUMBER(12),
    PROG_PROGRAM_CD VARCHAR2(2 BYTE),
    ACCT_ID NUMBER(12),
    ACPE_ID NUMBER(12),
    JENT_ID NUMBER(12),
    ENTP_ABN NUMBER(9),
    ACCT_OCCURNC_NBR NUMBER(4),
    SOURCE_TYPE VARCHAR2(30 BYTE) DEFAULT 'BLANK',
    RECEIVE_DATE DATE,
    AMEND_IND VARCHAR2(1 BYTE) DEFAULT 'N',
    CMPLT_IND VARCHAR2(1 BYTE) DEFAULT 'N',
    PENALTY_OR_IND VARCHAR2(1 BYTE) DEFAULT 'N',
    RETURN_STATUS VARCHAR2(12 BYTE),
    STATUS_DATE DATE,
    STATUS_USERID VARCHAR2(8 BYTE),
    PERIOD_START_DATE DATE,
    PERIOD_END_DATE DATE,
    NOTICE_STATUS VARCHAR2(12 BYTE),
    NOTICE_STATUS_DATE DATE,
    LOCTR_NBR NUMBER(10),
    MEDIA_TYPE VARCHAR2(30 BYTE),
    DISPSTN_TYPE VARCHAR2(30 BYTE),
    CONVRTD_IND VARCHAR2(1 BYTE) DEFAULT 'N')
    RETURN_LINE_ITEMS
    CREATE TABLE RETURN_LINE_ITEMS
    ID NUMBER(12),
    RTSC_ID NUMBER(12),
    RTRN_ID NUMBER(12),
    LITM_ID NUMBER(12),
    ENTP_ABN NUMBER(9),
    PROG_PROGRAM_CD VARCHAR2(2 BYTE),
    ACCT_OCCURNC_NBR NUMBER(4),
    ACPE_END_DATE DATE,
    SCHED_NBR VARCHAR2(3 BYTE),
    SCHD_VERSION_YR NUMBER(4) DEFAULT 0,
    SCHD_VERSION_NBR NUMBER(3),
    RTSC_OCCUR_NBR NUMBER(3),
    LITM_LINE_ITEM_NBR VARCHAR2(3 BYTE),
    SLIN_LINE_ITEM_ID NUMBER(12),
    OCCUR_NBR NUMBER(3) DEFAULT 1,
    PREV_VAL_MOD_IND VARCHAR2(1 BYTE) DEFAULT 'N',
    VIABLE_IND VARCHAR2(1 BYTE) DEFAULT 'N',
    ACTIVE_IND VARCHAR2(1 BYTE) DEFAULT 'Y',
    PREV_VAL_AMT NUMBER(15,2),
    REVISE_VAL_AMT NUMBER(15,2),
    DISPLAY_SEQ_NBR NUMBER(3),
    SYS_VAL_AMT NUMBER(15,2),
    LITM_INNER_PASS_SEQ_NBR NUMBER(3)
    So when you run the scripts above, the tables are created (I have tested it in TOAD)
    Now let's feed data into both the tables
    RETURNS table:
    insert into RETURNS
    VALUES
    (3602448 , '01' ,288151,3876821,9345370 , 403232531, 1, 'TAXPAYER' ,12/4/2008 ,'N', 'Y','N','ASSESSED', 2/18/2009,'SANDEEP',1/2/2008,1/2/2009,
    'PRINTED','2/18/2009, 6043073664,'PAPER', 'NOTICE','N');
    insert into RETURNS
    VALUES
    (4117092 , '01' ,57794,3864551,10566221 , 400571410, 1, 'TAXPAYER' ,6/30/2010 ,'N', 'Y','N','ASSESSED', 2/18/2009,'SANDEEP',1/2/2008,1/2/2009,
    'PRINTED','2/18/2009, 6043073664,'PAPER', 'NOTICE','N');
    RETURN_LINE_ITEMS table:
    INSERT INTO RETURN_LINE_ITEMS
    VALUES
    (266000770,7749234,3602448,1603,403232531, 01, 1, 1/1/2009, 000, 1998, 1,1, '062', 40,1, 'N','Y', -5440, -5440, 200,-5440,130);
    INSERT INTO RETURN_LINE_ITEMS
    VALUES
    (266000773,7749234,3602448,1539,403232531, 01, 1, 1/1/2009, 000, 1998, 1,1, '066', 43,1, 'N','Y', NULL, 0, 215,0,200);
    INSERT INTO RETURN_LINE_ITEMS
    VALUES
    (319820233,9028477,4117092,1603,400571410, 01, 1, 1/1/2009, 000, 1998, 1,1, '062', 40 ,1, 'N','Y', 790068, 790068, 200,790068,130);
    INSERT INTO RETURN_LINE_ITEMS
    VALUES
    (319820236,9028477,4117092,1539,400571410, 01, 1, 1/1/2009, 000, 1998, 1,1, '062', 40 ,1, 'N','Y', NULL, 790, 215,790068,200);
    This completes the test data.
    Now based on the question posed by the Business Analyst, until "5 b" i.e where it's said:
    Sched_nbr = '000', and Litm_line_item_nbr = '066', and Active_ind = 'Y', get Revise_val_amt as 'amt_taxable_in_ab'
    I am able to retrieve data perfectly fine and the query for that is:
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
    from returns r1, return_line_items rtlnms
    where r1.id = rtlnms.rtrn_id
    and r1.id > 3600000
    AND r1.prog_program_cd = '01'
    AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and RTLNMS.LITM_LINE_ITEM_NBR IN('062', '066')
    and rtlnms.active_ind = 'Y' and r1.id in(4117092, 3602448)
    The out put is : 4 rows returned which has litm_line_item_nbrs for all the returns in question (4117092, 3602448) and that is - 066,062,062, 066 with their respective amounts.
    However against the business analyst's question 5 "C" which is - Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
    I should be getting 2 rows(one with '062' and '066') with return -4117092
    So I am applying the logic as mentioned by business analyst's "5C" and run the following query:
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
    from returns r1, return_line_items rtlnms
    where r1.id = rtlnms.rtrn_id
    and r1.id > 3600000
    AND r1.prog_program_cd = '01'
    AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and RTLNMS.LITM_LINE_ITEM_NBR IN('062', '066')
    and rtlnms.active_ind = 'Y' and r1.id in(4117092, 3602448)
    and r1.id in (select rtrn2.id
    from returns rtrn2, return_line_items rtlnms2
    where rtrn2.id= rtlnms2.rtrn_id
    and rtrn2.id=r1.id
    and nvl(decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT),0) > 500000 or rtlnms2.litm_line_item_nbr='066') and (
    nvl(decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT),0) < nvl(decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT),0))
    order by r1.acct_id , r1.period_end_date desc
    I am only getting one row with for RETURN = 4117092 with litm_line_item_nbr (line item number) '062' where as I should also be getting line item number '066' along with '062'
    Could any one of you please help me out. I am stuck and have tried everything at the office with no luck.
    Many Many Thanks in Advance!
    Sandeep

    Hi there,
    I agree that without test case it's a bit complicated for you folks to solve. However I just could not. Anyways this is the query that I had to use to come to my solution and that is:
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
    from returns r1, return_line_items rtlnms
    where
    r1.id = rtlnms.rtrn_id and
    r1.prog_program_cd = rtlnms.prog_program_cd and
    r1.entp_abn = rtlnms.entp_abn and
    r1.id > 3600000 AND r1.prog_program_cd = '01' AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and rtlnms.active_ind = 'Y'
    and r1.id in (4117092,3715944,4382179,3691435)
    and RTLNMS.LITM_LINE_ITEM_NBR IN('062')
    AND nvl(decode(litm_line_item_nbr, '062', REVISE_VAL_AMT),0) > 500000
    and NVL(RTLNMS.REVISE_VAL_AMT,0) >( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
    FROM RETURN_LINE_ITEMS RTLNMS2
    WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
    AND RTLNMS2.LITM_LINE_ITEM_NBR = '066'
    AND SCHED_NBR='000'
    UNION
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
    from returns r1, return_line_items rtlnms
    where r1.id = rtlnms.rtrn_id
    AND r1.prog_program_cd = rtlnms.prog_program_cd
    AND r1.entp_abn = rtlnms.entp_abn
    AND r1.id > 3600000 AND r1.prog_program_cd = '01'
    AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and rtlnms.active_ind = 'Y'
    and r1.id in (4117092,3715944,4382179,3691435)
    and RTLNMS.LITM_LINE_ITEM_NBR IN('066')
    and NVL(RTLNMS.REVISE_VAL_AMT,0) <( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
    FROM RETURN_LINE_ITEMS RTLNMS2
    WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
    AND RTLNMS2.LITM_LINE_ITEM_NBR = '062'
    and NVL(RTLNMS2.REVISE_VAL_AMT,0)>500000
    AND SCHED_NBR='000'
    order by ID
    This above query works fine. No worries.
    One more question and that is:
    I need to find out details of another condition. However what happens is using the same query above, when I try to add "and RTLNMS.LITM_LINE_ITEM_NBR IN('066' ,029')" (in the bold part),
    it does give me another extra value for row 029 and that's something that I don't want. Based on the above results, I get 4 rows ; 2 each for 062 and 069.
    The question asked by business is based on the above results, bring out even values for 029, so which in this case should be 2 rows, making it overall 6, but then I get 7, is there any way to get rid of extra row
    or rather : is there any way to retrieve additional row based on results from a query?

  • How do I open the same ports on an Airport Extreme Base Station for multiple computers at the same time?

    As the title suggests...
    I have a mix of five Mac and PC's at home using an Airport Extreme Base Station as the router.   I need many ports opened on the AEBS for all of the computers- not just one computer.  (for example: three people want to play TF2 on Steam at the same time; each machine needs the correct ports open on the router).   Port forwarding  only allows me to forward a given port to a single IP, yet I need that port open for five differnt IP's, all at the same time. 
    How do I do that on an AEBS?
    In the same way, I have a small office of four iMacs using an old airport with the same exact issue.   I would like to be able to connect to all of them remotely with Apple Remote Desktop, but the port forwarding on the airport only allows a port to forward to a single IP.   I want to be able to tunnel into the office network and log onto any machine behind the Airport extreme... not just a single IP.    I currently have it set up where I can tunnel into the office from my house, I can find the one machine that the port forwarding has been assigned to, I can log on and everything is just fine... with one machine.    How do I open the firewall for the other machines? 
    TL,DR version:  How do you open ports on an Airport Extreme Base Station instead of forwarding ports?   Forwarding ports doesn't work for multiple IP's.  

    You can open a single or multiple ports to a single device or different ports to different devices, but you cannot open the same port to multiple devices via the AirPort Utility for the Apple routers.

  • Find my Friends : Support for multiple users under the same Apple ID?

    Can multiple users under the same Apple ID use the app to find each other?  My daughter uses my Apple ID with her iPod touch which allows me to monitor her purchases but it seems that only one device under an ID can use the app at a time.  If that is the case then it is a major disadvantage and I will need to go back to using latitude (or Find My iPhone which also allows me to see where all of my devices are at the same time)

    http://isource.com/2011/10/16/how-do-you-set-up-icloud-for-a-family/
    This worked for me.

  • Best practice for multiple instances of the same BEX query

    Hi there,
    I'm wondering what's the best way to use multiple instances of the same BEX query. Let me explain what I mean:
    I have a dashboard with different queries feeding different period of time such as: week to date, month to date and so on. One query for each since it is based on a user exit.
    For each query I want to show different data in different sections of my dashboard. Per example: sales per directors or sales per customer group, sales per day, sales per week and the like.I tried to connect a simple bar chart via a direct connection but with no success due to the multiple lines generated by the addition of the sales director, customer group, week number and so on.
    My question is about the way to connect the different queries efficiently in order to show the different data while avoiding multiple useless lines.
    The image above shows the query browser where, per example, for a Month to date query there will be mutiple line for each week as well as one line for each director. If, for two different components, I want to show data per week and data per director or other representation what is the best practice:
    Add another instance of the same query and only put the week information and another one will only the director info?
    Should I bind those to the excel file and use formulas to make final calculations?
    Will there be a performance issues for adding different instances of the same query
    I have 6 different queries (read 6 user exit that filters time via user exit).
    Depending on the best practices there might be 4 instances for each for a total of 24 instances in the query browser.
    I hope my question is clear enough, if not please do not hesitate I'll clarify as much as possible.
    Regards,
    Steve

    Hi Steve,
    Might be trying for solution for a long time, If i understood your question clear let me clarify you few points.
    You are trying to access the bex query which is designed with the exit's in the background based on the logic and trying to call the entire dimensions and key-figures in a single connection. Then you are trying to map those data in the charts.
    Steve, try to make more connections based upon the logic and split them. use the same query but split them by sales per customer group, sales per day, sales per week by making three different connections and try. You can merge the prompts from all connections.
    Hope this Helps!!!
    Sorry if i misunderstood your question.
    --SumanT

Maybe you are looking for

  • Importing family MobileMe calendars and accounts into iCloud and living to tell the tale...

    I have been staring at this for a long time and I hope this doesn't turn out to be as much of a brain twister as the early builds of MobileMe did. However, since I guess there must be plenty of us in the same boat, I figure this might be a good place

  • Java.lang.OutOfMemoryError -- Is there a way to limit BPEL instances number

    Hi All, My BPEL process is using JMS adapter to read the JMS queue. Whenever a new message arrives, a new BPEL instance is created. However, when the message gets bigger and multiple messages arrive at queue at the same time, the OC4J gets java OutOf

  • Video not in sync with audio or vice-versa

    This is a last ditch effort to try to find some definitive help.  Everyone has a sad story when things go awry with video capture.  Here's mine:  I recommended the Apple platform and iMovie for my wife for documenting a how-to for a particular hair s

  • Will be Re-installing Windows7 Then Re-installing iTunes

    I'm having software difficulties with my Windows RAID configuration and will need to re-install Windows 7 to move out of RAID. This means that all my files and programs will need to be re-installed. Right now I have no problems with iTunes and my iPh

  • End inventory and beginning inventory

    Hi all, how can i get the end and beginning inventories of a material, mlcd ckmlpr ckmlpp tables have some data regarding this issues but i want to know the how much of a ending inventory is of production and how much is of material etc. From which t