Oracle report problem-Passing a column value from a query block to another

Hi I am facing a problem in oracle reports.
I have 3 query blocks say Q1,Q2 and Q3.
From Q1 I get a tblkey coulmn and for each value of tblkey I need to pass it on to Q2 which gives me a status and now finally Q3 will take tblkey and status to give me final output.
Can somebody please tell me how I can do it?
Thanks,
Avin

Depending on your report requirement, you may do a join of Q1, Q2, and Q3; or keep all Qs and for Q3 use subqueries ...
Select ... from ... where tblkey, status in (
select tblkey, status from ... where tblkey in (
select tblkey from .... where .... ) )
Good luck.
DC

Similar Messages

  • Passing Multiple Single Values from Sender Query to Receiver Query in RRI

    Dear All.
    We have 2 - Bex Reports ZBEX_1 & ZBEX_2
    1. In ZBEX_1 having the fileds data like the below.
    Account Doc. Number - Clearing Document --- Amount
    12345                  -  65432                --- 100
    12346                  -  54321               ---  50
    2. In ZBEX_2 having the following data.
    Account Doc.Number -- Amount
    45342                     - 10
    66666                        -  100
    65432                       -   10
    54321                      - 5
    3. I am Traying to create RRI Between ZBEX_1 & ZBEX_2 , with Sender query as ZBEX_1 and Receiver query as ZBEX_2
    If I drilldown from ZBEX_1 need to show the following output in the ZBEX_2
    Account Doc. Number  -  Amount
    65432                       -     10
    54321                      -     5
    i.e If Clearing Documnet in the ZBEX_1 is same as Account Doc. Number in ZBEX_2 those Account Doc. Numbers I have to show in the output of ZBEX_2 RRI Report.
    Both the records I have to show at a time.
    So please suggest me
    1. How to pass Multiple Single Values to Next Query using RRI
    2. How to Map Clearing Document to Account Doc. Number in RRI.
    NOTE: Account Doc. Num length is same as Clearing Document
    Please suggest me.
    Thanks & Regards,
    Kiran Manyam

    Your scenario of passing values from multiple records in Source does not suit well for RRI Jumps.
    In ZBEX_2 query, create a Replacement path variable on Clearing Document. In that Replacement path variable, use the Replacement with query option and choose the ZBEX_1 as the underlying query source.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bd/589b3c494d8e15e10000000a114084/frameset.htm
    When you execute ZBEX_2, what ever clearing document values that ZBEX_1 has will be passed through the replacement path variable as a filter to the ZBEX_2
    Hope it helps!
    Uday Pothireddy

  • Passing a variable value from one query to another within a web template

    Hi All,
    I have a web template with two queries.  Both queries have the same select option variable called ZSELCUST on the characteristic ZCUSTOMER but because they are different info providors (both infocubes) the customer has to be entered once for each query, even with the 'Display same variable only once' flag checked.
    I want the user to select the customer once and then that value be passed to the other query within the resulting web template output.
    Am I right in that the same variable is used more than oncee because of the different info providors?
    I'm struggling, can anyone help out there....???
    Best Regards,
    Stuart Humphrey

    Hi
    A way of doing this is by "linking" the queries: in transaction RSBBS you define the sender and receiver queries. In query navigation you can jump to the dependent query (blue arrow icon in the BEx tool bar). This transfers the navigational state to the called query: filters over characteristics and variable values.
    Hope this help
    German

  • Is it possible to pass a formula value from a sub-report to a main report

    Hi there,
    Im trying to pass a formula value from a Sub-report back upto into my Main report but the value doesnt seem to be getting passed up. Ive tried it the other way around, that is, passing a value from the main report to the sub-report and that works fine.
    Below is an example of what I am trying to do but it is not working. In my sub-report Ive declared a formula variable as,
    formula name=main_subIntRatePageCount
    Shared NumberVar subIntRatePageCount := TotalPageCount;
    and in the Main report Ive declared the formula variable as,
    formula name=subIntRatePageCount
    Shared NumberVar subIntRatePageCount;
    subIntRatePageCount;
    I want the value assigned to "subIntRatePageCount" in my Sub-Report to be available to my Main report.
    The problem I am trying to solve is that the sub-report is spilling over onto two pages, and I need a way of updating the page display on the main report to reflect this. The page display is of format, "displaying page 1 of  3", but its not taking into account the extra page produced by the sub-report, so it should say "displaying page 1 of 4".

    Also thanks Raghavendra, Asha,
    I've tried adding the "whileprintingrecords" statement but that doesnt seem to make any difference.
    I notice that the subReport is being called from my the GroupFooter section of the main report, and I am trying to reference the variable in the main repot in the Page Footer section. Could it be that the variable hasnt been calculated in the Page Footer by the time I calculate it in sub-Report? I thought Crystal Reports does at least 5 passes over the report evaluating all the formulas before it prints the report?
    The problem Im trying to solve is I need to know how many pages my report will have before its completed, so that i can print the statement "displaying page 1 of X", and X is currently not being calculated correctly because the sub-report is printing onto 2 pages and not 1 so the report thinks I have 1 of X pages and not X+1.
    Regards
    Robert.

  • Passing multiple character values from parameter form to PL/SQL

    Hi,
    I am passing multiple character values from parametr form into
    the report query and a PL/SQL procedure. It works fine with the
    query, when I use &variable. But, it doesn't compile in PL/SQL,
    so I just used the :variable, but not getting any records in the
    PL/SQL procedure. Any suggestions?
    sincerely,
    gj

    gj / Fedro,
    Only using the &referecne, you can pas a string / multiple character values and this would work for query only.
    The bind parameter in PL/SQL wouls support only single value
    Thanks
    The Oracle Reports Team

  • Oracle SP for comparing 80 column values across 8 table pairs in 2 diff DBs

    Hi All,
    I have an Oracle SP for comparing 80 column values across 8 table pairs in 2 diff DBs.
    However, it is taking hell lot of time around 6hours to process 10,000 records.
    Can anyone suggest how to fine-tune this?
    Thanks guys.

    Tables prefixed with X are the temp tables to store data of DB-A.
    The report will be originally based on DB-B, so DB Links will not be required for @PROD1.WORLD tables.
    This is a test region, so I have pointed to @PROD1.WORLD to test with Prod Data.
    SEC_COMPARE_CONFIG is the config table containing the table_name to be reported, corresponding temp tables to store the data and the columns on which it is to be reported.
    There are in total 8 tables- 90 rows and 8 temp tables.
    SPOKE_TO_HUB_SEC_MTCH_TBL records the securities on which it is to be reported.
    HIST_DATA_COMPARE_TBL is the final results table.
    Here is the entire code:
    CREATE OR REPLACE PACKAGE SECURITY_COMPARE AS
    PROCEDURE          PROCESS_RECORDS       (IN_EFFECTIVE_DATE               IN        DATE,
                                              IN_PRIMARY_ASSET_ID            IN        VARCHAR2    DEFAULT NULL);
    PROCEDURE          IDENTIFY_SECURITIES    ( P_EFFECTIVE_DATE                IN          DATE,
                                                P_PRIMARY_ASSET_ID              IN         VARCHAR2  DEFAULT NULL);
    PROCEDURE           RETREIVE_RECORDS_FROM_SPOKE;
    PROCEDURE           COMPARE_RECORDS(p_err_msg     OUT     VARCHAR2);
    PROCEDURE           INSERT_DATA_TO_TABLE  ( v_target_table VARCHAR2,  v_sql_to_run   VARCHAR2,    v_commit_after NUMBER);
    END SECURITY_COMPARE;
    CREATE OR REPLACE PACKAGE BODY SECURITY_COMPARE AS
    /*Declared String for recording Dynamic SQL's*/
    LC_SQL                  VARCHAR2 (20000);
    PROCEDURE   PROCESS_RECORDS(IN_EFFECTIVE_DATE              IN  DATE,
                                IN_PRIMARY_ASSET_ID          IN  VARCHAR2    DEFAULT NULL)
    AS
    L_EFF_DATE                                        DATE;                      
    L_PRIMARY_ASSET_ID                         VARCHAR2(100);                    
    k_err_msg                                           VARCHAR2(100);                    --Error message displayed in case of NO discretionary records found.
    BEGIN
                    L_EFF_DATE                    := IN_EFFECTIVE_DATE;
                    L_PRIMARY_ASSET_ID     := IN_PRIMARY_ASSET_ID;
                    IDENTIFY_SECURITIES(L_EFF_DATE,L_PRIMARY_ASSET_ID);        --Calling the Identify_Securities procedure to identify the securities older by 90 days from report effective date
                    RETREIVE_RECORDS_FROM_SPOKE();                                        --Retreiving the historic records from the security tables into temporary tables.
                    COMPARE_RECORDS(p_err_msg=>k_err_msg);                          --Compare the records and report the discrepencies into HIST_DATA_COMPARE_TBL table      
    END PROCESS_RECORDS;
    PROCEDURE IDENTIFY_SECURITIES(P_EFFECTIVE_DATE              IN  DATE,
                                                        P_PRIMARY_ASSET_ID               IN  VARCHAR2  DEFAULT NULL)
    AS
    P_EFF_DATE                          DATE;                       --Effective Date of the report
    P_PRIMARY_ID                         VARCHAR2(100);     --Primary AssetID which is used to search based on specific security
    v_target_table                        VARCHAR2(500);     --Variable indicating the Target table for inserting the data
    v_sql_to_run                          VARCHAR2(5000);   --Variable to store the Dynamic SQL to be executed
    v_commit_after                      NUMBER;                --Variable to define after how many records is COMMIT to be done
    BEGIN
            LC_SQL                 :='';
            P_EFF_DATE          := P_EFFECTIVE_DATE;
            P_PRIMARY_ID         := P_PRIMARY_ASSET_ID;
            /*Deleting Old Entries from SPOKE_TO_HUB_SEC_MTCH_TBL table*/
               LC_SQL := 'TRUNCATE TABLE SPOKE_TO_HUB_SEC_MTCH_TBL';
               EXECUTE IMMEDIATE LC_SQL;
            IF(P_PRIMARY_ID is NULL)    --In case records do not need to be identified on basis of specific security
            THEN  
                /*Identify Securities older by 90days from report effective date*/
                     v_target_table := ' SPOKE_TO_HUB_SEC_MTCH_TBL';
                     v_sql_to_run := 'WITH T AS ('||
                                             ' SELECT  R.PRIMARY_ASSET_ID PRIMARY_ASSET_ID_R,'||
                                             ' R.SECURITY_ALIAS SECURITY_ALIAS_R,'||
                                             ' R.LAST_HELD_DATE LAST_HELD_DATE_R,'||
                                             ' R.PREV_HELD_DATE PREV_HELD_DATE_R,'||
                                             ' Q.PRIMARY_ASSET_ID PRIMARY_ASSET_ID_Q,'||
                                             ' Q.SECURITY_ALIAS SECURITY_ALIAS_Q,'||
                                             ' COUNT(*) OVER(PARTITION BY Q.PRIMARY_ASSET_ID) CNT'||
                                            ' FROM  [email protected] R,'||
                                            ' [email protected] Q'||
                                            ' WHERE SYS_OP_MAP_NONNULL(R.last_held_date) <> '||q'!'FF'!'||
                                           ' and ceil(R.last_held_date-to_date('||''''||P_EFF_DATE||''''||')) >= 0'||
                                           ' and ceil(R.last_held_date-to_date('||''''||P_EFF_DATE||''''||')) <= 60'||
                                           ' and R.PRIMARY_ASSET_ID=Q.PRIMARY_ASSET_ID'||
                                           ' )'||
                                          ' SELECT  PRIMARY_ASSET_ID_R,'||
                                          ' SECURITY_ALIAS_R,'||
                                          ' LAST_HELD_DATE_R,'||
                                          ' PREV_HELD_DATE_R,'||
                                          ' PRIMARY_ASSET_ID_Q,'||
                                          ' SECURITY_ALIAS_Q'||
                                          ' FROM  T'||
                                          ' WHERE CNT =1';
                     v_commit_after := 0;
                     INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
            ELSE
                        v_target_table := ' SPOKE_TO_HUB_SEC_MTCH_TBL';
                        v_sql_to_run := 'WITH T AS ('||
                                             ' SELECT  R.PRIMARY_ASSET_ID PRIMARY_ASSET_ID_R,'||
                                             ' R.SECURITY_ALIAS SECURITY_ALIAS_R,'||
                                             ' R.LAST_HELD_DATE LAST_HELD_DATE_R,'||
                                             ' R.PREV_HELD_DATE PREV_HELD_DATE_R,'||
                                             ' Q.PRIMARY_ASSET_ID PRIMARY_ASSET_ID_Q,'||
                                             ' Q.SECURITY_ALIAS SECURITY_ALIAS_Q,'||
                                             ' COUNT(*) OVER(PARTITION BY Q.PRIMARY_ASSET_ID) CNT'||
                                            ' FROM  [email protected] R,'||
                                            ' [email protected] Q'||
                                            ' where R.PRIMARY_ASSET_ID='||''''||P_PRIMARY_ID||''''||
                                            ' and R.PRIMARY_ASSET_ID=Q.PRIMARY_ASSET_ID'||
                                           ' )'||
                                          ' SELECT  PRIMARY_ASSET_ID_R,'||
                                          ' SECURITY_ALIAS_R,'||
                                          ' LAST_HELD_DATE_R,'||
                                          ' PREV_HELD_DATE_R,'||
                                          ' PRIMARY_ASSET_ID_Q,'||
                                          ' SECURITY_ALIAS_Q'||
                                          ' FROM  T'||
                                          ' WHERE CNT =1';
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
            END IF;
            LC_SQL := 'TRUNCATE TABLE HIST_DATA_COMPARE_TBL';
            EXECUTE IMMEDIATE LC_SQL;
    END IDENTIFY_SECURITIES;
    PROCEDURE           RETREIVE_RECORDS_FROM_SPOKE
    AS
    v_target_table                                                      VARCHAR2(500);
    v_sql_to_run                                                        VARCHAR2(5000);
    v_commit_after                                                      NUMBER;
    BEGIN
        LC_SQL :='';
        LC_SQL:= 'TRUNCATE TABLE X_SECMASTER_HISTORY_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_SEC_MASTER_DTL_HIST_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_SECMASTER_DTL_EXT_HST_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_EQUITY_HIST_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_EQUITY_DETAIL_HIST_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_FIXED_INCOME_HIST_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_FIXED_INCOME_DTL_EXT_TBL';
        EXECUTE IMMEDIATE LC_SQL;
        LC_SQL:= 'TRUNCATE TABLE X_DERIVATIVES_HIST_TBL';
        EXECUTE IMMEDIATE LC_SQL;
            /*SECMASTER_HISTORY*/
            v_target_table := 'X_SECMASTER_HISTORY_TBL';
            v_sql_to_run := ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                                    ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                                    ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                                    ' AND K.SRC_INTFC_INST = 140 '||
                                    ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM  [email protected] H WHERE'||
                                    ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*SECURITY_MASTER_DETAIL_HIST*/
                v_target_table := 'X_SEC_MASTER_DTL_HIST_TBL';
              v_sql_to_run:=       ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                     ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                     ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                     ' AND K.SRC_INTFC_INST = 140 '||
                     ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                     ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*SECMASTER_DETAIL_EXT_HIST*/
        v_target_table := 'X_SECMASTER_DTL_EXT_HST_TBL';
               v_sql_to_run:=       ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                     ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                     ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                      ' AND K.SRC_INTFC_INST = 140 '||
                      ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                      ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*EQUITY_HIST*/
        v_target_table := 'X_EQUITY_HIST_TBL';
               v_sql_to_run:=        ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                      ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                      ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                       ' AND K.SRC_INTFC_INST = 140 '||
                       ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                       ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*EQUITY_DETAIL_HIST*/
        v_target_table := 'X_EQUITY_DETAIL_HIST_TBL';
             v_sql_to_run:=        ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                     ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                     ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                     ' AND K.SRC_INTFC_INST = 140 '||
                     ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                     ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*FIXED_INCOME_HIST*/
            v_target_table := 'X_FIXED_INCOME_HIST_TBL';
               v_sql_to_run:=       ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                     ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                     ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                      ' AND K.SRC_INTFC_INST = 140 '||
                      ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                      ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*FIXED_INCOME_DETAIL_EXT_HIST*/
        v_target_table := 'X_FIXED_INCOME_DTL_EXT_TBL';
               v_sql_to_run:=       ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                     ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                     ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                      ' AND K.SRC_INTFC_INST = 140 '||
                      ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                      ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
        /*DERIVATIVES_HIST*/
        v_target_table := 'X_DERIVATIVES_HIST_TBL';
           v_sql_to_run:=           ' SELECT /*+DRIVING_SITE(K)*/ K.* FROM [email protected] K '||
                      ' INNER JOIN SPOKE_TO_HUB_SEC_MTCH_TBL I'||
                     ' ON K.SECURITY_ALIAS = I.SPOKE_SEC'||
                      ' AND K.SRC_INTFC_INST = 140 '||
                      ' and K.EFFECTIVE_DATE =(SELECT /*+DRIVING_SITE(H)*/ MAX (H.EFFECTIVE_DATE) FROM [email protected] H WHERE'||
                      ' H.SECURITY_ALIAS = K.SECURITY_ALIAS AND H.SRC_INTFC_INST = K.SRC_INTFC_INST)' ;
                           v_commit_after := 0;
                           INSERT_DATA_TO_TABLE(v_target_table,v_sql_to_run,v_commit_after);
    END RETREIVE_RECORDS_FROM_SPOKE;
    PROCEDURE           COMPARE_RECORDS(p_err_msg     OUT     VARCHAR2)
    AS
        l_count                                                                 NUMBER;
        l_err_msg                                                             VARCHAR2(100);
        TYPE T_SECURITIES is TABLE of HIST_DATA_COMPARE_TBL%rowtype;
        ttype                                                                    T_SECURITIES;
        CURSOR C1
        IS
        SELECT  TABLE_NAME, TEMP_TABLE, COLUMN_NAME from SEC_COMPARE_CONFIG
        where column_name='EFFECTIVE_DATE';
        CURSOR C2
        IS
        SELECT * FROM SEC_COMPARE_CONFIG where id <=82;
        C_REC                                 SEC_COMPARE_CONFIG%rowtype;
        BEGIN
            LC_SQL :='';
            p_err_msg :='';
                FOR C_REC in C1
                loop  
                                LC_SQL:=     ' SELECT /*+DRIVING_SITE(B)*/ /*+PARALLEL(A,100)*/ B.SECURITY_ALIAS, to_char(C.SPOKE_PAID), A.SECURITY_ALIAS,to_char(C.HUB_PAID),'||''''||C_REC.TABLE_NAME||''''||','||q'!'EFFECTIVE_DATE'!'||','||
                                                    ' NVL((cast(B.'||C_REC.COLUMN_NAME||' as VARCHAR2(100))),'||q'!'No Records Found'!'||'),'||
                                                    ' NVL((cast(A.'||C_REC.COLUMN_NAME||' as VARCHAR2(100))),'||q'!'No Records Found'!'||')'||
                                                    ' FROM '||C_REC.TEMP_TABLE||' A, SECURITYDBO.'||C_REC.TABLE_NAME ||'@PROD1.WORLD B,'||
                                                    ' SPOKE_TO_HUB_SEC_MTCH_TBL C'||                                
                                                    ' WHERE A.SRC_INTFC_INST=140'||
                                                    ' AND B.SRC_INTFC_INST=140'||
                                                    ' AND A.SECURITY_ALIAS=C.spoke_sec'||
                                                    ' and b.security_alias=C.HUB_SEC'||
                                                    ' AND a.effective_date <> (select max(h.effective_date) from SECURITYDBO.'||C_REC.TABLE_NAME||'@PROD1.WORLD H'||
                                                    ' where h.security_alias=c.hub_sec and h.src_intfc_inst=140 )';
                                        EXECUTE IMMEDIATE LC_SQL BULK COLLECT into ttype;
                              FORALL x in ttype.First..ttype.Last
                                        insert into HIST_DATA_COMPARE_TBL values ttype(x);                 
                                        commit;
                end loop;
               For C_REC in C2
                loop
                                LC_SQL:=     ' SELECT /*+DRIVING_SITE(B)*/ /*+PARALLEL(A,100)*/ B.SECURITY_ALIAS, to_char(C.SPOKE_PAID), A.SECURITY_ALIAS,to_char(C.HUB_PAID),'||''''||C_REC.TABLE_NAME||''''||','||''''||C_REC.COLUMN_NAME||''''||','||
                                                    ' NVL((cast(B.'||C_REC.COLUMN_NAME||' as VARCHAR2(100))),'||q'!'No Records Found'!'||'),'||
                                                    ' NVL((cast(A.'||C_REC.COLUMN_NAME||' as VARCHAR2(100))),'||q'!'No Records Found'!'||')'||
                                                    ' FROM '||C_REC.TEMP_TABLE||' A, SECURITYDBO.'||C_REC.TABLE_NAME ||'@PROD1.WORLD B,'||
                                                    ' SPOKE_TO_HUB_SEC_MTCH_TBL C'||                                
                                                    ' WHERE A.SRC_INTFC_INST=140'||
                                                    ' AND B.SRC_INTFC_INST=140'||
                                                    ' AND A.SECURITY_ALIAS=C.spoke_sec'||
                                                    ' and b.security_alias=C.HUB_SEC'||
                                                    ' and b.effective_date=a.effective_date'||
                                                  ' AND NVL((cast(A.'||C_REC.column_name||' as VARCHAR2(100))),'||q'!'No Records Found'!'||') <>'||
                                                    ' NVL((cast(B.'||C_REC.column_name||' as VARCHAR2(100))),'||q'!'No Records Found'!'||')';
                             EXECUTE IMMEDIATE LC_SQL BULK COLLECT into ttype;
                            FORALL x in ttype.First..ttype.Last
                                    insert into HIST_DATA_COMPARE_TBL values ttype(x);                 
                                    commit;
                end loop;
                BEGIN
                    select  count(*) into l_count from HIST_DATA_COMPARE_TBL;
                    if(l_count=0) then
                            l_err_msg :='No records found';
                    end if;
                END;
        END COMPARE_RECORDS;
                NAME:               INSERT_DATA_TO_TABLE
    DESCRIPTION:               This procedure will insert the records into the target table based based on the data fetched using the sql to run variable.
                                        It also records the commit_after variable which defines that after how many records the insert needs to be committed.
    PROCEDURE INSERT_DATA_TO_TABLE  ( v_target_table VARCHAR2,
                                                                v_sql_to_run   VARCHAR2,
                                                                v_commit_after NUMBER) IS
    v_limit_sql1    VARCHAR2(300) := ' ';
    v_limit_sql2    VARCHAR2(900) := ' ';
    v_plsql_to_run  VARCHAR2(32767);
    BEGIN
            IF NVL(v_commit_after,0) <> 0 THEN
                v_limit_sql1:=  '  LIMIT ' || TO_CHAR(v_commit_after) ;
                v_limit_sql2:=  '   IF MOD(v_number_of_rows, ' || TO_CHAR(v_commit_after) || ' ) = 0 THEN     ' ||
                      '       COMMIT;                                                               ' ||
                      '   END IF;                                                                   ' ;
            END IF;
            v_plsql_to_run:=  '                                                                             ' ||
                      'DECLARE                                                                      ' ||
                      ' v_number_of_rows number:=0;                                                 ' ||
                      '                                                                             ' ||
                      ' TYPE MyType IS REF CURSOR;                                                  ' ||
                      ' CV MyType;                                                                  ' ||
                      ' TYPE RecTyp IS TABLE OF ' || v_target_table || '%ROWTYPE;                   ' ||
                      ' rec RecTyp;                                                                 ' ||
                      '                                                                             ' ||
                      'BEGIN                                                                        ' ||
                      '                                                                             ' ||
                      'OPEN CV FOR                                                                  ' ||
                      '    ' || REPLACE( v_sql_to_run, ';', ' ' )  || ' ;                           ' ||
                      ' LOOP                                                                        ' ||
                      '     FETCH CV BULK COLLECT INTO rec ' || v_limit_sql1 || ';                  ' ||
                      '     FORALL i IN 1..rec.COUNT                                                ' ||
                      '         INSERT /*+ APPEND */ INTO ' || v_target_table || ' VALUES rec(i);   ' ||
                      '         v_number_of_rows  := v_number_of_rows + SQL%ROWCOUNT;               ' ||
                      ' ' || v_limit_sql2 || '                                                      ' ||
                      '     EXIT WHEN CV%NOTFOUND;                                                  ' ||
                      '                                                                             ' ||
                      ' END LOOP;                                                                   ' ||
                      ' COMMIT;                                                                     ' ||
                      ' CLOSE CV;                                                                   ' ||
                      'END;                                                                         ';
            EXECUTE IMMEDIATE v_plsql_to_run;
            COMMIT;
    END INSERT_DATA_TO_TABLE;
    END SECURITY_COMPARE;

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • How Can I get multi column values from dynamic search help?

    Hi Gurus;
    I'm using dynamic search help in my program.
    I want to get multi column values from search help. But I dont know solution for this issue.
    I'm using F4IF_INT_TABLE_VALUE_REQUEST FM.
    How Can I get multi column values from dynamic search help?
    Thanks.

    Believe it or not, the same FM worked for me in a dynpro. I will try to explain here how it works in custom screen and then you can do your work for other screens or program types. I am not going to write my actual work but will explain in general.
    I have 4 fields (FLD1, FLD2, FLD3, FLD4) and i made the search based on FLD2 and when user click on a line (could be any field), then this would bring the line on to the screens.
    There are like 3 steps.
    You have your value_tab for my fields FLD1, FLD2, FLD3 and FLD4. This is just the data that we pass into the FM. (data: IT_VALTAB type table of ZVAL_TABLE)
    Next map the screen fields into an internal table (data: It_dynpfld type table of dselc ). I also have other internal tables defined  (just to keep it straight, i will be putting here) data:  It_return type standard table of ddshretval.
    Next step is to call the function module. Make sure you have values in IT_VALTAB.
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
            retfield        = 'FLD2'
            value_org       = 'S'
          tables
            value_tab       = It_VALTAB
            return_tab      = It_return
            dynpfld_mapping = It_dynpfld
          exceptions
            parameter_error = 1
            no_values_found = 2
            others          = 3.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        else.
          perform get_selected_fields tables It_return.
        endif.
    The code within the perform GET_SELECTED_FIELDS  - We need to map the result fields after user selects it. The code goes like this. This is step is to update the dynpro fields.
    I need a internal table as well as a work area here. like,
    data: lt_fields type table of dynpread,
            la_fields type dynpread.
      field-symbols: <fs_return> type ddshretval.
    so fill out LT_FIELDS from the IT_RETURN table
    loop at lt_return assigning <fs_return>.
        la_fields-fieldname = <fs_return>-retfield.
        la_fields-fieldvalue = <fs_return>-fieldval.
        append la_fields to lt_fields.
        clear: la_fields.
      endloop.
    Call the FM to update the dynpro
    call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname               = sy-repid
          dynumb               = '1002' "This is my screen number. You could use 1000 for selection screen (hope so)
        tables
          dynpfields           = lt_fields
        exceptions
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          undefind_error       = 7
          others               = 8.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    good luck

  • Report Template href with column value

    I have created a Report template and want to have a field that is a href with link to other page passing column value. I'm having trouble passing the column value. If I hard code the value the href code works. If I try to pass #1# or the column name with # surrounding the link doesn't work. Any ideas would be appreciated.
    This works:
    <td><img src="/i/edit.gif" border="0" alt="Edit Icon">
    </td>
    This doesn't:
    <td><img src="/i/edit.gif" border="0" alt="Edit Icon">
    </td>
    Thanks
    Mary Jo Al-Shihabi

    Hi Sergio, thanks I finally got it working using a call to javascript:popupURL.
    <td><align="center">#PORT_APP_ID#</td>
    Thanks
    Mary Jo

  • Passing global variable values from databse to forms

    I am using forms 6i and database is oracle 9i.
    I am trying to run a form stand alone ( by pressing CTRL-R) without putting it in the application.
    since when this form is placed in the application menu it works fine as it has been passed global variables values from the database .
    now i am trying to run the form without menu and thus i want to pass the values of global variables .please let me know where should i pass these values in form .is it be WHEN-NEW-FORM-Instance trigger or in Pre-form trigger.
    i know what are the global variable values passing into the form from database.
    i can hard code any values to check if the form runs well or not.

    If you intend to do this sort of testing regularly you might want to consider creating a seperate form with a control block which allows entry of the name of the form you want to run, the names of the globals and their values, and do a CALL_FORM.

  • Get column values from list of values programmatically

    hi all
    how i get column values from list of values programmatically in the
    returnPopupDataListener method

    If this answers your question , please close this thread by marking it as answered.
    Thanks

  • Problem in getting parameter value from selection screen in web dynpro abap

    Hi,
    I am facing problem in getting parameter value from selection screen.
    Please find my code below:
    DATA LT_PAR_ITEM TYPE IF_WD_SELECT_OPTIONS=>TT_SELECTION_SCREEN_ITEM.
    FIELD-SYMBOLS:<FS_PAR_ITEM> LIKE LINE OF LT_PAR_ITEM,
                                 <FS_OBJ_USAGE>    TYPE REF TO data.
      WD_THIS->M_HANDLER->GET_PARAMETER_FIELDS( IMPORTING ET_FIELDS = LT_PAR_ITEM ).
      LOOP AT LT_PAR_ITEM ASSIGNING <FS_PAR_ITEM>.
        CASE <FS_PAR_ITEM>-M_ID.
          WHEN `OBJ_USAGE`.
             ASSIGN <FS_PAR_ITEM>-M_VALUE->* TO <FS_OBJ_USAGE>.      
    [ Here, sy-subrc is 4,  <FS_OBJ_USAGE> is not assigning.]
        ENDCASE.
      ENDLOOP. 
    So, can any one solve this problem.
    Thanks in advance,
    Radhika

    Hi Radhika,
    Try using GET_RANGE_TABLE_OF_SEL_FIELD...
    Please Refer below code..
       DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: RT_CARRID TYPE REF TO DATA.
      DATA: ISFLIGHT TYPE TABLE OF SFLIGHT.
      DATA: WSFLIGHT TYPE SFLIGHT.
      FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE.
    Retrieve the data from the select option
      RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_CARR_ID' ).
    Assign it to a field symbol
      ASSIGN RT_CARRID->* TO <FS_CARRID>.
      CLEAR ISFLIGHT. REFRESH ISFLIGHT.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE ISFLIGHT FROM SFLIGHT
                           WHERE CARRID IN <FS_CARRID>.
      NODE_FLIGHTS = WD_CONTEXT->GET_CHILD_NODE( NAME = `FLIGHTS` ).
      NODE_FLIGHTS->BIND_ELEMENTS( ISFLIGHT ).
    Thanks,
    Regards,
    Kiran

  • Dml error logging: can we pass source column values to ora_err_tag$

    Hi Experts,
    We can set ora_err_tag$ values while implementing dml error logging feature.
    Can we pass source column values to ora_err_tag$ field of error table?
    Thanks,
    Dhiraj

    F5wrong forum
    Philip

  • Oracle reports problem in distribution with xml file

    Hi ,
    I am having problem while I am trying to distribute the file with specifing the destination details in the xml. If I am giving the destination details in url then it is working.
    Ex.
    This is Working
    http://bryxh91:8889/reports/rwservlet?report=devlopersuit/reports/test.jsp&userid=anju/[email protected]&desformat=pdf&destype=file&desname=devlopersuit/reports/output_file.pdf
    Not working :
    http://bryxh91:8889/reports/rwservlet?report=devlopersuit/reports/test.jsp&userid=anju/[email protected]&DISTRIBUTE=YES&destination=devlopersuit/reports/dis_test.xml
    xml file
    <destinations>
    <file id="test" name="output_file.pdf" format="pdf">
    <include scr="mainSection"/>
    </file>
    </destinations>
    Error : REP-34304: Distribution failed to complete; review the distribution lists
    Its been week I tried many things , but not working.
    Right now I am trying to distribute to single file but my goal is to burst and distribute on basis of account number.
    This is the first stage of the project.
    Thanks a lot for the help
    Anju

    Hello
    see answer in Oracle reports problem in distribution with xml file
    Regards

  • Can be passed Formula Column value to Procedure/Function?

    Below cf_value is return after some calculation by using main query.
    Can be directly passed formula column value to procedure without assinged to placeorder?
    as below..
    f_convert(:cf_value,new_value);
    My Procedure is...
    PROCEDURE f_convert( val1 in number,val2 in out number) IS
    BEGIN
    val2 := val1 * 100;
    END;
    If anyone knows pls reply me....

    Actually, if there is any other calculations there (In Proceudre)
    Can I used is as below??
    PROCEDURE f_convert( val1 in number,val2 in out number) IS
    BEGIN
    val2 := val1 * 100;
    return (val2);
    END;
    ----A procedure cannot return a value, the return clause in my previous post was part of the function for formula column.
    Suppose you have a formula column say CF_2 then the function for it will be as:
    function cf_2formula return number
    is
    val1 number;
    val2 number;
    begin
    val2 := :cf_1 * 100; -- or val2 := val1 * 100 --parameters not allowed in formula column function
    -- All the other code that you need inclusive of calling function, procedure as in any PL/SQL block can be placed
    return (val2);
    end;So any other calculation can be used in the formula column function

Maybe you are looking for