Sub query in odi

Hello.. friends
can someone tell me please how to use query sub in ODI 11 g with an example or have a music video.

Concerning
Soumya.

http://www.business-intelligence-quotient.com/?p=1045

Tags: Business Intelligence

Similar Questions

  • How to know what sub query returns multiple rows

    Hi all

    Someone can give me hints, how to know what sub query returns many rows in the following query.
    /* Formatted on 2011/05/17 19:22 (Formatter Plus v4.8.8) */
    SELECT a.*, ROWNUM AS rnm
      FROM (SELECT DISTINCT '1' AS "Page View", ou.org_unit_name AS "Org",
                            prxm.mbr_idntfr AS "Beneficiary ID",
                               md.last_name
                            || ', '
                            || md.first_name AS "Beneficiary Name",
                            pci.idntfr AS "Tracking No.",
                            TO_CHAR (TRUNC (req.pa_rqst_date),
                                     'MM/dd/yyyy'
                                    ) AS "Request Date",
                            sts.status_name AS "Status",
                            req.pa_rqst_sid AS "Request #",
                            prxm.mbr_sid AS "Mbr_sid",
                            TO_CHAR
                                  (TRUNC (req.pa_revision_date),
                                   'MM/dd/yyyy'
                                  ) AS "Last Updated",
                            TO_CHAR (psd.TO_DATE, 'MM/dd/yyyy') AS "TO_DATE",
                            prxpl.prvdr_lctn_iid AS "PRVDR_LCTN_IID",
                            pd.prvdr_sid AS "PRVDR_SID", 'Y' AS "State View",
                            DECODE
                               ((SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                0, (SELECT prxplo.prvdr_lctn_idntfr
                                      FROM pa_request_x_provider_location prxplo
                                     WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                       AND prxplo.oprtnl_flag = 'A'
                                       AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT prxplo.prvdr_lctn_idntfr
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "NPI/ID",
                            DECODE
                               ((SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT    pd.last_name
                                              || ', '
                                              || pd.first_name
                                              || ' '
                                              || pd.middle_name
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "Prvdr Name",
                            TO_CHAR (psd.from_date,
                                     'MM/dd/yyyy'
                                    ) AS "Srvc From Date",
                            TO_CHAR (req.validity_start_date,
                                     'MM/DD/YYYY'
                                    ) AS "Due Date",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>Left",
                            req.pa_mode_type_lkpcd AS "Source",
                            TO_CHAR (TRUNC (wmdtl.rtng_date),
                                     'MM/dd/yyyy'
                                    ) AS "Assigned On",
                            NVL (wmdtl.assigned_to_user_name,
                                 'Not Assigned'
                                ) AS "Assigned To",
                            req.org_unit_sid AS "OrgUnitSid",
                            TO_CHAR
                                 (wmdtl.modified_date,
                                  'MM/dd/yyyy hh24:mi:ss'
                                 ) AS "WTRD_MODIFIED_DATE",
                            TO_CHAR (wmdtl.rtng_date,
                                     'MM/dd/yyyy'
                                    ) AS "WTRD_RTNG_DATE",
                            req.status_cid AS "PA_STATUS_CID",
                            TO_CHAR (req.modified_date,
                                     'MM/dd/yyyy'
                                    ) AS "PA_REQ_MODIFIED_DATE",
                            prs.state_pa_srvc_type_code
                                                     AS "STATE_PA_SRVC_TYPE_CODE",
                            wmdtl.wm_pa_task_rtng_dtl_sid
                                                        AS "WM_TASK_RTNG_DTL_SID",
                            wmdtl.assigned_to_user_acct_sid
                                              AS "WTRD_Assigned_to_user_acct_sid",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>LeftSort",
                            wmdtl.assigned_to_org_unit_sid
                                                  AS "WTRD_Assigned_to_OrgUntSid",
                            DECODE
                               ((SELECT COUNT (*)
                                   FROM pa_request_status prs
                                  WHERE prs.pa_rqst_sid = req.pa_rqst_sid
                                    AND prs.status_cid = 5
                                    AND prs.oprtnl_flag = 'I'),
                                0, 'N',
                                'Y'
                               ) AS "SHOW_UTILIZATION"
                       FROM   pa_request req,
                             pa_certification_identifier pci,
                             status sts,
                             pa_request_x_member prxm,
                             wm_pa_task_routing_detail wmdtl,
                             pa_service_date psd,
                             org_unit ou,
                             pa_request_service prs,
                             pa_request_x_provider_location prxpl,
                             provider_location pl,
                             provider_detail pd,
                             provider p,
                             mbr_dmgrphc md
                      WHERE req.oprtnl_flag = 'A'
                        AND req.status_cid NOT IN
                                     (20, 30, 70, 25, 80, 96, 85, 5, 97, 98, 101)
                        AND req.org_unit_sid IN
                               (3057, 3142, 3058, 3143, 3059, 3144, 3060, 3145,
                                3061, 3146, 3062, 3147, 3063, 3148, 3064, 3149,
                                3065, 3150, 3066, 3151, 3067, 3152, 3068, 3153,
                                3069, 3154, 3070, 3155, 3071, 3156, 3072, 3157,
                                3073, 3158, 3074, 3159, 3075, 3160, 3076, 3161,
                                3077, 3162, 3078, 3163, 3079, 3164, 3080, 3165,
                                3081, 3166, 3082, 3167, 3083, 3168, 3084, 3169,
                                3085, 3170, 3086, 3171, 3087, 3172, 3088, 3173,
                                3089, 3174, 3090, 3175, 3091, 3176, 3092, 3177,
                                3093, 3178, 3094, 3179, 3095, 3180, 3096, 3181,
                                3097, 3182, 3098, 3183, 3099, 3184, 3100, 3185,
                                3101, 3186, 3102, 3187, 3103, 3003, 75000104,
                                75000108, 2006, 75000103, 75000102, 75000113,
                                75000111, 75000109, 2001, 2009, 75000105,
                                75000107, 2004, 2010, 2013, 2014, 2005, 2011,
                                75000112, 2002, 1001, 2012, 75000106, 2007,
                                75000101, 2003, 75000110, 2008, 3001, 3002, 3019,
                                3104, 3020, 3105, 3021, 3106, 3022, 3107, 3023,
                                3108, 3024, 3109, 3025, 3110, 3026, 3111, 3027,
                                3112, 3028, 3113, 3029, 3114, 3030, 3115, 3031,
                                3116, 3032, 3117, 3033, 3118, 3034, 3119, 3035,
                                3120, 3036, 3121, 3037, 3122, 3038, 3123, 3039,
                                3124, 3040, 3125, 3041, 3126, 3042, 3127, 3043,
                                3128, 3044, 3129, 3045, 3130, 3046, 3131, 3047,
                                3132, 3048, 3133, 3049, 3134, 3050, 3135, 3051,
                                3136, 3052, 3137, 3053, 3138, 3054, 3139, 3055,
                                3140, 3056, 3141)
                        AND req.pa_rqst_sid = prs.pa_rqst_sid
                        AND prs.oprtnl_flag = 'A'
                        AND prs.pa_rqst_srvc_sid = psd.pa_rqst_srvc_sid
                        AND psd.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = pci.pa_rqst_sid
                        AND pci.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxm.pa_rqst_sid
                        AND prxm.oprtnl_flag = 'A'
                        AND md.oprtnl_flag = 'A'
                        AND md.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN md.from_date AND md.TO_DATE
                        AND prxm.mbr_sid = md.mbr_sid
                        AND ou.org_unit_sid = req.org_unit_sid
                        AND ou.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxm.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND pci.pa_rqst_sid = prxm.pa_rqst_sid
                        AND pci.pa_rqst_sid = wmdtl.subsystem_task_sid
                        AND pci.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxpl.pa_prvdr_type_lkpcd = 'RR'
                        AND prxpl.oprtnl_flag = 'A'
                        AND req.status_cid = sts.status_cid
                        AND sts.status_type_cid = 3
                        AND sts.oprtnl_flag = 'A'
                        AND prxpl.prvdr_lctn_iid = pl.prvdr_lctn_iid
                        AND p.prvdr_sid = pd.prvdr_sid
                        AND p.prvdr_sid = pl.prvdr_sid
                        AND pd.oprtnl_flag = 'A'
                        AND pd.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN pd.from_date AND pd.TO_DATE
                        AND wmdtl.subsystem_task_sid = req.pa_rqst_sid
                        AND wmdtl.subsystem_lkpcd = 'PA'
                        AND wmdtl.oprtnl_flag = 'A'
                        AND req.pa_rqst_date > (SYSDATE - 365)
                                       ORDER BY TO_DATE ("Request Date", 'MM/dd/yyyy hh24:mi:ss') DESC,
                            "Beneficiary Name" ASC) a
     WHERE ROWNUM < 102;
    Kind regards
    Prakash P

    Published by: BluShadow on May 17, 2011 15:01
    addition of {noformat}
    {noformat} tags around the code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    3360 wrote:
    See point 9 of this section of the FAQ on how to format the code.

    SQL and PL/SQL FAQ

    I see that you did.

    No, I did. It's pretty easy to change if the code seems formatted anyway below. It's when I go to edit the message and find no sense because it is not formatted in all cases, I despair. {noformat} :) {noformat}

  • Sub query problem

    Hi all

    Problem with sub query.

    Select * from where the team team_id in (team_id region selection);

    If I run the query above is the length, but the problem is that I don't have team_id in the region table. How oracle to run this query. Please explain.

    If I run select region team_id;

    I got error like team_id invalid.


    I'm using the version of oracle 10g.


    Thank you.

    Sunita.

    sunitha2010 wrote:
    Hi all

    Problem with sub query.

    Select * from where the team team_id in (team_id region selection);

    If I run the query above is the length, but the problem is that I don't have team_id in the region table. How oracle to run this query. Please explain.

    Because of the determination of the scope.
    Oracle uses the "team_id" of the outer query.

    If you were to use:

    select * from team  where team_id in (select region.team_id from region);
    

    THEN, you will get an error.

  • Need help to write a sub query

    Our environment - Oracle 10 g

    Hi all
    Need help to write a sub query to reach him here are examples of data using which iam trying to replace the value column in the table based on two other columns in the same table

    Examples of data

    ClaimNo flag LineNo Procedurecode
    100 01 N MN4567
    100 02 Y 7863
    100 03 N MN8976
    100 04 Y 9000
    101 01 Y 8954
    101 02 N MN6754
    101 03 N MN7654
    101 04 Y 8976
    102 01 Y 1234
    102 02 Y 2345
    102 03 Y 3456
    102 03 Y 4567

    Each column of ClaimNo has several rows of data. But if column procedurecode for a claimNo starts with MN then all values associated with the claimno for the flag column should replace N

    If the data must become like below

    ClaimNo flag LineNo Procedurecode
    100 01 N MN4567
    100 02 N 7863
    100 03 N MN8976
    100 04 N 9000
    101 01 N 8954
    101 02 N MN6754
    101 03 N MN7654
    101 04 N 8976
    102 01 Y 1234
    102 02 Y 2345
    102 03 Y 3456
    102 03 Y 4567


    Thank you

    See the example:

    with t as (
                  select 100 ClaimNo, '01' LineNo, 'N' Flag, 'MN4567' Procedurecode from dual
        union all select 100, '02', 'Y', '7863' from dual
        union all select 100, '03', 'N', 'MN8976' from dual
        union all select 100, '04', 'Y', '9000' from dual
        union all select 101, '01', 'Y', '8954' from dual
        union all select 101, '02', 'N', 'MN6754' from dual
        union all select 101, '03', 'N', 'MN7654' from dual
        union all select 101, '04', 'Y', '8976' from dual
        union all select 102, '01', 'Y', '1234' from dual
        union all select 102, '02', 'Y', '2345' from dual
        union all select 102, '03', 'Y', '3456' from dual
        union all select 102, '03', 'Y', '4567' from dual
    )
    select
        claimno,
        lineno,
        flag,
        case
          when count(decode(substr(procedurecode,1,2),'MN',1)) over(partition by claimno)>0
            then 'N'
          else flag
        end new_flag,
        procedurecode
    from t
    

    Kind regards
    Sayan M.

  • Order By in the Sub query

    We cannot use ORDER BY in the Sub query.
    select * from emp where emp_no in (select emp_id from dept order by dept_no )
    Get the below error
    ORA-00907: missing right parenthesis

    Hello

    user13024762 wrote:
    To get the number of EMP table for maximum number of dept dept

    If this is what you want, then do something like this:

    select  *
    from      emp
    where      emp_no in (
                          select    MAX (emp_no) KEEP (DENSE_RANK LAST ORDER BY dept_no NULLS FIRST)
                   from      dept
                )
    ;
    

    or maybe

    select  *
    from      emp
    where      emp_no  = (
                          select    emp_no
                   from      dept
                   where     dept_no = (
                                                    SELECT  MAX (dept_no)
                                 FROM    dept
                                                 )
                )
    ;
    

    Depending on what you want in the case of a tie.

    select * from emp where emp_no in (select emp_no from dept where rownum =1 order by dept_no desc)
    

    The subquery that you posted above does not necessarily return the line containing the largest dept_no, since ROWNUM is affected before ORDER BY is done.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain how you get these results from these data.

  • Problems with Sub query

    Hello, I'm looking to create a sub query to display certain information. On the form that the information is entered, the user has the option to enter a phone number extension, as appropriate. If this is the case, I want the phone number to show as 555-867-5309 (x 1234). However, without the problem of controls, the (x) will be displayed without worrying and seems sloppy. Here is the code I have, please notify.

    There will be two places, it will be necessary - for the telephone number of the applicant and the app (SME) contact information manager.

    Thank you.

    select
        pm.pk_proj_master_id "Project Number",
        pm.trackit_work_order "TrackIt Work Order",
        pm.name "Project Name",
        pm.status "Project Status",
        req.last_name||', '||req.first_name||', '||req.middle_initial||'.' "Requestor Name",
        rde.department_group_descr "Requestor Department Name",
        req.department_descr "Requestor Division Name",
        
        pm.requester_ext,
        case
            when pm.requester_ext in 
                (
                select 
                    pm.requester_phone|| '(x'||pm.requester_ext ||')' "Requesters Number"
                from 
                    protrac_master pm
                where
                    pm.requester_ext is not null
                )
            
            else
                (
                select
                    pm.requester_phone "Requesters Number"
                from 
                    protrac_master pm
                )   
        end as "Requester Number",
         
        man.last_name||', '||man.first_name||', '||man.middle_initial||'.' "SME Name",
        mdg.department_group_descr "SME Department Name",
        man.department_descr "SME Division Name",
        
        pm.app_manager_ext,
        case
            when pm.app_manager_ext in 
                (
                select 
                    pm.app_manager_phone|| '(x'||pm.app_manager_ext ||')' "SME Number"
                from 
                    protrac_master pm
                where
                    pm.app_manager_phone is not null
                )
            
            else
                (
                select
                    pm.app_manager_phone "SME Number"
                from 
                    protrac_master pm
                )   
        end as "Requester Number",
    
        pm.createby_date "Date Entered",
        pm.date_begin "Date Began",
        pm.date_completed "Date Completed",
        pm.estimated_date "Estimated Completion Date"
    
    from
        protrac_master pm,
        cobr.vw_pps_payroll req, cobr.department_group rde,
        cobr.vw_pps_payroll man, cobr.department_group mdg
        
    where
        pm.requester_id         = req.emple_no and
        pm.requester_dept_id    = rde.pk_department_group_id and
        pm.app_manager_id       = man.emple_no and 
        pm.app_manager_dept_id  = mdg.pk_department_group_id
        
    order by 
        pm.pk_proj_master_id

    I think you can avoid the sub query thing simply by using the NVL2 function:

    select ...
         , NVL2( pm.requester_ext
               , pm.requester_phone|| '(x'||pm.requester_ext ||')'
               , pm.requester_phone) "Requesters Number"
           ...
         , NVL2( pm.app_manager_ext
               , pm.app_manager_phone|| '(x'||pm.app_manager_ext ||')'
               , pm.app_manager_phone) "Manager Number"
           ...
      from protrac_master pm
         , ...
    
  • Performance issue with Sub query

    Hi all

    I have a requirement as there are two tables.

    Columns in the table T1

    -----------------------------------

    enter_time TIMESTAMP - partitioned column

    loc_num INDEX of index column-

    Table T2

    ---------------------------

    number of loc_num

    VARCHAR2 (20) type1

    VARCHAR2 (20) type2

    Table T1 is to have 30,00000 files

    Table T2 is to have 4 records

    There is no application between T1 and T2.

    Try to get one day date of the T2 based on the results of query sub.

    Query:

    SELECT * FROM T1

    WHEN trunc (enter_time) = July 22, 15 '

    and loc_num IN (select loc_num FROM T2 where = "XYZ" type1 and type2 = "PPP");

    I tried with the sup of CO-RELEATED query, but it takes more than 30 minutes.

    Do you have any idea to rewrite the query to make it faster in this scénarion.

    Thanks in advance.

    Kind regards

    Sanjib


    Hello

    Columns in the table T1

    -----------------------------------

    enter_time TIMESTAMP - partitioned column

    loc_num INDEX of index column-

    Table T2

    ---------------------------

    number of loc_num

    VARCHAR2 (20) type1

    VARCHAR2 (20) type2

    Table T1 is to have 30,00000 files

    Table T2 is to have 4 records

    Do you have any idea to rewrite the query to make it faster in this scénarion.

    Implementation plan would be useful here.

    Assuming that enter_time is indexed, you can remove this trunc function.

    select * from t1
    where enter_time  >=  to_date('07/22/2015', 'mm/dd/yyyy')
      and enter_time  <   to_date('07/22/2015', 'mm/dd/yyyy') + 1
      and loc_num     in  (
        select loc_num from t2 where type1='XYZ' and type2='PPP'
      )
    
  • Sub query with order of

    Hello


    I created a sub with sorting on a column request. (I have cutomized the IKM control append for order). I see the order by the State. If I use this (interface yellow) subquery in the main query (is also yellow interface) I do not see the order of condition


    Subquery (Q-yellow interface):

    Select

    NEST,
    START_TIME,
    ACTION_TYPE_CODE


    Of

    (




    SELECT DISTINCT
    SERVICE_TRACKING_S.PID PID,
    START_TIME TO_TIMESTAMP (TO_CHAR (SERVICE_TRACKING_S.ACTION_TIME, 'DD-MON-YY HH24:MI:SS'), "MON-DD-YY HH24:MI:SS"),
    SERVICE_TRACKING_S.ACTION_TYPE_CODE ACTION_TYPE_CODE
    of KSTGDB. SERVICE_TRACKING_S SERVICE_TRACKING_S

    where (1 = 1)

    ORDER BY-----------------------------------------------
    NEST
    START_TIME CSA


    )

    ODI_GET_FROM

    Main query (Q1 - yellow interface):

    Select
    NEST,
    START_TIME,
    ACTION_TYPE_CODE,
    RN,
    RN_MAX

    CEN


    Select
    Q.PID PID,
    Q.START_TIME START_TIME,
    WHEN Q.START_TIME - LAG(Q.START_TIME,1,Q.START_TIME) CASE above (PARTITION OF Q. PID ORDER OF Q.START_TIME) > numtodsinterval(75,'minute')
    or Q.PID! = LAG (Q.PID, 1, 0) ON (Q.PID ORDER OF Q.START_TIME PARTITION) THEN 1 OTHER Q.ACTION_TYPE_CODE END ACTION_TYPE_CODE.
    ROW_NUMBER() OVER(PARTITION BY Q.PID ORDER BY Q.START_TIME) RN,
    Count (*) over (PARTITION OF Q.PID ORDER OF Q.START_TIME LINES BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
    RN_MAX
    de)

    SELECT DISTINCT
    SERVICE_TRACKING_S.PID PID, START_TIME TO_TIMESTAMP (TO_CHAR (SERVICE_TRACKING_S.ACTION_TIME, 'DD-MON-YY HH24:MI:SS'), "MON-DD-YY HH24:MI:SS"), SERVICE_TRACKING_S.ACTION_TYPE_CODE ACTION_TYPE_CODE
    of KSTGDB. SERVICE_TRACKING_S SERVICE_TRACKING_S
    where (1 = 1)

    -I don't get stopped by here-
    ) Q
    where (1 = 1)
    ) ODI_GET_FROM

    Thanks in advance

    K

    Hello

    what you trying to do? A decree by a subselect in the useless statement.

    Also use an order you need to add an option and change the IKM

  • Write the result of a query in ODI in file

    Hi friends,

    I'm using ODI 11 g.

    In ODI I want to write the output of the query to a file unix below.

    SELECT "H" | RPAD('SB9KT.) KTPRTO. EBSDATA. D0000000 ', '30', ' ') | RPAD (to_char (sysdate, 'YYYYMMDDHHMMSS'), 16, ' ')
    DOUBLE;


    Please suggest any entries.

    Thank you
    Lony

    delete ';

  • Select ambiguous column in Sub query

    I get an error "ambiguous column" when I question using a sub select. Here's my query:

    Select *.
    (select
    c.custody_id,
    c.person_id,
    n.first_name,
    n.last_name,
    z.usms_number,
    c.start_date,
    c.end_date,
    c.district_office_id,
    CBC.custody_id,
    c.update_date,
    c.update_user_id
    Guard c,.
    custody_booking_pkg_components Radio-Canada,
    z_migrate_usms_number z,
    district_office do,
    District d,
    person p,
    n name
    where
    c.person_id = p.person_id and
    z.person_id = p.person_id and
    z.Ordinal = 1 and
    c.custody_id = cbc.custody_id (+) and
    p.name_id = n.name_id and
    do.district_id = d.district_id and
    c.district_office_id = do.district_office_id and
    d.district_id = 99 by c.update_date desc order)
    where rownum < = 10;

    I understand why "ambiguous column" average error, but I don't see which column is ambiguous. I ran the select sub by itself and it works correctly, but when combined with the external selection it fails.

    Hello

    You have two columns called custody_id.
    It is normal to have names duplicated in a query, but not in a table or view (and which includes a view online, you have).

    Type a unique name for each column.

  • query in odi

    Hello


    How to implement this query (select * from tab1 less select * from tab2) in ODI.

    Hello

    Sure. :)

    1. in your underlying DB for example used DB run the query below

    Create view odi_minus in select * from tab1 less select * from tab2.

    2 open the designer of-> -> reverse-> check the view (United Nations check all and click APPLY).

    Then go on selective audit data reverse selective reverse tab, new store, objects to reverse.

    3. in the list, select the view whose u created odi_minus in our case, click on on the back.

    4. you will find views as data store in your model tree, use it as a source in your interface.

    Hope it's clear now.

    Thank you
    G

  • FETCH ONE RECORD IN THE SECOND TABLE OF CORRELATED SUB QUERY

    Hi all

    I have provided the script below, I want to single fecth record in the second table in the join query,

    based on the example below, I want to go get one record of the table emp2 what matches with the emp_id of table emp1, please note emp2 may contain more record for the emp_id emp1 which respects

    all records can be selected in the table emp2.

    DROP TABLE emp1.

    CREATE TABLE emp1 (emp_id NUMBER);

    INSERT INTO emp1 VALUES (1);

    INSERT INTO emp1 VALUES (2);

    COMMIT;

    DROP TABLE emp2.

    CREATE TABLE emp2 (emp_id NUMBER, emp_name VARCHAR2 (100));

    INSERT INTO emp2 VALUES (1, 'Name1');

    INSERT INTO emp2 VALUES (2, 'Name2');

    INSERT INTO emp2 VALUES (1, 'Name3');

    INSERT INTO emp2 VALUES (2, 'Conjoint4');

    COMMIT;

    SELECT * from emp1.

    SELECT * from emp2.

    SELECT T1. EMP_ID, MIN (T2. EMP_NAME)

    FROM EMP1, EMP2 T2 T1

    WHERE T1. EMP_ID = T2. EMP_ID

    GROUP T1. EMP_ID;

    My output should be the same as the result set of query above, but I don't want this logic, please provide the solution by using a different logic, thanks in advance.

    2811876 wrote:

    Thanks for your comments :-)

    My business logic will change to 'Fetch N second timeline table', that's the reason why I asked for a different approach, if I use max, min to achieve this does not allow me to evolve dynamically.

    Although logic has not been expressed at all in your original question, so good job I asked.

    You could do something like:

    SQL > ed
    A written file afiedt.buf

    1 with emp1 (select 1 as the emp_id of union double all the)
    2. Select 2 double
    3               )
    4, emp2 (select 1 as emp_id, 'name 1' as emp_name double union all
    5. Select "name 2' Union double every 2
    6 select 1, 'name' 3' from dual union all
    7. Select 2, 'name 4' double union all.
    8 select 1, 'name 5' from dual union all '.
    9 select 2, 'name 6' from dual '.
    10               )
    11-
    12. end of test data
    13-
    14 select emp_id, emp_name
    15 of)
    16 select t1.emp_id, t2.emp_name
    17, row_number() over (partition by order of t2.emp_name t1.emp_id) rn
    emp1 t1 18
    19 join t2 emp2 (t1.emp_id = t2.emp_id)
    20       )
    21 * where rn<=>
    SQL > /.

    Enter the value for rows_required: 1
    21 Alumni: where rn<=>
    21 news: where rn<=>

    EMP_ID EMP_NA
    ---------- ------
    1 name 1
    2 name 2

    SQL > /.
    Enter the value for rows_required: 2
    21 Alumni: where rn<=>
    21 news: where rn<=>

    EMP_ID EMP_NA
    ---------- ------
    1 name 1
    1 name 3
    2 name 2
    2 name 4

  • Set time interval for sub query runs automatically to every 5 minutes

    Hello

    Pls refer the below query, that query set a time interval to process or run this query automatically in every 5 minutes.

    Help me...!!!

    Declare

    l_recid varchar2 (100);

    Cursor c1 is

    Select a.recid a,f_ac_event@abnprod f_ac_event b where a.RecId = b.recid;

    Begin

    Open c1;

    loop

    Fetch c1 in l_recid;

    Remove from f_ac_event
    where recid = l_recid;

    When exit c1% notfound;

    End loop;

    Close c1;

    End;

    /

    ------------------------------------------------------------------------------(or)-----------------------------------------------------------------------------------------------------

    remove from f_ac_event
    where recid in (select x.recid in the f_ac_event@abnprod x);

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------

    Kind regards

    Villa

    Hi all

    Thanks for all your ideas, I do appreciate you all, finally, I implemented the Planner below to build a procedure:

    Start

    DBMS_SCHEDULER. () CREATE_JOB

    job_name-online "Task1.

    job_type-online "PLSQL_BLOCK."

    JOB_ACTION => ' BEGIN p1; END;',

    start_date => SYSDATE,

    repeat_interval => 'FREQ=MINUTELY; ',

    End_date => NULL,

    -Online TRUE, enabled

    comments => ' * any * comments ');

    end;

    /

    Villa,

  • Help with sub query!

    I have a question where the upper version value for an id is to be retrieved. I wrote a query but its time consuming. Please help me with this request.

    Create feed table (c_id number, number, version number);

    create the table of negotiations (identification number, the version number);

    Query:

    SELECT ID, VERSION

    Feed, process t

    WHERE a.c_id = 1 and a.id = t.id AND EXISTS (d.SELECT VERSION, d.ID

    FROM (SELECT MAX (VERSION), ID

    FROM (SELECT ID, VERSION

    B power supply, treat the t1

    WHERE b.c_id = 1

    AND t1.ID = B.ID) c

    GROUP BY ID) d

    WHERE a.ID = d.ID AND a.VERSION = d.VERSION);

    Please check this query:

    Select q.id, q.version

    from (select f,

    DENSE_RANK() over (partition by f.id f.version desc order) rn

    power f) q

    Join (select *)

    (select p,

    DENSE_RANK() over (partition by order by p.version desc p.id) rn

    process p)

    where rn = 1) p

    on p.id = q.id

    and p.version = q.version

    where q.rn = 1

    ----

    Ramin Hashimzade

  • A row of Sub query returns more than 1 row!

    I'm trying to update the values in one table from another table and get the error: void line query returns More Than 1 row.

    I want to PRV_NAME B chart updated in the table A PRV_NAME where A.PRVID = B.PRVID where B.PRV_TYPE = M"

    The two paintings were all unique PRVID, however, table B has PRVID that have the same name. So the data in table B can look like this:

    PRVID PRV_NAME
    1234 PHOENIX MED
    1235 MED BAG
    1236 MED BAG
    1237 OVERLAND
    etc...

    So, as you can see are the unique PRVID, but not the PRV_NAME. Is this the reason why I get this error?

    I do not build the tables and have no control over what is put in them. If this is the reason for the error, is there a way to fix this?

    For reference, here's the request. Maybe there's something wrong with that?


    Update msb_prv_source ps
    Set ps.prv_name =

    (select prv00.prv00_prv_name
    of prv00_prv prv00
    Join msb_prv_source ps
    On prv00.prv00_prv_id = ps.prvid
    where prv00.prv00_prv_type = am')

    Published by: user12296489 on April 19, 2013 10:46
    /* Formatted on 4/19/2013 2:00:43 PM (QP5 v5.185.11230.41888) */
    MERGE INTO msb_prv_source a
         USING (SELECT *
                  FROM prv00_prv
                 WHERE prv00_prv_type = 'M') b
            ON (a.prv00_prv_id = b.prvi)
    WHEN MATCHED
    THEN
       UPDATE SET a.prv_name = prv00_prv_name
    

Maybe you are looking for

  • Settings do not create new versions

    Hello world First of all, thanks in advance to anyone who can help you with this... Context: Trying to install new software (Adobe CC and 5 Lightroom and PS5) since I had several accidents and problems related to the opening. Before this all what it

  • Graph XY smooth

    Hello How can I plot a graph xy of measured data without a leap of pixel like the image below?I tried to install the scale, but it did not help.

  • Gateway NE72214u-US

    Hello I realize, this is acer but the Gateway Web site, and the cat is of no help. I know that the NE72214u and the United States are shipped with a dvd from the optical drive, but I would like to replace it with a bluray one if possible. I tried loo

  • I am trying to print a directory listing

    I added to my Windows XP Printdir.bat file; However I am still not able to print a directory listing.  When I right click on the folder, I get the following message: Cannot find the file c:\Docume~1\***\Locals~1\TempListing.txt He wants to go in this

  • I can't connect to Windows Vista. Only 1 user account. Tried Safe Mode. No luck. How can I unlock and find my admin password

    Ideas: Vista; Open a session cannot connect None The Point System Restore, Safe Mode, tried to find the file corrupted mode safe "regedit." She appears when in safe mode when I delete the information and I restart the computer, it reappears, so it is