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.

Tags: Database

Similar Questions

  • 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
         , ...
    
  • 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}

  • 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.

  • foreign key ALTER TABLE QUERY PROBLEM

    HAI ALL,

    ANY SUGGESTION PLEASE?

    UNDER: foreign key ALTER TABLE QUERY PROBLEM

    I want TO CREATE AND ALTER TABLE foreign key:

    1.TABLE:HAEMATOLOGY1
    COLUMN: HMTLY_PATIENT_NUM
    WITH
    TABLE: PATIENTS_MASTER1
    COLUMN: PATIENT_NUM (THIS IS THE KEY PRIMARY AND UNIQUE)

    1.TABLE:HAEMATOLOGY1
    COLUMN: HMTLY_TEST_NAME
    WITH
    TABLE: TESTS_MASTER1
    COLUMN: TEST_NAME ((C'EST LA CLÉ UNIQUE))
    ---------------


    SQL + QUERY DATA:
    -----------
    ALTER TABLE HAEMATOLOGY1
    Key constraint SYS_C002742_1 foreign (HMTLY_PATIENT_NUM)
    references PATIENTS_MASTER1 (PATIENT_NUM);

    ERROR on line 2:
    ORA-01735: invalid option of ALTER TABLE

    NOTE: THE NAME OF THE CONSTRAINTS: SYS_C002742_1 TAKEN FROM ORACLE ENTP TABLE DETAILS. MGR.
    ---------
    ALTER TABLE HAEMATOLOGY1
    Key constraint SYS_C002735_1 foreign (HMTLY_TEST_NAME)
    references TESTS_MASTER1 (TEST_NAME);

    ERROR on line 2:
    ORA-01735: invalid option of ALTER TABLE

    NOTE: THE NAME OF THE CONSTRAINTS: SYS_C002735_1 TAKEN FROM ORACLE ENTP TABLE DETAILS. MGR.

    ==============

    4 TABLES OF LABORATORY CLINIC FOR DATA ENTRY AND GET REPORT ONLY FOR THE TESTS CARRIED OUT FOR PARTICULAR

    PATIENT.

    TABLE1:PATIENTS_MASTER1
    COLUMNS: PATIENT_NUM, PATIENT_NAME,

    VALUES:
    PATIENT_NUM
    1
    2
    3
    4
    PATIENT_NAME
    BENAMER
    GIROT
    KKKK
    PPPP
    ---------------
    TABLE2:TESTS_MASTER1
    COLUMNS: TEST_NUM, TEST_NAME

    VALUES:
    TEST_NUM
    1
    2
    TEST_NAME
    HEMATOLOGY
    DIFFERENTIAL LEUKOCYTE COUNT
    -------------

    TABLE3:HAEMATOLOGY1
    COLUMNS:
    HMTLY_NUM, HMTLY_PATIENT_NUM, HMTLY_TEST_NAME, HMTLY_RBC_VALUE, HMTLY_RBC_NORMAL_VALUE

    VALUES:
    HMTLY_NUM
    1
    2
    HMTLY_PATIENT_NUM
    1
    3
    MTLY_TEST_NAME
    HEMATOLOGY
    HEMATOLOGY
    HMTLY_RBC_VALUE
    5
    4
    HMTLY_RBC_NORMAL_VALUE
    4.6 - 6.0
    4.6 - 6.0
    ------------

    TABLE4:DIFFERENTIAL_LEUCOCYTE_COUNT1
    COLUMNS: DLC_NUM, DLC_PATIENT_NUM, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE, DLC_POLYMORPHS_

    NORMAL_VALUE,

    VALUES:
    DLC_NUM
    1
    2
    DLC_PATIENT_NUM
    2
    3
    DLC_TEST_NAME
    DIFFERENTIAL LEUKOCYTE COUNT
    DIFFERENTIAL LEUKOCYTE COUNT
    DLC_POLYMORPHS_VALUE
    42
    60
    DLC_POLYMORPHS_NORMAL_VALUE
    40-65
    40-65
    -----------------


    Thank you
    RCS
    E-mail:[email protected]
    --------

    ALTER TABLE HAEMATOLOGY1
    ADD Key constraint SYS_C002742_1 foreign (HMTLY_PATIENT_NUM)
    references PATIENTS_MASTER1 (PATIENT_NUM);

  • Eurotherm EPower controller: query problem

    Hello

    I have a problem with communicating with a controller Eurotherm EPower (with 4 units) by OPC server.

    I use:

    -LV 8.5.1

    -iTools OPC Server 7.50 with a number of product formed the social reason (active license)

    -EPower Firmware v3.01

    Communication between LV and OPC server is made by "DataSocket write" and "Read DataSocket".

    I can write => values without problem I only write Main.SP on the evolution of events user and everything's fine.

    But on reading, I would like to read Meas.I Meas.P, Meas.V, continuous for each unit (up to 12 url request)

    The first reading is ok, so I have values, the url are ok. But after that, it is impossible to put in a loop-online no error, (status = 0 on LV and OPC Server) but the values are not updated with the following query.

    I tried to play with the option "wait for updated value", but without success.

    The only way I've found is to open the interface for server, the device, right click and select "Synchronize Active device". But this option is only a shot and very long because, I guess, he gets everything in the device...

    Another point: it works perfectly with the Engineering Studio, commonly called iTools-iTools. It is a client of the OPC server on my application.

    Another point on the other: when I run my application is the ID_EPower.exe in the list of Windows processes and consume resources (0 or 1%) so he lives.

    Complete, with one hour, I thank them but not way with Eurotherm hotline.

    My question is: Y at - it a particular way to obtain ongoing measures such as sending a query each time or a general property to get updated data?

    I used to cruise control disc from the same manufacturer with no problem and no need to send a request to get the values, but here it is perhaps a different case.

    List of requested URL:

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.1.MEAs.V

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.1.MEAs.I

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.1.MEAs.P

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.2.MEAs.V

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.2.MEAs.I

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.2.MEAs.P

    ... Ditto for network 3 and 4

    I joined the part of the code that is dedicated for the reading of values, but it is not really helpful because I think that my method of reading is correct (data arrive but are never updated) is a 'lack' of command to request that the server acquires new data or a bug with the LV-iTools OPC server interface...

    For LabViewers advanced, I know that my attached code is not optimized and not the smartest, but keep cool, I do not need crazy performance

    Any suggestion?

    So, I was not on the spot for the tests, but now it's ok.

    Several series shares have been made to the walkthrough to the problem, but it's hard to know if all were beneficial:

    -An update of software Eurotherm: 7.50 to 7.68

    -An update of the firmware EPower: 3.01 to 3.03

    - and probably the main cause of the problem: change the cable through a cross-wired (we thought it was, but not in reality...). But even if it is the main cause: how it was possible to receive data by forcing the update in the OPC server... strange.

    Thanks for your help.

  • 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

  • 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

  • Printable report query problem

    I try to develop a printable report query. I created a report under shared components query which consists of 12 separate queries that collect data are all related to a single page element. The intention is to create a PDF document that is printed to the user on demand that will display all this information on the page element they have chosen.

    The query of the report gathers information and generates an XML file in the following format.
    <DOCUMENT>
        <ROWSET1>
            <ROWSET1_ROW>
                             *Data from query 1*
            </ROWSET1_ROW>
        </ROWSET1>  
        <ROWSET2>
            <ROWSET2_ROW>
                              *Data from query 2*
            </ROWSET2_ROW>
            <ROWSET2_ROW>
                              * Data from query 2*
            </ROWSET2_ROW>
       </ROWSET2>
       <ROWSET3>
           <ROWSET3_ROW>
                              * Data from query 3*
           </ROWSET3_ROW>
           <ROWSET3_ROW>
                              * Data from query 3*
           </ROWSET3_ROW>
       </ROWSET3>
    ......
    </DOCUMENT>
    Then, I took this XML file and developed a model RTF using Office BI Publisher and imported as a layout of the report.
    I then connected this provision of the RTF to the report query and he ran. I don't have all the data to print.

    I found the reason why that it did not work, it is that the XML file that is generated by the report query is not static. The following XML file that was generated by the report query looked like this:
    <DOCUMENT>
        <ROWSET1>
            <ROWSET1_ROW>
                               * Data from query 3*
            </ROWSET1_ROW>
            <ROWSET1_ROW>
                               * Data from query 3*
            </ROWSET1_ROW>
        </ROWSET1>  
        <ROWSET2>
            <ROWSET2_ROW>
                               * Data from query 7*
            </ROWSET2_ROW>
            <ROWSET2_ROW>
                               * Data from query 7*
            </ROWSET2_ROW>
            <ROWSET2_ROW>
                               * Data from query 7*
            </ROWSET2_ROW>
       </ROWSET2>
       <ROWSET3>
           <ROWSET3_ROW>
                               * Data from query 1*
           </ROWSET3_ROW>
       </ROWSET3>
    ......
    </DOCUMENT>
    So I can't develop a RTF model to display the data, if I do not know where these data will appear in the generated XML.

    Questions (I'll offer several POINTS to anyone who can answer all of these questions!)

    I use APEX version 3.1

    * 1. Why the report query seems randomly to renumber and reorganize the XML it produces? *

    * 2. Is it possible to make the report query to display the XML data in the order in which the individual queries are classified each time? *

    * 3. Is it possible to designate exactly the lines of sets of lines or lines supported by APEX? *

    * 4. Are there other methods can I Explorer to produce this report? *

    * 5. Is it a problem because I'm on an older version? Is it not a problem on 4.1? *

    Published by: bhenderson on February 1, 2012 08:22

    So, you have 12 separate petitions? No there is no way to join them in a union to build the required data set? Or even using views inline in a query for each set of values?

    Thank you

    Tony Miller
    Webster, TX

  • Format for a number field in af:query problem. Is this a Bug of the ADF?

    Hi, OTN,.

    Requirement: Format DepartmentId in query Panel

    I created a view of criteria of the Employees (HR diagram) table. I have four items in the view criteria called EmployeeId, DepartmentId, Firstname, LastName and all elements including the posting as selectively requiredproperty. Attribute DepartmentId have Format Type of the property UI tips = number and Format = * 0000 * and Auto submit = true.
    But in the user interface, I'm not able to search the af:Query Panel. It works fine without setting the property UI tips Format and Type of format *.

    Step 1: Type 123 in the DepartmentId field
    Step 2: Click on the search button
    Error: Please provide a value for at least one of the specified areas
    Error message: http://www.freeimagehosting.net/24d51

    Please see the link for downloading the sample application below

    http://formatissue.googlecode.com/svn/trunk/FormatTest/FormatTest.zip
    http://formatissue.googlecode.com/svn/trunk/FormatTest (SVN version)

    Note:

    JDev Version: 11.1.1.5.0
    I use BC ADF and ADF Faces components

    All of the recommendations fully appreciated

    Thank you
    Jean-Marc Mithra

    Published by: Fanny Mithra November 23, 2011 16:51

    Published by: Fanny Mithra November 23, 2011 17:21

    Has filed a bug, bug # copied to the end of this thread - edited previous comment, the problem occurs even on release after 11.1.1.5.0.

    Published by: Jobinesh on December 2, 2011 10:38

  • Sort on dynamic query problem!

    Hello

    I have a dynamic query written in pl/sql, when I check "Sort" for each field in the report attribute, error message resurrected as "ORA-01785: ORDER BY item must include the number of an expression in the SELECT list.
    If I do not check sort, it works very well. In my applications, I need all the fields sorted by user, how do I solve this problem?

    My query as below:

    declare
    Ask varchar2 (2000): = "select";
    s_class varchar2 (1000);
    cursor c1 is select * from demo_preference;
    Start
    for c1_val looping c1
    If c1_val.login is not null then
    query: query = | » ' || 'login ' | ',';
    end if;
    If c1_val.id is not null then
    query: query = | » ' || 'id ' | ',';
    end if;
    .......
    end loop;
    query: = SUBSTR (query, 1, length (query)-1);

    s_class: = ' (NVL (: P2_class, "%" |)) ''null%'') = ''%'' || "zero percent" OR
    EXISTS (SELECT 1 FROM apex_collections WHERE collection_name = "P2CLASSCOL" AND class = c001))';

    query: query = | » ' || ' from ming.reg_report_view1 where '.
    || ' ' || s_class;
    Return (Query);
    end;

    Maybe the internal column used when you clicked the sort is not indicated in the report. Try to use aliases when you build the query string, it might help apex internally to identify a column even if its order is changed to another user. After all, the order of the columns in the code is dynamic and I assume that even the number of displayed columns can vary that could sort on a column that is identified by a number not valid.

    How about somewhere, displaying the report query so that you know what is the exact query processing, it could give you the best information on the problem.

    If the problem persists, use a collection that is extracted these record using the same query string, then replace the report to view the collection and then set the sort column on. This way Summit could get confused about which columns are being sorted and it would just sort on a c001... C050 column as if it were a string (Yes problems with the number of sort columns when you do this).

  • Need to rotate the sub query using 11 g

    Hello

    Please find the below query

    SELECT AGING_BUCKET_ID, DAYS_START, DAYS_TO, AR_AGING_BUCKET_LINES TYPE
    WHERE AGING_BUCKET_ID = 3

    It displays the data as below

    AGING_BUCKET_ID DAYS_START DAYS_TO TYPE

    3-9999 0 CURRENT
    3 1 30 LAST
    3 31 60 LAST
    3 61 90 LAST
    3 91 9999999 PAST


    I tried to rotate the data, tried to make use of the PIVOT of the 11 g used the following query function

    WITH AGBUCK AS
    (
    SELECT AGING_BUCKET_ID, DAYS_START, DAYS_TO, AR_AGING_BUCKET_LINES TYPE
    WHERE AGING_BUCKET_ID = 3
    ) SELECT * FROM AGBUCK
    PIVOT)
    DAYS_START s1, s2 DAYS_TO, type
    FOR AGING_BUCKET_ID
    (3)
    );

    finished in the msg below:-ora-56902: wait for the aggregate within the operation of pivot function

    can you please help me to fix it.

    Concerning
    Yram

    Hi, Yram,

    Whenever you have a problem, after a few sample data and outcomes from these data.
    Sorry, I can't make a good guess at what you want, and I'm not an Oracle 11 database now to test. I think you want something like this:

    WITH      AGBUCK      AS
    (
         SELECT      AGING_BUCKET_ID
         ,     DAYS_START
         ,     DAYS_TO || TYPE      AS label
         FROM      AR_AGING_BUCKET_LINES
         WHERE      AGING_BUCKET_ID     = 3
    )
    SELECT     *
    FROM     agbuck
    PIVOT     (     MIN (days_start)
         FOR     label
         IN     (     '0 CURRENT'     AS current_0
              ,     '30 PAST'     AS past_30
              ,     '60 PAST'     AS past_60
              ,     '90 PAST'     AS past_90
              ,     '9999999 PAST'     AS past_9999999
              )
         )
    ;
    

    The first thing inside the parentheses after the PIVOT keyword must be an aggregate function. If there is a one-to-one correspondence between the lines in the "input" table and cells in the output, so no matter if you use the MIN or MAX (or, in the case of numbers, AVG or SUM).

  • Insert query problem

    I have an insert query that I have not changed, but for some reason it won't insert anything in the database.

    The data is entered by a form of Ajax submission and goes to insert.php

    {if (isset($_POST['message_wall']))}
    / * The database connection * /.
    include ('config.php');

    / * Remove the HTML tag to prevent the injection of the query * /.
    $message = mysql_real_escape_string($_POST['message_wall']);
    $to = mysql_real_escape_string($_POST['profile_to']);

    $sql = "INSERT INTO wall (VALUES) (message)
    « '. $message. " »)';
    mysql_query ($SQL);

    I want to be able to add a user_id in the database too

    The ajax code:

    $(document) .ready (function () {}
    {$("form#submit_wall").submit (function ()}

    var message_wall is $('#message_wall').attr ('value');.

    $.ajax({)
    type: 'POST',
    URL: "insert.php"
    data: "message_wall ="+ message_wall, ".
    success: function() {}
    $("ul#wall").prepend ("< style li =' display: none" > "+ message_wall +"< /li > < br > < HR >");
    $("ul #wall li:first").fadeIn();)
    }
    });
    Returns false;
    });
    });

    Hello

    As it is a form ajax post then the form data should be inserted into your database using the insert.php script. All in the form of ajax jQuery is passed to the script of treatment if you process in the insert script it should work o/k.

    You must then include a text response to aid a statement simple echo in your insert script, this should include everything that you want to appear on your page.

    Php in your insert script would be similar to.

    At the beginning of the script.

    $date = $_POST ['msg_date'];

    At the bottom of the script.

    If {($success)
    echo "Inserted on $date ';
    } else {}
    echo "there was a problem processing your information.';
    }

    The jQuery to achieve code would be-

    Perform tasks of post-tabling
    function showResponse (responseText, statusText) {}
    $('.response').text (responseText);
    }

    More-

    success: showResponse,

    Treatment options in your ajax form

    And just include a

    where you want to display in your html code.

    PZ

    www.pziecina.com

Maybe you are looking for