Selection in query

HI Gurus,
I have a problem. I am doing AP aging report. I want to display a field called status ( net due date - last date). Last date should be given as a variable in selection screen, but the problem is last date is not in DSO on which the report is based. So i am not able to use it as a selection variable. Is there a way to make this available in the query.
Regards,
Raghavendra.

HI
  I do have the same problem which you have given in SDN about selection screen
if you have the solution can you please post the same in SDN under same thread
Thanks
Pardha

Similar Messages

  • How to get resultset from procedure having dynamic select sql query ?

    Hi,
    I have created a procedure, in which there is dynamic select query. The procedure has one out put parameter which gives error code. When I compile that procedure it compiles successufully. When I run it it executes successfully and gives output error code. But I don't know how to get resultset of that dynamic select sql query. I need that.
    This is the procedure:
    create or replace
    PROCEDURE uspGetProductDetailsMultiOrder
      v_DefinitionDBName IN VARCHAR2,
         v_CommonDBName IN VARCHAR2,
         v_Filter_FilledStatus IN VARCHAR2,
         v_Filter_Internal_Counterparty IN nvarchar2,
         v_Filter_NoteType IN nvarchar2,
         v_Filter_Exchange IN nvarchar2,
         v_Filter_Issuer IN nvarchar2,
         v_Filter_Product_Category  IN VARCHAR2,
         v_DateToFilter IN VARCHAR2,     
         v_Filter_FromDate IN VARCHAR2,
         v_Filter_ToDate IN VARCHAR2,
         v_Active_YN_Flag IN NVARCHAR2,
         v_Entity_ID IN NVARCHAR2,
         v_ErrorNumber  OUT NUMBER
       as
       v_SelectSQL  nvarchar2(32767);
          v_Setting_Name  nvarchar2(32767);
       v_Default_Value  nvarchar2(32767);
       v_Config_Value  nvarchar2(32767);
       v_CCY_ID  NUMBER(10,0);
       v_CCY_Data  nvarchar2(32767);
       v_CCY_List  nvarchar2(32767);
       v_Seq_Id  NUMBER(10,0);
       SWV_Active_YN_Flag NVARCHAR2(1);
       SWV_VarStr long;--varchar2(4000);
       SWV_TRANCOUNT NUMBER(10,0);
        SWV_fnc_SplitString_Id_var1 NUMBER(10,0);
       SWV_fnc_SplitString_Id_var0 NUMBER(10,0);
      CURSOR RestrictTermsheetVisibilityByC 
       IS select CS.Setting_Name,Default_Value,Config_Value
       from Config_Settings CS   LEFT OUTER JOIN Entity_Config EC  ON EC.Setting_ID = CS.Setting_ID
       where EC.Entity_ID = v_Entity_ID AND Setting_Level = 'ENTITY';
       CURSOR Get_RestrictCCY_List_Cursor IS SELECT Id_1,Data_1 FROM table(fnc_SplitString(v_Config_Value,','));
       --CURSOR Get_RestrictCCY_List_Cursor IS SELECT Id,Data FROM imp;
       CURSOR GetRestrictTemplateListCursor 
      -- is select id,data from imp;
       IS SELECT Id_1,Data_1 FROM table(fnc_SplitString(v_Config_Value,',')) ;
         --Parikshit 18-Jul-2010, active YN flag param added in SP
    BEGIN
    SWV_Active_YN_Flag := v_Active_YN_Flag;
       if SWV_Active_YN_Flag = ' '  then
          SWV_Active_YN_Flag := 'Y';
       end if;
       v_SelectSQL := ' ';
       v_SelectSQL := v_SelectSQL || ' Select ';
       v_SelectSQL := v_SelectSQL || '  NM.Note_Master_Id, NM.Product_Name, NM.Template_ID, NM.Template_Sr_No, NM.Asset, NM.Exchange, NM.Type, NM.Currency';
         --SET @SelectSQL = @SelectSQL + ' , NM.Trade_Date, NM.Value_Date, NM.Valuation_Date, NM.Maturity_Date, NM.Tenor, NM.Strike_Price_Percentage, (case when (NM.Type like '' ELN%'' or NM.Type like ''RELN%'') THEN  NOP.Issue_Price Else NM.Customer_Price End) as Customer_Price, NM.Dealer_Price, (case when (NM.Type like '' ELN%'' or NM.Type like ''RELN%'') THEN  NOP.Customer_Yield Else NM.Customer_Yield End) as Customer_Yield,  NOP.Dealer_Cost_PA as Internal_Cost '
       v_SelectSQL := v_SelectSQL || ' , NM.Trade_Date, NM.Value_Date, NM.Valuation_Date, NM.Maturity_Date, NM.Tenor, NM.Strike_Price_Percentage, (case when (NM.PriceList_YN = ''Y'') THEN  NOP.Issue_Price Else NM.Customer_Price End) as Customer_Price, NM.Dealer_Price, (case when (NM.PriceList_YN = ''Y'') THEN  NOP.Customer_Yield Else NM.Customer_Yield End) as Customer_Yield,  NOP.Dealer_Cost_PA as Internal_Cost ';
       v_SelectSQL := v_SelectSQL || ' , NM.Minimum_Issue_Size, NM.Maximum_Issue_Size, NM.Minimum_Tolerence_Amount, NM.Maximum_Tolerence_Amount, NM.Trigger_Amount_Warning, nvl(NM.PerUnit_Equivalent_Amount,1) as PerUnit_Equivalent_Amount,  NM.Active_YN_Flag, NM.Verify_YN_Flag ';
       v_SelectSQL := v_SelectSQL || ' , NM.Tranche_YN_Flag, NM.Launch_Date, NM.Open_Date, NM.Close_Date, NM.PreHedged_YN, NM.Created_By, NM.Created_At,  NM.Verified_At, NM.Verified_By, NM.ISIN, NM.Issuer';
       v_SelectSQL := v_SelectSQL || ' , NM.Product_Catagory as Product_Category, NM.Note_Issuer_Type as Issuer_Category, NM.Series_No as Series_No, NM.Minimum_Investment_Amount ';
         --Added by Parikshit on 14-Jun-2011, to remove the unwinding amounts from the total issue size
         --SET @SelectSQL = @SelectSQL + ' , NOP.LastTimeWhenProductModified,NOP.Nominal_Amount as Current_Issue_Size, NOP.Filled_Status, NM.Counterparty as Internal_Counterparty  '
       v_SelectSQL := v_SelectSQL || ' , NOP.LastTimeWhenProductModified,(NOP.Nominal_Amount - nvl(ND.Unwind_Amount,0) ) as Current_Issue_Size, NOP.Filled_Status, NM.Counterparty as Internal_Counterparty  ';
         --********************************************************END
       v_SelectSQL := v_SelectSQL || ' ,T2.Confirmed_Amount, T2.Confirmed_Shares';
       v_SelectSQL := v_SelectSQL || ' , T3.Live_Deals';
       v_SelectSQL := v_SelectSQL || ' , BS.Net_Trade_Hedged, BS.Net_Trade_Outstanding, BS.Hedged_Nominal_BUY, BS.Hedged_Nominal_SELL, BS.Outstanding_Nominal_BUY, BS.Outstanding_Nominal_SELL   ';
       v_SelectSQL := v_SelectSQL || ' , ( case    When UPPER(NM.PreHedged_YN) = ''Y'' Then ''Launched'' ';
       v_SelectSQL := v_SelectSQL || '              When ((NM.Maturity_Date IS  NOT NULL) AND to_date(NM.Maturity_Date) <= to_date(sysdate)) Then ''Matured''';
       v_SelectSQL := v_SelectSQL || '              When (UPPER(NM.PreHedged_YN) = ''N'' AND NM.Launch_Date IS NOT NULL)  Then ''Launched''';     
         --Ready to launch
       v_SelectSQL := v_SelectSQL || '              When (UPPER(NM.PreHedged_YN) = ''N'' AND NM.Launch_Date  IS  NULL AND (T2.Confirmed_Amount >= NM.Minimum_Issue_Size) AND  to_date(Close_Date) > to_date(sysdate) ) Then ''Ready To Launch''';     
         --Ready to launch
       v_SelectSQL := v_SelectSQL || '              When (UPPER(NM.PreHedged_YN) = ''N'' AND NM.Launch_Date  IS  NULL AND (T2.Confirmed_Amount >= (NM.Minimum_Issue_Size - NM.Minimum_Tolerence_Amount)) AND  to_date(Close_Date)= to_date(sysdate)    )  Then ''Ready To Launch''';     
       v_SelectSQL := v_SelectSQL || '              When (UPPER(NM.PreHedged_YN) = ''N'' AND NM.Launch_Date  IS  NULL AND (T2.Confirmed_Amount >= (NM.Minimum_Issue_Size - NM.Minimum_Tolerence_Amount)) AND  to_date(Close_Date)< to_date(sysdate)    )  Then ''Ready To Launch''';     
         --Warning trigger reached
       v_SelectSQL := v_SelectSQL || '              When (UPPER(NM.PreHedged_YN) = ''N'' AND NM.Launch_Date IS  NOT NULL AND (T2.Confirmed_Amount >= NM.Trigger_Amount_Warning ))  Then ''Warning Trigger Reached''';          
       v_SelectSQL := v_SelectSQL || '              Else ''Not Ready'' ';
       v_SelectSQL := v_SelectSQL || '              End)Launch_Status';
       v_SelectSQL := v_SelectSQL || ' , NI.Issuer_Code';
          v_SelectSQL := v_SelectSQL || ' , (nvl(NOP.Nominal_Amount,0) - nvl(T2.Confirmed_Amount,0)) as Unconfirmed_Amount, NM.Upfront as Upfront,   case when UPPER(NM.PreHedged_YN) = ''Y'' THEN 0 else (nvl(T2.Confirmed_Amount,0) - nvl(BS.Net_Trade_Hedged,0)) end as ReadyToHedge';
          v_SelectSQL := v_SelectSQL || ' , NOP.Hard_Margin  as Margin_Amount, NM.YearBasis as YearBasis, NM.Note_Product_Rating as Equity_Risk_Score, AD.Equity_Asset_Class ';
          v_SelectSQL := v_SelectSQL || '  , NM.Note_Product_Rating as Product_Rating,  NOP.PO_ID, AD.LotSize as Lot_Size, NM.Max_Orders_Per_Product as MAX_Orders, NOP.Order_Count as Current_Order_Count,  nvl(NM.Denomination_Ccy,NM.Currency) as Denomination_Ccy, NM.Note_Scheme_Type as Underlying_Type, NM.Note_Asset_Class as Asset_Class, NULL as Product_Created_YN, NULL as Product_Created_ID,  ( (case when NM.Note_Order_Type = '''' then N''Market'' else NM.Note_Order_Type end )  ) as  Order_Type, NOP.Spot_Price, NM.Note_Price_Link, NOP.Strike_Price, NVL(NM.C_Fixing_Frequency,''Atmaturity'') as Fixing_Frequency, NM.Document_Uploaded_YN, NM.Document_Uploaded_At, NM.Document_Uploaded_By, NM.Document_File_Name, NM.Document_File_Extension, NM.Document_File_Path, NM.CutOff_Time, NM.Soft_Tenor, NM.NM_Sn_Code_All, NULL as Note_Price_Source, AD.LongName, NVL(NM.Pricelist_YN,''N'') as Pricelist_YN, AD.AlternateIdentifierAlias as Underlying, NM.Note_Issuer_Date_Offset, NM.Counterparty as Note_Counter_Party, NULL as
    Note_Premium_PC  ';
       v_SelectSQL := v_SelectSQL || '  , NI.Issuer_Name, IP.Issuer_Id, IP.Broad_Cash, IP.Odd_Cash, IP.Account_Note, IP.Rounding, IP.Decimal_Truncate, IP.Misc1 as Recidual_YN, NM.Note_Issuer_Type, NM.Target_Coupon, C_Fixing_Frequency as C_Fixing_Frequency, NM.Callable_Frequency as Callable_Frequency, NM.Strike_Price_Percentage as C_Note_Strike_PC, NM.NM_Airbag_PC as  Airbag_PC, C_Note_Barrier_PC as C_Note_Barrier_PC, TM.Template_Name, ''Product'' as Record_Type, NM.C_Settlement_Frequency, NM.Coupon_Frequency, NM.NM_Fixing_Source as Note_Fixing_Source, NM.Order_Entry_Type, (nvl(NM.Minimum_Issue_Size,0) - nvl(T2.Confirmed_Amount,0)) as Remaining_Launch_Amount, NM.C_Fixing_Start_Point, NM.C_Fixing_End_Point, NM.Order_Entry_Type, SC.Scheme_Alias, SC.Scheme_Name, CM.CM_ID, CM.CM_Name as Counterparty_Name, NM.NM_Other_Features as Other_Features, NM.Strike_Price_Percentage as Accrual_Strike, NM.NM_KnockIn as KnockIn, NM.NM_Airbag_Type, NM.NM_Put_strike as Put_Strike, NM.NM_Accrual_Strike,
    NM.NM_Counterparty_Upfront,  NM.Price_Updated_YN as Prices_Updated_YN, AD.Code as Asset_Name,NULL as KO_FREQ_TYPE, NM.Daily_Accumalation_Equities, NM.MaxNoAcc_days, NM.Guaranteed_Days, NM.Leverage_ratio, NM.NORM_IF, NM.NORM_PAIR, NM.NORM_FXRate ';
       v_SelectSQL := v_SelectSQL || ' from ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName|| '.Note_Master NM  ';
       v_SelectSQL := v_SelectSQL || 'Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Issuer_Master NI ';
          v_SelectSQL := v_SelectSQL || ' On NM.Issuer = (case when  ISNUMERIC(NM.Issuer) = 0  then  cast (NI.Issuer_Name as nvarchar2(25))  else  cast(NI.Issuer_Id as nvarchar2(25)) end )';     
       v_SelectSQL := v_SelectSQL || ' Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Note_Order_Product NOP ';
       v_SelectSQL := v_SelectSQL || ' On NOP.Note_Master_ID = NM.Note_Master_ID';
       v_SelectSQL := v_SelectSQL || ' Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_DefinitionDBName||'.AssetDef AD ';
       v_SelectSQL := v_SelectSQL || ' On AD.Code = NM.Asset';
         v_SelectSQL := v_SelectSQL || ' AND AD.TypeAsset  = substr(NM.Note_Asset_Class,1,2) ';
       v_SelectSQL := v_SelectSQL || ' Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Issuer_Parameter IP ';
          v_SelectSQL := v_SelectSQL || ' On NM.Issuer = (case when  ISNUMERIC(NM.Issuer) = 0  then  cast (IP.Issuer_Name as nvarchar2(25))  else  cast(IP.Issuer_Id as nvarchar2(25)) end )';
       v_SelectSQL := v_SelectSQL || ' Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Template_Master TM ';
       v_SelectSQL := v_SelectSQL || ' On  TM.Template_Id =  NM.Template_ID ';
       v_SelectSQL := v_SelectSQL || ' Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Scheme_Codes SC ';
       v_SelectSQL := v_SelectSQL || ' On  SC.Scheme_Alias =  NM.Type';     
       v_SelectSQL := v_SelectSQL || ' Left Outer Join ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Counterparty_Master CM ';
       v_SelectSQL := v_SelectSQL || ' On  CM.CM_ID =  NM.Counterparty';     
          v_SelectSQL := v_SelectSQL || ' Left Outer Join      ';
       v_SelectSQL := v_SelectSQL || ' ( ';
       v_SelectSQL := v_SelectSQL || ' Select Note_master_ID, sum(Nominal_Amt) as Unwind_Amount from ';
       v_SelectSQL := v_SelectSQL || v_CommonDBName||'.Note_Deals ';
       v_SelectSQL := v_SelectSQL || ' where Prematurity_Date IS NOT NULL';
       v_SelectSQL := v_SelectSQL || ' AND (UPPER(Deletion_Reason ) = ''PART REDEMPTION'' or UPPER(Deletion_Reason ) = ''FULL REDEMPTION'')';
       v_SelectSQL := v_SelectSQL || ' Group by Note_master_ID ';
       v_SelectSQL := v_SelectSQL || ' ) ND ';
       v_SelectSQL := v_SelectSQL || ' On  ND.Note_Master_ID =  NM.Note_Master_ID';
    if  (v_Filter_FilledStatus = ' ' OR UPPER(v_Filter_FilledStatus) = 'ALL' ) then
          v_SelectSQL := v_SelectSQL || ' ';
       else
          v_SelectSQL := v_SelectSQL || ' AND NOP.Filled_Status IN (' || v_Filter_FilledStatus  || ')';
       end if;                         
         --AND NOP.Internal_Counterparty = 'DEFAULT''
       if(SUBSTR(to_char(v_Filter_Internal_Counterparty),1,4000)= ' ')  then
          v_SelectSQL := v_SelectSQL || ' ';
       else
          v_SelectSQL := v_SelectSQL || ' AND NOP.Internal_Counterparty IN (' || v_Filter_Internal_Counterparty || ')';
       end if;                    
         --SET @SelectSQL = @SelectSQL + ' --Filter--'
       v_SelectSQL := v_SelectSQL || ' LEFT OUTER JOIN ';
       v_SelectSQL := v_SelectSQL || ' (';
       v_SelectSQL := v_SelectSQL || '   select Note_Master_ID, sum(Nominal_Amount) As Confirmed_Amount, sum(No_Of_Shares)  As Confirmed_Shares  ';
       v_SelectSQL := v_SelectSQL || '   from '||v_CommonDBName||'.Note_Order_RM  ';
       v_SelectSQL := v_SelectSQL || '   Where substr(UPPER(Order_Status_Flag),1,6) = ''YYYYYY'' AND substr(substr(UPPER(Order_Status_Flag),1,7),-1,1) = ''N'' ';
       v_SelectSQL := v_SelectSQL || '   group by  Note_Master_ID';
       v_SelectSQL := v_SelectSQL || ' ) T2';
       v_SelectSQL := v_SelectSQL || ' ON T2.Note_Master_ID = NM.Note_Master_ID';
       v_SelectSQL := v_SelectSQL || ' LEFT OUTER JOIN';
       v_SelectSQL := v_SelectSQL || ' (';
       v_SelectSQL := v_SelectSQL || '   Select ND.Note_Master_ID, sum(ND.Nominal_Amt) As Live_Deals ';
       v_SelectSQL := v_SelectSQL || '   from '||v_CommonDBName||'.Note_Deals ND  ';
       v_SelectSQL := v_SelectSQL || '   where ND.Active_YNFlag = ''Y'' ';
       v_SelectSQL := v_SelectSQL || '   group by  Note_Master_ID';
       v_SelectSQL := v_SelectSQL || ' ) T3';
       v_SelectSQL := v_SelectSQL || ' ON T3.Note_Master_ID = NM.Note_Master_ID';
       v_SelectSQL := v_SelectSQL || '  LEFT OUTER JOIN';
       v_SelectSQL := v_SelectSQL || '  (';
       v_SelectSQL := v_SelectSQL || '  SELECT NH_Note_Master_ID,';
       v_SelectSQL := v_SelectSQL || '  (CAST(SUM(Hedged_Nominal_Buy) AS BINARY_FLOAT) -CAST(SUM(Hedged_Nominal_Sell) AS BINARY_FLOAT))  Net_Trade_Hedged,';
       v_SelectSQL := v_SelectSQL || '  (CAST(SUM(Outstanding_Nominal_BUY) AS BINARY_FLOAT) -CAST(SUM(Outstanding_Nominal_SELL) AS BINARY_FLOAT))  Net_Trade_Outstanding,';
       v_SelectSQL := v_SelectSQL || '  SUM(Hedged_Nominal_BUY) AS Hedged_Nominal_BUY,';
       v_SelectSQL := v_SelectSQL || '  SUM(Hedged_Nominal_SELL) AS Hedged_Nominal_SELL,';
       v_SelectSQL := v_SelectSQL || '  SUM(Outstanding_Nominal_BUY) AS Outstanding_Nominal_BUY,';
       v_SelectSQL := v_SelectSQL || '  SUM(Outstanding_Nominal_SELL) As Outstanding_Nominal_SELL';
       v_SelectSQL := v_SelectSQL || '  From';
       v_SelectSQL := v_SelectSQL || '  (';
       v_SelectSQL := v_SelectSQL || '  SELECT NH_Note_Master_ID,';
       v_SelectSQL := v_SelectSQL || '  SUM(NH_Hedged_Nominal) AS Hedged_Nominal_BUY, 0 AS Hedged_Nominal_SELL,';
       v_SelectSQL := v_SelectSQL || '  SUM(NH_Outstanding_Nominal) AS Outstanding_Nominal_BUY, 0 AS Outstanding_Nominal_SELL';
       v_SelectSQL := v_SelectSQL || '  FROM '||v_CommonDBName||'.Note_Hedge  ';
       v_SelectSQL := v_SelectSQL || '  WHERE NH_Direction = ''BUY'' ';
       v_SelectSQL := v_SelectSQL || '  GROUP BY NH_Note_Master_ID';
       v_SelectSQL := v_SelectSQL || '  Union';
       v_SelectSQL := v_SelectSQL || '  SELECT NH_Note_Master_ID,';
       v_SelectSQL := v_SelectSQL || '  0 AS Hedged_Nominal_BUY, SUM(NH_Hedged_Nominal) AS Hedged_Nominal_SELL,';
       v_SelectSQL := v_SelectSQL || '  0 AS Outstanding_Nominal_BUY, SUM(NH_Outstanding_Nominal) AS Outstanding_Nominal_SELL';
       v_SelectSQL := v_SelectSQL || '  FROM '||v_CommonDBName||'.Note_Hedge  ';
       v_SelectSQL := v_SelectSQL || '  WHERE NH_Direction = ''SELL''  ';
       v_SelectSQL := v_SelectSQL || '  GROUP BY NH_Note_Master_ID';
       v_SelectSQL := v_SelectSQL || '  ) ';
       v_SelectSQL := v_SelectSQL || '  GROUP BY NH_Note_Master_ID';
       v_SelectSQL := v_SelectSQL || '  ) BS';
       v_SelectSQL := v_SelectSQL || '  ON BS.NH_Note_Master_ID = NM.Note_Master_ID';
       v_SelectSQL := v_SelectSQL || ' Where NM.Verify_YN_Flag = ''Y'' ';
      v_SelectSQL := v_SelectSQL || ' AND NM.Active_YN_Flag = ''' || SWV_Active_YN_Flag || '''';
       if(SUBSTR(to_char(v_Filter_NoteType),1,4000) = ' ' OR UPPER(v_Filter_NoteType) = 'ALL' ) then
               v_SelectSQL := v_SelectSQL || ' ';
       else
          v_SelectSQL := v_SelectSQL || ' AND NM.Type IN (' || v_Filter_NoteType  || ')';
       end if;     
    IF UPPER(v_Entity_ID) <> 'ALL'  then
          OPEN RestrictTermsheetVisibilityByC;
          FETCH RestrictTermsheetVisibilityByC INTO v_Setting_Name,v_Default_Value,v_Config_Value;
          WHILE RestrictTermsheetVisibilityByC%FOUND   LOOP
         --2) Convert comma separated ccy (CNY,HKD,USD) string to single quote ccy with comma separated Ccy ('CNY','HKD','USD') string
             if (UPPER(v_Setting_Name) = 'RESTRICT_TERMSHEET_VISIBILITY_BY_CCY')  then
                if v_Config_Value is not null  then
              SELECT COUNT(Id_1) INTO SWV_fnc_SplitString_Id_var0 FROM TABLE(fnc_SplitString(v_Config_Value,',')) ;
                   IF (SWV_fnc_SplitString_Id_var0 > 0)  then
                        --print 'Before Single  quote separated ccy : ' + '''' + @Config_Value + ''''
                      v_Seq_Id := 0;
                      OPEN Get_RestrictCCY_List_Cursor;
                      FETCH Get_RestrictCCY_List_Cursor
                      INTO v_CCY_ID,v_CCY_Data;
                      WHILE Get_RestrictCCY_List_Cursor%FOUND   LOOP
                         if v_Seq_Id = 0  then
                            v_CCY_List := '''' || v_CCY_Data || '''';
                         else
                            v_CCY_List := v_CCY_List || ',' || '''' || v_CCY_Data || '''';
                         end if;
                         v_Seq_Id := v_Seq_Id+1;
                         FETCH Get_RestrictCCY_List_Cursor INTO v_CCY_ID,v_CCY_Data;
                      END LOOP;
                      CLOSE Get_RestrictCCY_List_Cursor;
                        --print 'After Single quote ccy : ' + @CCY_List
                      v_SelectSQL := v_SelectSQL || ' AND nvl(NM.Denomination_Ccy,NM.Currency) NOT IN (' || v_CCY_List   || ')';
                   end if;
                end if;
             end if;
    --3) Convert comma separated template (ELN,BELN,BELN_B) string to single quote template code with comma separated template ('ELN','BELN','BELN_B') string
             if (UPPER(v_Setting_Name) = 'RESTRICT_TERMSHEET_VISIBILITY_BY_SUBSCHEME')  then
                if v_Config_Value is not null then
          SELECT COUNT(Id_1) INTO SWV_fnc_SplitString_Id_var1 FROM TABLE(fnc_SplitString(v_Config_Value,',')) ;
                   IF (SWV_fnc_SplitString_Id_var1 > 0)  then
                      v_Seq_Id := 0;
                      OPEN GetRestrictTemplateListCursor;
                      FETCH GetRestrictTemplateListCursor
                      INTO v_CCY_ID,v_CCY_Data;
                      WHILE GetRestrictTemplateListCursor%FOUND 
                      LOOP
                         if v_Seq_Id = 0  then
                            v_CCY_List := '''' || v_CCY_Data || '''';
                         else
                            v_CCY_List := v_CCY_List || ',' || '''' || v_CCY_Data || '''';
                         end if;
                         v_Seq_Id := v_Seq_Id+1;
                         FETCH GetRestrictTemplateListCursor INTO v_CCY_ID,v_CCY_Data;
                      END LOOP;
                      CLOSE GetRestrictTemplateListCursor;
                   --print 'After Single quote template code: ' + @CCY_List
                      v_SelectSQL := v_SelectSQL || ' AND TM.Template_Code NOT IN (' || v_CCY_List   || ')';
                   end if;
                end if;
             end if;
             FETCH RestrictTermsheetVisibilityByC INTO v_Setting_Name,v_Default_Value,v_Config_Value;
          END LOOP;
          CLOSE RestrictTermsheetVisibilityByC;
       end if;
      if  (v_Filter_Exchange = ' ' OR UPPER(v_Filter_Exchange) = 'ALL')  then
          v_SelectSQL := v_SelectSQL || ' ';
       else
          v_SelectSQL := v_SelectSQL || ' AND NM.Exchange IN (' || v_Filter_Exchange  || ')';
       end if;                         
         --SET @SelectSQL = @SelectSQL + ' --AND NM.Issuer = 4'
      if  (v_Filter_Issuer = ' ' OR UPPER(v_Filter_Issuer) = 'ALL') then
          v_SelectSQL := v_SelectSQL || ' ';
       else
          v_SelectSQL := v_SelectSQL || ' AND NM.Issuer IN (' || v_Filter_Issuer  || ')';
       end if;     
          if  v_Filter_Product_Category    = ' '  then
          v_SelectSQL := v_SelectSQL || ' ';
       else
          v_SelectSQL := v_SelectSQL || ' AND UPPER(NM.Note_Issuer_Type) IN (''' || v_Filter_Product_Category  || ''')';
       end if;          
       if UPPER(v_DateToFilter) = 'NA'  then
          v_SelectSQL := v_SelectSQL || ' ';
       else
          if UPPER(v_DateToFilter) = 'CLOSE_DATE'  then
             v_SelectSQL := v_SelectSQL || ' AND to_char( '|| v_DateToFilter || ') >= to_date(''' || v_Filter_ToDate ||  ''');
                             -- AND convert(smalldatetime,''' || v_Filter_ToDate || ''',106) ';
          else
             v_SelectSQL := v_SelectSQL || ' AND to_char(''' || v_DateToFilter || ''') BETWEEN to_date(''' || v_Filter_FromDate ||  ''') AND to_date(''' || v_Filter_ToDate || ''') ';
          end if;
       end if;
       v_SelectSQL := v_SelectSQL || ' Order by NM.Product_Name';
       SWV_VarStr := v_SelectSQL;
       DBMS_OUTPUT.PUT_LINE(SWV_VarStr);
       EXECUTE IMMEDIATE SWV_VarStr;
       IF SQLCODE <> 0  then
          GOTO ERROR_HANDLER;
       end if;
       IF SQL%rowcount > 0  then
          COMMIT;
          SWV_TRANCOUNT := SWV_TRANCOUNT -1;
       end if;     --Commit Transaction
       v_ErrorNumber := SQLCODE;
       RETURN;
       << ERROR_HANDLER >> v_ErrorNumber := SQLCODE;
       ROLLBACK;
       SWV_TRANCOUNT := 0;     --Rollback Transaction
       RETURN;
    END;Please suggest something. Thanks
    Edited by: BluShadow on 30-Nov-2011 11:00
    added {noformat}{noformat} tags for formatting of code.  Please read {message:id=9360002} to learn to do this yourself in future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Connecting to the database sample_adf_finiq_common.
    Select NM.Note_Master_Id, NM.Product_Name, NM.Template_ID, NM.Template_Sr_No, NM.Asset, NM.Exchange, NM.Type, NM.Currency , NM.Trade_Date, NM.Value_Date, NM.Valuation_Date, NM.Maturity_Date, NM.Tenor, NM.Strike_Price_Percentage, (case when (NM.PriceList_YN = 'Y') THEN NOP.Issue_Price Else NM.Customer_Price End) as Customer_Price, NM.Dealer_Price, (case when (NM.PriceList_YN = 'Y') THEN NOP.Customer_Yield Else NM.Customer_Yield End) as Customer_Yield, NOP.Dealer_Cost_PA as Internal_Cost , NM.Minimum_Issue_Size, NM.Maximum_Issue_Size, NM.Minimum_Tolerence_Amount, NM.Maximum_Tolerence_Amount, NM.Trigger_Amount_Warning, nvl(NM.PerUnit_Equivalent_Amount,1) as PerUnit_Equivalent_Amount, NM.Active_YN_Flag, NM.Verify_YN_Flag , NM.Tranche_YN_Flag, NM.Launch_Date, NM.Open_Date, NM.Close_Date, NM.PreHedged_YN, NM.Created_By, NM.Created_At, NM.Verified_At, NM.Verified_By, NM.ISIN, NM.Issuer , NM.Product_Catagory as Product_Category, NM.Note_Issuer_Type as Issuer_Category, NM.Series_No as Series_No, NM.Minimum_Investment_Amount , NOP.LastTimeWhenProductModified,(NOP.Nominal_Amount - nvl(ND.Unwind_Amount,0) ) as Current_Issue_Size, NOP.Filled_Status, NM.Counterparty as Internal_Counterparty ,T2.Confirmed_Amount, T2.Confirmed_Shares , T3.Live_Deals , BS.Net_Trade_Hedged, BS.Net_Trade_Outstanding, BS.Hedged_Nominal_BUY, BS.Hedged_Nominal_SELL, BS.Outstanding_Nominal_BUY, BS.Outstanding_Nominal_SELL , ( case When UPPER(NM.PreHedged_YN) = 'Y' Then 'Launched' When ((NM.Maturity_Date IS NOT NULL) AND to_date(NM.Maturity_Date) <= to_date(sysdate)) Then 'Matured' When (UPPER(NM.PreHedged_YN) = 'N' AND NM.Launch_Date IS NOT NULL) Then 'Launched' When (UPPER(NM.PreHedged_YN) = 'N' AND NM.Launch_Date IS NULL AND (T2.Confirmed_Amount >= NM.Minimum_Issue_Size) AND to_date(Close_Date) > to_date(sysdate) ) Then 'Ready To Launch' When (UPPER(NM.PreHedged_YN) = 'N' AND NM.Launch_Date IS NULL AND (T2.Confirmed_Amount >= (NM.Minimum_Issue_Size - NM.Minimum_Tolerence_Amount)) AND to_date(Close_Date)= to_date(sysdate) ) Then 'Ready To Launch' When (UPPER(NM.PreHedged_YN) = 'N' AND NM.Launch_Date IS NULL AND (T2.Confirmed_Amount >= (NM.Minimum_Issue_Size - NM.Minimum_Tolerence_Amount)) AND to_date(Close_Date)< to_date(sysdate) ) Then 'Ready To Launch' When (UPPER(NM.PreHedged_YN) = 'N' AND NM.Launch_Date IS NOT NULL AND (T2.Confirmed_Amount >= NM.Trigger_Amount_Warning )) Then 'Warning Trigger Reached' Else 'Not Ready' End)Launch_Status , NI.Issuer_Code , (nvl(NOP.Nominal_Amount,0) - nvl(T2.Confirmed_Amount,0)) as Unconfirmed_Amount, NM.Upfront as Upfront, case when UPPER(NM.PreHedged_YN) = 'Y' THEN 0 else (nvl(T2.Confirmed_Amount,0) - nvl(BS.Net_Trade_Hedged,0)) end as ReadyToHedge , NOP.Hard_Margin as Margin_Amount, NM.YearBasis as YearBasis, NM.Note_Product_Rating as Equity_Risk_Score, AD.Equity_Asset_Class , NM.Note_Product_Rating as Product_Rating, NOP.PO_ID, AD.LotSize as Lot_Size, NM.Max_Orders_Per_Product as MAX_Orders, NOP.Order_Count as Current_Order_Count, nvl(NM.Denomination_Ccy,NM.Currency) as Denomination_Ccy, NM.Note_Scheme_Type as Underlying_Type, NM.Note_Asset_Class as Asset_Class, NULL as Product_Created_YN, NULL as Product_Created_ID, ( (case when NM.Note_Order_Type = '' then N'Market' else NM.Note_Order_Type end ) ) as Order_Type, NOP.Spot_Price, NM.Note_Price_Link, NOP.Strike_Price, NVL(NM.C_Fixing_Frequency,'Atmaturity') as Fixing_Frequency, NM.Document_Uploaded_YN, NM.Document_Uploaded_At, NM.Document_Uploaded_By, NM.Document_File_Name, NM.Document_File_Extension, NM.Document_File_Path, NM.CutOff_Time, NM.Soft_Tenor, NM.NM_Sn_Code_All, NULL as Note_Price_Source, AD.LongName, NVL(NM.Pricelist_YN,'N') as Pricelist_YN, AD.AlternateIdentifierAlias as Underlying, NM.Note_Issuer_Date_Offset, NM.Counterparty as Note_Counter_Party, NULL as
    Note_Premium_PC , NI.Issuer_Name, IP.Issuer_Id, IP.Broad_Cash, IP.Odd_Cash, IP.Account_Note, IP.Rounding, IP.Decimal_Truncate, IP.Misc1 as Recidual_YN, NM.Note_Issuer_Type, NM.Target_Coupon, C_Fixing_Frequency as C_Fixing_Frequency, NM.Callable_Frequency as Callable_Frequency, NM.Strike_Price_Percentage as C_Note_Strike_PC, NM.NM_Airbag_PC as Airbag_PC, C_Note_Barrier_PC as C_Note_Barrier_PC, TM.Template_Name, 'Product' as Record_Type, NM.C_Settlement_Frequency, NM.Coupon_Frequency, NM.NM_Fixing_Source as Note_Fixing_Source, NM.Order_Entry_Type, (nvl(NM.Minimum_Issue_Size,0) - nvl(T2.Confirmed_Amount,0)) as Remaining_Launch_Amount, NM.C_Fixing_Start_Point, NM.C_Fixing_End_Point, NM.Order_Entry_Type, SC.Scheme_Alias, SC.Scheme_Name, CM.CM_ID, CM.CM_Name as Counterparty_Name, NM.NM_Other_Features as Other_Features, NM.Strike_Price_Percentage as Accrual_Strike, NM.NM_KnockIn as KnockIn, NM.NM_Airbag_Type, NM.NM_Put_strike as Put_Strike, NM.NM_Accrual_Strike,
    NM.NM_Counterparty_Upfront, NM.Price_Updated_YN as Prices_Updated_YN, AD.Code as Asset_Name,NULL as KO_FREQ_TYPE, NM.Daily_Accumalation_Equities, NM.MaxNoAcc_days, NM.Guaranteed_Days, NM.Leverage_ratio, NM.NORM_IF, NM.NORM_PAIR, NM.NORM_FXRate from Sample_ADF_finiq_Common.Note_Master NM Left Outer Join Sample_ADF_finiq_Common.Issuer_Master NI On NM.Issuer = (case when ISNUMERIC(NM.Issuer) = 0 then cast (NI.Issuer_Name as nvarchar2(25)) else cast(NI.Issuer_Id as nvarchar2(25)) end ) Left Outer Join Sample_ADF_finiq_Common.Note_Order_Product NOP On NOP.Note_Master_ID = NM.Note_Master_ID Left Outer Join Sample_ADF_finiq_Common.AssetDef AD On AD.Code = NM.Asset AND AD.TypeAsset = substr(NM.Note_Asset_Class,1,2) Left Outer Join Sample_ADF_finiq_Common.Issuer_Parameter IP On NM.Issuer = (case when ISNUMERIC(NM.Issuer) = 0 then cast (IP.Issuer_Name as nvarchar2(25)) else cast(IP.Issuer_Id as nvarchar2(25)) end ) Left Outer Join Sample_ADF_finiq_Common.Template_Master TM On TM.Template_Id = NM.Template_ID Left Outer Join Sample_ADF_finiq_Common.Scheme_Codes SC On SC.Scheme_Alias = NM.Type Left Outer Join Sample_ADF_finiq_Common.Counterparty_Master CM On CM.CM_ID = NM.Counterparty Left Outer Join      ( Select Note_master_ID, sum(Nominal_Amt) as Unwind_Amount from Sample_ADF_finiq_Common.Note_Deals where Prematurity_Date IS NOT NULL AND (UPPER(Deletion_Reason ) = 'PART REDEMPTION' or UPPER(Deletion_Reason ) = 'FULL REDEMPTION') Group by Note_master_ID ) ND On ND.Note_Master_ID = NM.Note_Master_ID AND NOP.Internal_Counterparty IN (1) LEFT OUTER JOIN ( select Note_Master_ID, sum(Nominal_Amount) As Confirmed_Amount, sum(No_Of_Shares) As Confirmed_Shares from Sample_ADF_finiq_Common.Note_Order_RM Where substr(UPPER(Order_Status_Flag),1,6) = 'YYYYYY' AND substr(substr(UPPER(Order_Status_Flag),1,7),-1,1) = 'N' group by Note_Master_ID ) T2 ON T2.Note_Master_ID = NM.Note_Master_ID LEFT OUTER JOIN ( Select ND.Note_Master_ID, sum(ND.Nominal_Amt) As Live_Deals from Sample_ADF_finiq_Common.Note_Deals ND where ND.Active_YNFlag = 'Y' group by Note_Master_ID ) T3 ON T3.Note_Master_ID = NM.Note_Master_ID LEFT OUTER JOIN ( SELECT NH_Note_Master_ID, (CAST(SUM(Hedged_Nominal_Buy) AS BINARY_FLOAT) -CAST(SUM(Hedged_Nominal_Sell) AS BINARY_FLOAT)) Net_Trade_Hedged, (CAST(SUM(Outstanding_Nominal_BUY) AS BINARY_FLOAT) -CAST(SUM(Outstanding_Nominal_SELL) AS BINARY_FLOAT)) Net_Trade_Outstanding, SUM(Hedged_Nominal_BUY) AS Hedged_Nominal_BUY, SUM(Hedged_Nominal_SELL) AS Hedged_Nominal_SELL, SUM(Outstanding_Nominal_BUY) AS Outstanding_Nominal_BUY, SUM(Outstanding_Nominal_SELL) As Outstanding_Nominal_SELL From ( SELECT NH_Note_Master_ID, SUM(NH_Hedged_Nominal) AS Hedged_Nominal_BUY, 0 AS Hedged_Nominal_SELL, SUM(NH_Outstanding_Nominal) AS Outstanding_Nominal_BUY, 0 AS Outstanding_Nominal_SELL FROM Sample_ADF_finiq_Common.Note_Hedge WHERE NH_Direction = 'BUY' GROUP BY NH_Note_Master_ID Union SELECT NH_Note_Master_ID, 0 AS Hedged_Nominal_BUY, SUM(NH_Hedged_Nominal) AS Hedged_Nominal_SELL, 0 AS Outstanding_Nominal_BUY, SUM(NH_Outstanding_Nominal) AS Outstanding_Nominal_SELL FROM Sample_ADF_finiq_Common.Note_Hedge WHERE NH_Direction = 'SELL' GROUP BY NH_Note_Master_ID ) GROUP BY NH_Note_Master_ID ) BS ON BS.NH_Note_Master_ID = NM.Note_Master_ID Where NM.Verify_YN_Flag = 'Y' AND NM.Active_YN_Flag = 'Y' AND UPPER(NM.Note_Issuer_Type) IN ('Internal') AND to_char('16-oct-11') BETWEEN to_date('15-oct-11') AND to_date('17-oct-11') Order by NM.Product_Name
    V_ERRORNUMBER = 0
    Process exited.
    Disconnecting from the database sample_adf_finiq_common.
    here v_errornumber=0 is the output when i run it in oracle sql developer.

  • Performance issues with respect scheme registration,select & insert query

    I am facing performance issues with respect to schema registration,Select & insert query towards 10.2.0.3 version.It is taking around 45 minutes to register schema and it is taking around 5 min to insert a single document into xml db where as it was taking less than min to insert a single document into xml db of 9.2.0.6 version.Would like to know the issue and solution to resolve this issue.Please help me out on this as it is very urgent for me

    Since it appears that this is an XML DB specific question, you're probably better off posting in the XML DB. The folks over there have much more experience with the ins and outs of that particular product.
    Justin

  • Issue with "Select Distinct" query in Oracle 10g against Oracle 9i

    Hi,
    I would appreciate if some one help me here because it is really urgent.
    We are upgrading our database from 9i to 10g.
    There are the "Select distinct" queries in the code which populated the grid on the applications screens. We found a difference in 9i and 10g the way the result is populated for these queries. If "Select Distinct" query wihtout a order by clause is executed in 9i then the result is automatically sorted. But Oracle 10g does not do this.
    We can change the queries adding order by clause but we are almost at the end of the testing and want to know if there is any way that we can do this from database settings. Would there be any impact of these settings change on overall operation of Oracle 10g?
    I would appreciate if some one can help me here.
    Thanks,
    Dinesh

    then the result is automatically sorted.No. Oracle may have done a sort operation to perform the distinct, but it still did not guarantee the order of your results.
    In 10g and in 9i, if you want your results in a certain order you must use order by.

  • Sub-Select SQL query in Oracle BI Answers

    Hi
    What's the proper usage of Sub-Select SQL query in Oracle BI Answers Version Oracle Business Intelligence 10.1.3.2.1?
    I get [SQL_STATE: HY000] [nQSError: 10058] A general error has occured when trying to Sub Select query like:
    itemno = (SELECT MIN(orders.itemno) FROM mydatabase where rownum < 2 order by orders.itemno)

    Maybe the best is to create a new physical and logical object for your sub-select and join this with your current objects.

  • Select List (query based LOV) in a wizard created report form

    I have created an updatable report form with 3 columns:
    app_id
    user_id
    group_id
    Each app_id has multiple group_id's associated with it, and I want to show the group_id field as a Select List (query based LOV) that contains the groups associated with the app_id.
    My query for the select list needs to be similar to the following:
    SELECT DISPLAY_NAME, GROUP_ID
    FROM APPLICATION_GROUPS
    WHERE APP_ID = ?????
    ORDER BY 1
    The problem is, I don't know how to reference the app_id from the main report to replace the ?????.
    In other words, if my report returns 2 rows of data like this:
    app_id----------user_id----------group_id
    1-----------------24------------------3
    2-----------------24------------------15
    Then how do I get the group_id column to be a select list of possible groups for each application? If app_id 1 has 3 groups associated with it, 3, 4, & 5 and app_id 2 has 2 groups associated with it, 15 & 16, then those each of the select lists should be based on the app_id.
    Hopefully I explained this clearly.
    Thanks,
    Kris

    Leo,
    Thanks for the response, but I don't think you quite understand my problem. If I go to the Column Attributes screen for the group_id field, I have the "Display As" drop down set to "Select List (query based LOV)", not "Select List (named LOV)". This requires that the sql query be written in the "List of values definition" text area below. Within that text area I have the following query:
    SELECT DISPLAY_NAME, GROUP_ID
    FROM APPLICATION_GROUPS
    WHERE APP_ID = ?????
    ORDER BY 1
    The APP_ID that I need to reference is for the current row of data that is being processed. Therefore, I can't use a :PNNN_APP_ID variable, because that field does not exist on the page.
    Hopefully this explains it a little better.
    Thanks,
    Kris

  • A way to convert selection from query builder in DML language

    I search a way to convert selection from query builder in DML language.
    regards

    We will make a sample from this request and post it on OTN. I have pasted all the JSP code so you should be able to use it directly. Just change the BISession details and the presentation references.
    <%@ taglib uri="http://xmlns.oracle.com/bibeans" prefix="orabi" %>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.util.Vector" %>
    <%@ page import="oracle.dss.thin.beans.crosstab.ThinCrosstab" %>
    <%@ page import="oracle.dss.util.DataAccess" %>
    <%@ page import="oracle.dss.selection.Selection" %>
    <%@ page import="oracle.dss.thin.beans.graph.ThinGraph" %>
    <%@ page import="oracle.dss.dataSource.client.QueryClient"%>
    <%-- Start synchronization of the BI tags --%>
    <% synchronized(session){ %>
    <orabi:BIThinSession id="BIThinSession1" configuration="/Project1BIConfig1.xml" >
    <orabi:Presentation id="untitled2_Presentation1" location="Presentation1" />
    <orabi:Presentation id="untitled2_Presentation2" location="Presentation2" />
    </orabi:BIThinSession>
    <%
    String CROSSTAB_ID = "untitled2_Presentation2";
    String GRAPH_ID = "untitled2_Presentation1";
    String MYProducts = "Nothing";
    String prodID = "MDM!D_CS_OLAP.SHAWPRODUCTS";
    //Find the crosstab object on the page
    Object crosstabObject = pageContext.findAttribute(CROSSTAB_ID);
    ThinCrosstab thinCrosstab = (ThinCrosstab)crosstabObject;
    //Get the various query components from the Crosstab
    QueryClient myQCXtab = (QueryClient)thinCrosstab.getDataSource();
    Selection mySelXtab = myQCXtab.findSelection(prodID);
    DataAccess daXtab = myQCXtab.createQueryAccess().getDataAccess(mySelXtab);
    // This is a one-d data access, only has the column edge
    int colExtentXtab = daXtab.getEdgeExtent(oracle.dss.util.DataDirector.COLUMN_EDGE);
    for (int i=0; i<colExtentXtab; i++)
    String memberLabel = (String)daXtab.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_LONGLABEL);
    String memberValue = (String)daXtab.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_VALUE);
    System.out.println(memberLabel + " " + memberValue);
    // As above except for graphs.
    Object graphObject = pageContext.findAttribute(GRAPH_ID);
    ThinGraph thinGraph = (ThinGraph)graphObject;
    QueryClient myQCGraph = (QueryClient)thinGraph.getDataSource();
    Selection mySelGraph = myQCGraph.findSelection(prodID);
    DataAccess daGraph = myQCGraph.createQueryAccess().getDataAccess(mySelGraph);
    // This is a one-d data access, only has the column edge
    int colExtentGraph = daGraph.getEdgeExtent(oracle.dss.util.DataDirector.COLUMN_EDGE);
    for (int i=0; i<colExtentGraph; i++)
    String memberLabel = (String)daGraph.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_LONGLABEL);
    String memberValue = (String)daGraph.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_VALUE);
    System.out.println(memberLabel + " " + memberValue);
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <FORM name="BIForm">
    <!-- Insert your Business Intelligence tags here -->
    <orabi:Render targetId="untitled2_Presentation1" parentForm="BIForm" />
    <orabi:Render targetId="untitled2_Presentation2" parentForm="BIForm" />
    <%-- The InsertHiddenFields tag adds state fields to the parent form tag --%>
    <orabi:InsertHiddenFields parentForm="BIForm" biThinSessionId="BIThinSession1" />
    </FORM>
    <h2>
    The current time is:
    </h2>
    <p>
    <%= new java.util.Date() %></p>
    <input type="text" name="MyTextField" value=MYProducts readonly>
    </body>
    </html>
    <% } %>
    <%-- End synchronization of the BI tags --%>
    Hope this helps
    Business Intelligence Beans Product Management Team
    Oracle Corporation

  • OnChanger="get_ajax_select_xml(this);" with  select list (query named LOV)

    Hello,
    i used Vikas'example Re: cascading lov for tabular form
    i have a problem with Select list (query based LOV)
    when run tabular form i have the following error:
    report error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    the number of rows of the Lov are 900
    the display variable is 70 char
    is there any limit?
    Thank in advance
    Costanti

    Leo,
    Thanks for the response, but I don't think you quite understand my problem. If I go to the Column Attributes screen for the group_id field, I have the "Display As" drop down set to "Select List (query based LOV)", not "Select List (named LOV)". This requires that the sql query be written in the "List of values definition" text area below. Within that text area I have the following query:
    SELECT DISPLAY_NAME, GROUP_ID
    FROM APPLICATION_GROUPS
    WHERE APP_ID = ?????
    ORDER BY 1
    The APP_ID that I need to reference is for the current row of data that is being processed. Therefore, I can't use a :PNNN_APP_ID variable, because that field does not exist on the page.
    Hopefully this explains it a little better.
    Thanks,
    Kris

  • Character string buffer too small (select list query based LOV)

    Hi,
    Using the select list query based LOV with a select witch is too big, you get this error.
    report error:
    ORA-20001: Error fetching column value: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    When using the Popup LOV query based LOV) then it works nice.
    Can that be solved somehow?
    With the Popup LOV the return value is displayed in stead of the description.

    Hi Andy,
    How do I incorporate your suggestion on a report ?
    Example : I have
    select apex_item.display_and_save(1,column1,5) col1,
    apex_item.display_and_save(2,column2,5) col2 ,
    apex_item.popup_from_query(3, emp_name, 'select user_name, name  empname from table2) col3
    Table 2 is a long list , and I'm getting string buffer too small due to this.
    Your suggestion with HTP is good but I'm not sure how to implement it for reports as I'll like the user to change the values with the select_list.
    I'm not using forms as they want mulit-record on the same page.
    Hope to hear back from you soon.
    Thanks very much.

  • Tabular form (select list Query based LOV)

    Hi all,
    I have this situation:
    a tabular form with two "select list (query based LOV)" fields.
    The first one must affect elements in the second one. And so the second query based LOV field should has a "where attr1 = first_list_selected_value" in the query.
    Is this possible ? Could you show me some advices ?
    thanks in advance.

    OK, thank you.
    But maybe I wasn't too clear.
    I need cascading LOV for each row of my tabular form.
    I have a EMP tabular form
    select
    "ROWID",
    "EMPNO",
    "ENAME",
    "JOB",
    "MGR",
    "HIREDATE",
    "SAL",
    "COMM",
    "DEPTNO"
    from "#OWNER#"."EMP" I need a Select List for DEPTNO for each record of table. After set a value, the second "Select List" for ENAME should be affected automatically.

  • Select List (query based LOV) in V. 4.1.1.00.23

    Hi guys,
    I am having some problems with an APEX application that I have exported from V. 4.1.0.00.32 and imported on V. 4.1.1.00.23.
    I have a Tabular Form region where I have a column which is Display As "Select List (Query based LOV)".
    If I add a new row - choose a new value (not the same as any of the above rows) and "Apply Changes"/"Submit" the value in the new row changes to the value of the 1. row of the tabular form :-( I can update this new row and then it saves the right value... It looks like it is only when inserting a new row.
    Is this a bug or is it a feature ;-)
    Hope you can help...
    /Rene

    Leo,
    Thanks for the response, but I don't think you quite understand my problem. If I go to the Column Attributes screen for the group_id field, I have the "Display As" drop down set to "Select List (query based LOV)", not "Select List (named LOV)". This requires that the sql query be written in the "List of values definition" text area below. Within that text area I have the following query:
    SELECT DISPLAY_NAME, GROUP_ID
    FROM APPLICATION_GROUPS
    WHERE APP_ID = ?????
    ORDER BY 1
    The APP_ID that I need to reference is for the current row of data that is being processed. Therefore, I can't use a :PNNN_APP_ID variable, because that field does not exist on the page.
    Hopefully this explains it a little better.
    Thanks,
    Kris

  • SELECT IN query using ormExecuteQuery()

    I'm trying to do a SELECT IN query using ormExecuteQuery().  Following is the code I have:
    Categories = ormExecuteQuery("from Category where Id IN (?)",[CategoryList]);
    It only works when there is 1 value in the CategoryList.  i.e. This works:
    Categories = ormExecuteQuery("from Category where Id IN (?)",[9]);
    This DOES NOT work:
    Categories = ormExecuteQuery("from Category where Id IN (?)",[8,9,10]);
    Help would be greatly appreciated.

    This works:
    Categories = ormExecuteQuery("from Category where Id IN (:IdList)",{IdList=ListToArray(CategoryList)});
    Seems like this would too, but it does not.
    Categories = ormExecuteQuery("from Category where Id IN (?)",[ListToArray(CategoryList)]);

  • How to edit the records value fetched by select statement query in sqldever

    How to edit the records value fetched by select statement query in sqldever 2.1.1.
    EX-
    SELECT * FROM emp WHERE ename like 'Jaga%'
    Edited by: user9372056 on Aug 31, 2010 2:16 AM

    Hi,
    Although some forum members may be using that tool, there is still a dedicated forum for SQL Developer.
    SQL Developer
    Maybe your chances are better there.
    Regards
    Peter

  • ADF BC : "Attributes selected in query with no column type found! ..."

    hi
    Using JDeveloper 10.1.3.3.0, I have this "Selected in Query" attribute, "Never" updatable, in my Entity Object.
    The Entity Object is based on the SCOTT.EMP table and the attribute, called "BonusInfo", is defined using the expression " '[bonus info ' || (SAL * 2) || ']' ".
    see http://verveja.footsteps.be/~verveja/files/oracle/NoColumnTypeFoundApp-v0.01.zip
    While creating this Entity Object, I got a "Business Components" dialog that says:
    "Column type is not specified for this attribute. Specifying column-type and precision results in better query performance at runtime. Do you wish to set column type to VARCHAR2(255)?"
    I clicked "Yes".
    I also created two View Objects based on this Entity Object.
    In the "Create View Object" wizard "Step 4 of 7: Attribute Settings" I got a "Business Components" diaglog that says:
    "Attributes selected in query with no column type found! Specifying column-type and precision results in better query performance at runtime. Do you wish to set default column type for these attributes?"
    I clicked "Yes".
    Testing the query in "Step 5 of 7: SQL Statement" showed "Query is valid.".
    question:
    Why do I keep getting the message ...
    "Attributes selected in query with no column type found! Specifying column-type and precision results in better query performance at runtime. Do you wish to set default column type for these attributes?"
    ... in the View Object Editor if I click on different attributes?
    (I don't get such a message the first time I click on an attribute after opening the View Object Editor, but after that it keeps popping up each time I click on a different attribute, no matter what I answer "Yes", "No" or "Cancel".)
    many thanks
    Jan Vervecken

    Jan,
    BC needs the column type and precision so that we can allocate the correct JDBC buffer size; otherwise we would just allocate 2k per string.
    Blaise

  • Attributes selected in query with no column type found! (solved)

    Dear JHeadstart Team,
    In the view object Editor I have two entity based attributes attrib1 and attrib2
    both with type Number. Both have aliases with type number(9,0)
    If attrib1 is null I want to have the value of attrib2.
    In the expression box I put: nvl(attrib1,attrib2)
    When I press the ok button I get the next error message.
    "Attributes selected in query with no column type found!
    Specifying column-type and precision results in better query performance at runtime.
    Do you wish to set default column type for these attributes? "
    When I say ok I get the next message:
    "An error occurred. Unable to apply all the wizard changes.
    Column type cannot be changed for Entity based attribute.
    Exception: oracle.jbo.dt.objects.JboExeption."
    The details button serves no extra information.
    Since both the attributes have the same type I thought the nvl commando should work.
    But what does the "no column type found" sentence mean?
    regards,
    Marcel.
    Message was edited by:
    user571204

    Thanks Jan,
    You've put me on the right track.
    I found out that this is only possible in the entity object class.
    So I have to check my limited java skills.

  • Change JDBC select SQL query's where clause at runtime

    Hi,
    I have one JDBC sender channel with Select SQL Query which helps in fetching data from JDE table. We have defined where clause to fetch some particular records i.e. if ABC = NULL then fetch the record.. and then update query is used to turn that flag to "Y" i.e. ABC ="Y" so that next time the channel don't pick the same records again.
    Now the problem is that if we want to fetch some records again whose flag has been set to "Y" we cannot change the select query again and again in the production environment.
    Is there any way to change the select query of the JDBC channel at runtime e.g. Picking up some flat file where the conditions for the particular records to be picked are defined (ID=123) and changing the WHERE clause of select query in the JDBC channel for those records to be picked without using BPM.
    Thank you!
    With regards,
    Simran

    Hi Simran,
    Yes, it is possible with the help of store procedure. In SQL Server there is a IF-Else Conditional block, which you can use inside store procedure. Create a SP with 2 additional parameter something like FlagReadAgain and KeyField. Pass the flag always as True or False. For the Key field pass the record key which you want to read again if you are passing the Flag as True else pass it as 0 or whatever.
    In the procedure check if the value of flag is True -> If yes, Read the entry with key name specified in where part.
    In the else part put the query which you are using for the normal flow.
    IF (FlagReadAgain) = TRUE
    BEGIN
       SELECT EmpName, EmpAddress
       FROM Employee
       WHERE EmpID = 'E001'
    END
    ELSE
       BEGIN
         SELECT EmpName, EmpAddress
         FROM Employee
         WHERE Status = 'N'
       END
    You may also use the approach which Srini mentioned. Create an application to restore any value to intial stage so that it can be picked up by XI when it poll again.
    Choose any approach which you like.
    Regards,
    Jitender Chauhan

Maybe you are looking for