SQL Query in Custom Security when creating Security Profile

Hello all,
I've created a security profile with Custom security and provided a simple query in Custom Security tab-
PERSON.PERSON_ID = FND_GLOBAL.EMPLOYEE_ID
Custom security option is "Restrict the people visible to each user using this profile"
I am not able to see the record as expected.
If I Hardcode the person ID "PERSON.PERSON_ID = 13449" with "Restrict the people visible to each user using this profile", I am able to see the record.
If I Hardcode the person ID "PERSON.PERSON_ID = 13449" with "Restrict the people visible to this profile", I am able to see the record after running PERSLM and same is in PER_PERSON_LISTS.
Am I correct in checking with FND_GLOBAL.EMPLOYEE_ID?
(This was mentioned in system administrator guide :
"+Oracle HRMS assesses the custom security when the user signs on. In addition, the custom security code can include references to user specific variables, for example, fnd_profile.value() and fnd_global.employee_id.+"
docs.oracle.com/cd/E18727_01/doc.121/e13509/T2096T2098.htm).
I have tried with FND_GLOBAL.USER_ID / FND_PROFILE.VALUE('USER_ID') / :ASG_ID (seeded query has a join with this bind variable) - not happening.
I've given options as below :
Employees = None
Contingent Worker = Restricted
Applicant = None
Contacts = All
Candidates = All
All other options - Defaulted
Thanks,
Sumanth

Resolved this - One cannot see self's employee record in the form for which this is setup.
Hence the below query though correct in syntax did not show any data.
PERSON.PERSON_ID = FND_GLOBAL.EMPLOYEE_ID
My original requirement was that all employees belonging to one's Organization should be displayed, and this is working fine with an updated query for the same.
Thanks,
Sumanth

Similar Messages

  • How to restrict employees from accessing managers data using custom security profile

    Hi,
    I am using custom security profile for restricting the employees from accessing supervisors details(PG.SEGMENT2=4). I have written the custom code as below :
    Responsibility :US Super HRMS Manager
    ASSIGNMENT.PERSON_ID
    IN
    (SELECT PAF.PERSON_ID FROM PER_ALL_PEOPLE_F PAF,
    PER_ALL_ASSIGNMENTS_F PF,
    PAY_PEOPLE_GROUPS PG,
    PER_PERSON_TYPE_USAGES_F PPU,
    FND_USER FNU
    WHERE PAF.PERSON_ID=PF.PERSON_ID
    AND :EFFECTIVE_DATE BETWEEN PAF.EFFECTIVE_START_DATE
    AND PAF.EFFECTIVE_END_DATE
    AND PF.PEOPLE_GROUP_ID=PG.PEOPLE_GROUP_ID
    AND :EFFECTIVE_DATE BETWEEN PF.EFFECTIVE_START_DATE AND PF.EFFECTIVE_END_DATE
    AND PPU.PERSON_ID=PAF.PERSON_ID
    AND PPU.PERSON_ID=PF.PERSON_ID
    AND :EFFECTIVE_DATE BETWEEN PPU.EFFECTIVE_START_daTE AND PPU.EFFECTIVE_END_DATE
    AND PAF.PERSON_ID=FNU.EMPLOYEE_ID
    AND PAF.PERSON_TYPE_ID =2
    AND PPU.PERSON_TYPE_ID
    IN(2,62)
    and PAF.person_id = FND_PROFILE.value('user_id')
    AND PG.SEGMENT2=8)
    and using "restrict the people visible to each other using this profile".
    I have assigned the security profile to HR user responsibility
    But when I query the supervisor name in HR User responsibility , it is not restricting me from viewing supervisor details.
    When I query for first time, its restricting me to view others details, but when I close that click on torch button and try searching, its allowing me to access manages details.
    Can any one please let me know what setups need to be done for restricting employees from viewing supervisors data.
    I have gone through the document "Understanding and Using HRMS Security in Oracle HRMS" but didn't got any idea.
    Please suggest.
    Thanks & Regards,
    Anusha.

    Hi All ,
    i solved the problem by using event 01 of header view and using the table "Extract" .
    Regards,
    Neha

  • How to replace or insert a customer logo when creating a journal template?

    Hi Experts,
    How to replace or insert a customer logo when creating a journal template?
    Thanks in advance.
    Best regards,
    Mila

    Hi Dzmitry,
    Thank a lot for your reply.
    We have already tried to download the journal template and insert our logo. The problem is that the journal template is protected and we do not have the password.
    Kind regards,
    Mila

  • List of Employees through custom security profile - SSHR

    Hi,
    A coordinator sitting in a region required access to all those employees who are coming in his region. This thing has been done and tested in PUI using custom security profile but can we give the same access to coordinator at Self service level, so that it can view employee detail and take necessary actions against employee.
    Thanks
    Ayaz

    You can indeed use the same Security Profile to control access through Self Service. In Self Service, you will need to use the Simple or Advanced Search to find these people because the default hierarchy that is displayed won't render.
    Often it is useful to add a personalization message to the Search region so that the users know to find people this way, eg:
    "To find employees in your region, please enter their Last Name in the Search box and hit Enter."

  • SQL Query produces different results when inserting into a table

    I have an SQL query which produces different results when run as a simple query to when it is run as an INSERT INTO table SELECT ...
    The query is:
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      The INSERT INTO code:
    TRUNCATE TABLE applicant_summary;
    INSERT /*+ APPEND */
    INTO     applicant_summary
    (  account_number
    ,  main_borrower_status
    ,  num_apps
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      When run as a query, this code consistently returns 2 for the num_apps field (for a certain group of accounts), but when run as an INSERT INTO command, the num_apps field is logged as 1. I have secured the tables used within the query to ensure that nothing is changing the data in the underlying tables.
    If I run the query as a cursor for loop with an insert into the applicant_summary table within the loop, I get the same results in the table as I get when I run as a stand alone query.
    I would appreciate any suggestions for what could be causing this odd behaviour.
    Cheers,
    Steve
    Oracle database details:
    Oracle Database 10g Release 10.2.0.2.0 - Production
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    Edited by: stevensutcliffe on Oct 10, 2008 5:26 AM
    Edited by: stevensutcliffe on Oct 10, 2008 5:27 AM

    stevensutcliffe wrote:
    Yes, using COUNT(*) gives the same result as COUNT(1).
    I have found another example of this kind of behaviour:
    Running the following INSERT statements produce different values for the total_amount_invested and num_records fields. It appears that adding the additional aggregation (MAX(amount_invested)) is causing problems with the other aggregated values.
    Again, I have ensured that the source data and destination tables are not being accessed / changed by any other processes or users. Is this potentially a bug in Oracle?Just as a side note, these are not INSERT statements but CTAS statements.
    The only non-bug explanation for this behaviour would be a potential query rewrite happening only under particular circumstances (but not always) in the lower integrity modes "trusted" or "stale_tolerated". So if you're not aware of any corresponding materialized views, your QUERY_REWRITE_INTEGRITY parameter is set to the default of "enforced" and your explain plan doesn't show any "MAT_VIEW REWRITE ACCESS" lines, I would consider this as a bug.
    Since you're running on 10.2.0.2 it's not unlikely that you hit one of the various "wrong result" bugs that exist(ed) in Oracle. I'm aware of a particular one I've hit in 10.2.0.2 when performing a parallel NESTED LOOP ANTI operation which returned wrong results, but only in parallel execution. Serial execution was showing the correct results.
    If you're performing parallel ddl/dml/query operations, try to do the same in serial execution to check if it is related to the parallel feature.
    You could also test if omitting the "APPEND" hint changes anything but still these are just workarounds for a buggy behaviour.
    I suggest to consider installing the latest patch set 10.2.0.4 but this requires thorough testing because there were (more or less) subtle changes/bugs introduced with [10.2.0.3|http://oracle-randolf.blogspot.com/2008/02/nasty-bug-introduced-with-patch-set.html] and [10.2.0.4|http://oracle-randolf.blogspot.com/2008/04/overview-of-new-and-changed-features-in.html].
    You could also open a SR with Oracle and clarify if there is already a one-off patch available for your 10.2.0.2 platform release. If not it's quite unlikely that you are going to get a backport for 10.2.0.2.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • SQL query for custom alert view

    I have created a custom alert view and scoped to show alerts related to group of servers.
    Alert view Criteria: Resolution State - New, Severity - Warning and Critical, Group - "Group 1"
    I am trying to query the Operations Manager database to show the alerts with same criteria using below query.
    select MonitoringObjectName, ResolutionState, Priority, Severity, TimeRaised, TimeAdded, TimeResolved, AlertStringName, AlertStringDescription from AlertView where ResolutionState = '0' AND (Severity = '2' or Severity = '1')
    AND
    MonitoringObjectId IN (select TargetObjectId from RelationshipGenericView
    where SourceObjectDisplayName = 'Group 1')
    in Console i see both warning and critical alerts where as in SQL query output i see only critical alerts.  Could you please correct if I am using wrong query. also please share your suggessions if i am completely wrong on this.
    Kind Regards,
    Bommi
    ~Bommi

    your query looks perfectly fine. Are you sure if the alerts you see in the console are of the 'Resolution State =0' (New). It might be the case where the alert have moved to a fidderent resolution state.
    Also, take a sample warming alert from console, query for the same in DB and check the Severity value. If it is '2'.
    Regards,
    Saravanan

  • How to make Custom Discoverer workbook use Custom Security profile of Apps

    We use Discoverer in Oracle Apps setup. We have added Custom security in our HR People Form of Apps.
    This Custom Security restricts one HR Emplpoyee not view other HR employee record except for himself/herself. Also maintining that they should be able to view all other employee's records.
    The following code was put under the Security Profile Form -- > Custom Security Tab
    exists (select 1
    from per_jobs b
    where ASSIGNMENT.job_id = b.job_id
    and (b.name not like '%HR%')
    and (b.name not like '%Human%')
    and ASSIGNMENT.assignment_number is not null
    union
    select 1
    from fnd_user fu
    where fu.user_name = fnd_global.user_name
    and fu.employee_id = PERSON.person_id
    and ASSIGNMENT.assignment_number is not null)
    Above security profile works fine for HR People Form.
    However, It does not work for our Discoverer Workbooks. I found a note on Metalink 422841.1 which talks about leveraging the Custom Security of Apps in Discoverer Report. I read it, but did not get much clue.
    Can Anyone help.
    Thanks

    Hi,
    If you want to use custom HR security with Discoverer you have to ensure that the correct security filters are applied when the Discoverer reports are run. These filters can use the supplied HR_SECURITY package or you can develop your own conditions using table lookups or functions. To get the filters applied to your reports you have a number of options:
    1. Build the security into custom folders using additional conditions
    2. Use custom database views in Discoverer and build the security into the views
    3. Use mandatory conditions in you Discoverer folders using either a function call or database contexts set at login time
    4. Use VPD (Virtual Private Database)
    I am not sure which of these options you are using to implement your HR security in Discoverer. The last option, VPD, is the most flexible and can give the best performance but maybe it is more complex to set up.
    Rod West

  • Creation of custom security profile

    Hi,
    During creation of the security profile, there is field 'internal name' .
    What is the significance of this field and how the internal name should be maintained. As this field becomes display once the security profile is created.
    Pointers will be appreciated.
    Rgds,
    Madhan

    Hi Madan
    Internal name is used by the system to identify a profile. While creating a new profile e.g. System Administrator_XYZ which is lets say based on the original system admin profile but with limited rights (to be given to a few users), you can extend the original internal name and extend it for e.g. fci.profile.admin.xyz
    Hope this helps!
    Regards
    Mudit Saini

  • Sql Query in Custom Java Class in OIM 9x

    Hi All,
    I m having requirement where I need to execute SQL Select Query in custom java class.
    The class is a action class ,in a method I m trying to execute SQL Query as below
         sdkDataSet = new tcDataSet();
              dataprovider =sdkDataSet.getDataBase();
                   //sdkDataSet = new tcDataSet();
                   sdkDataSet.setQuery(dataprovider, sdkQuery);
                   sdkDataSet.executeQuery();
                   logger.debug(CLASSNAME + methodName + "Query Executed");
                   if (sdkDataSet.getRowCount() > 0)
                        sdkName = sdkDataSet.getString(0);
                        logger.debug(CLASSNAME + methodName+ "The sdkName is " + sdkName);
    Error is returned in logs
    tcDataSetException    Must set a query before executing
    I hope issue is coming due to dataprovider dbrefence.
    Kindly let me know how to execute sql query in a action class.
    Regards,
    Krish

    Hi Pallavi,
    Thanks for your reply...
    OOTB class Name is com.thortech.xl.webclient.actions.ApprovalsAction
    This class will display the pending Approvals for a user.On pending approval page, I need to add one more attribute let say email of the beneficiary user.I have a query which will fetch email value based on RequestID.
    select usr.usr_email from rqu rqu, usr usr, act act  where rqu.usr_key=usr.usr_key and usr.act_key=act.act_key and rqu.req_key=1234*
    Pls let me know if there is any way to get email with or with out executing Query.
    Regards,
    Krish

  • Malfunctioning of SQL Query after customizing the resultSetType ...

    I am developing a database system using Microsoft Access as the storage facility. All users are authenticated before accessing the system. I achieve this through the following SQL query that just simply compares the user logon to the Access database. It's working fine initially. However, when the ResultSet was switched from TYPE_FORWARD_ONLY to TYPE_SCROLL_INSENSITIVE, the executeQuery() failed to return any record. Does anyone know what could be the cause of this misbehavior, and how could I solve it ??
    Thanx in advance.
    String sql = "SELECT * FROM Staff WHERE username = 'mary' AND strComp(password, 'pp12344', 0) = 0";
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    results = stmt.executeQuery(sql);
    System.out.println(results.next()); //keep saying "false" meaning no record found ??
    ***********************************************************************

    TYPE_SCROLL_INSENSITIVE is not supported in the JDBC-ODBC bridge.

  • Excel ADODB Sql Query Execution taking hours when manipulate excel tables

    Hello All 
    I have 28000 records with 8 column in an sheet. When I convert the sheet into ADODB database and copy to new
    excel using below code it is executing in less than a min
    Set Tables_conn_obj = New ADODB.Connection
    Tables_conn_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Table_Filename & ";Extended Properties=""Excel 12.0;ReadOnly=False;HDR = Yes;IMEX=1"""
    Tables_conn_obj.Open Tables_conn_str
    First_Temp_sqlqry = "Select * INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1] Table [first - Table$];" Tables_conn_obj.Execute First_Temp_sqlqry
    But when I change the query to manipulate one column in current table based on another table in the same excel
    and try to copy the results in another excel, it is taking more than one hour.. why it is taking this much time when both the query results returns the same number of rows and column. I almost spend one week and still not able to resolve this issue.
    Even I tried copyfromrecordset, getrows(), getstring(), Looping each recordset fields options all of them taking
    same amount of time. Why there is huge difference in execution time.
    Important note: Without into statement even below query is executing in few seconds.
    select ( ''''''manipulating first column based on other table data''''''''''''''
    iif(
    [Second - Table$].[Policy Agent] = (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01') ) , (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01')) ,
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$]where [ACA T$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01') ), (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01')) ,
    [Second - Table$].[Policy Agent] ))) as [Policy Agent],
    ''''''summing up all other columns''''''''''''''
    (iif(isnull(sum([Second - Table$].[Auto BW-Line Of Business Detail])),0,sum([Second - Table$].[Auto BW-Line Of Business Detail]))) as [Auto BW-Line Of Business Detail],(iif(isnull(sum([Second - Table$].[Auto Farmers])),0,sum([Second - Table$].[Auto Farmers]))) as [Auto Farmers],(iif(isnull(sum([Second - Table$].[MCA])),0,sum([Second - Table$].[MCA]))) as [MCA],(iif(isnull(sum([Second - Table$].[CEA])),0,sum([Second - Table$].[CEA]))) as [CEA],(iif(isnull(sum([Second - Table$].[Commercial P&C])),0,sum([Second - Table$].[Commercial P&C]))) as [Commercial P&C],(iif(isnull(sum([Second - Table$].[Comm WC])),0,sum([Second - Table$].[Comm WC]))) as [Comm WC],(iif(isnull(sum([Second - Table$].[Fire Farmers])),0,sum([Second - Table$].[Fire Farmers]))) as [Fire Farmers],(iif(isnull(sum([Second - Table$].[Flood])),0,sum([Second - Table$].[Flood]))) as [Flood],(iif(isnull(sum([Second - Table$].[Kraft Lake])),0,sum([Second - Table$].[Kraft Lake]))) as [Kraft Lake],(iif(isnull(sum([Second - Table$].[Life])),0,sum([Second - Table$].[Life]))) as [Life],(iif(isnull(sum([Second - Table$].[Foremost])),0,sum([Second - Table$].[Foremost]))) as [Foremost],(iif(isnull(sum([Second - Table$].[Umbrella])),0,sum([Second - Table$].[Umbrella]))) as [Umbrella],(iif(isnull(sum([Second - Table$].[MCNA])),0,sum([Second - Table$].[MCNA]))) as [MCNA]
    INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1]
    from [Second - Table$] group by [Second - Table$].[Policy Agent] ;

    Hi Fei,
      Thank you so much for the reply post. I just executed the same above SQL without INTO Statement and assigned the SQL result to ADODB recordset as below. If the time difference is due to the SQL query then below statements also should execute for hours
    right, but it gets executed in seconds. But to copy the recordset to excel again it is taking hours. I tried copyfromrecordset,
    getrows(), getstring(), Looping each recordset fields options and all of them taking same amount of time. Please let me know there is delay in time for this much small data
    Even I tried to typecast all columns to double, string in SQL and still the execution time  is not reduced. 
    First_Temp_Recordset.Open sql_qry, Tables_conn_obj, adOpenStatic, adLockOptimistic ''' OR SET First_Temp_Recordset = Tables_conn_obj.Execute sql_qry

  • Excel ADODB Sql Query Execution taking hours when manipulate excel tables why?

    I have 28000 records with 8 column in an sheet. When I convert the sheet into ADODB database and copy to new excel using below code it is executing in less than a min
    Set Tables_conn_obj = New ADODB.Connection Tables_conn_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Table_Filename & ";Extended Properties=""Excel 12.0;ReadOnly=False;HDR = Yes;IMEX=1""" Tables_conn_obj.Open
    Tables_conn_str First_Temp_sqlqry = "Select * INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1] Table [first - Table$];" Tables_conn_obj.Execute First_Temp_sqlqry
    But when I change the query to manipulate one column in current table based on another table in the same excel and try to copy the results in another excel, it is taking more than one hour.. why it is taking this much time when both the query results returns
    the same number of rows and column. I almost spend one week and still not able to resolve this issue.
    Even I tried copyfromrecordset, getrows(), getstring(), Looping each recordset fields options all of them taking same amount of time. Appreciate any inputs...
    select ( ''''''manipulating first column based on other table data''''''''''''''
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where
    [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01') ) , (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate]
    = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01')) ,
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$]where
    [ACA T$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01') ), (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate]
    = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01')) ,
    [Second - Table$].[Policy Agent] ))) as [Policy Agent],
    ''''''summing up all other columns''''''''''''''
    (iif(isnull(sum([Second - Table$].[Auto BW-Line Of Business Detail])),0,sum([Second - Table$].[Auto BW-Line Of Business Detail]))) as [Auto BW-Line Of Business Detail],(iif(isnull(sum([Second - Table$].[Auto Farmers])),0,sum([Second - Table$].[Auto Farmers])))
    as [Auto Farmers],(iif(isnull(sum([Second - Table$].[MCA])),0,sum([Second - Table$].[MCA]))) as [MCA],(iif(isnull(sum([Second - Table$].[CEA])),0,sum([Second - Table$].[CEA]))) as [CEA],(iif(isnull(sum([Second - Table$].[Commercial P&C])),0,sum([Second
    - Table$].[Commercial P&C]))) as [Commercial P&C],(iif(isnull(sum([Second - Table$].[Comm WC])),0,sum([Second - Table$].[Comm WC]))) as [Comm WC],(iif(isnull(sum([Second - Table$].[Fire Farmers])),0,sum([Second - Table$].[Fire Farmers]))) as [Fire
    Farmers],(iif(isnull(sum([Second - Table$].[Flood])),0,sum([Second - Table$].[Flood]))) as [Flood],(iif(isnull(sum([Second - Table$].[Kraft Lake])),0,sum([Second - Table$].[Kraft Lake]))) as [Kraft Lake],(iif(isnull(sum([Second - Table$].[Life])),0,sum([Second
    - Table$].[Life]))) as [Life],(iif(isnull(sum([Second - Table$].[Foremost])),0,sum([Second - Table$].[Foremost]))) as [Foremost],(iif(isnull(sum([Second - Table$].[Umbrella])),0,sum([Second - Table$].[Umbrella]))) as [Umbrella],(iif(isnull(sum([Second - Table$].[MCNA])),0,sum([Second
    - Table$].[MCNA]))) as [MCNA]
    INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1]
    from [Second - Table$] group by [Second - Table$].[Policy Agent] ;

    Hi Fei,
      Thank you so much for the reply post. I just executed the same above SQL without INTO Statement and assigned the SQL result to ADODB recordset as below. If the time difference is due to the SQL query then below statements also should execute for hours
    right, but it gets executed in seconds. But to copy the recordset to excel again it is taking hours. I tried copyfromrecordset,
    getrows(), getstring(), Looping each recordset fields options and all of them taking same amount of time. Please let me know there is delay in time for this much small data
    Even I tried to typecast all columns to double, string in SQL and still the execution time  is not reduced. 
    First_Temp_Recordset.Open sql_qry, Tables_conn_obj, adOpenStatic, adLockOptimistic ''' OR SET First_Temp_Recordset = Tables_conn_obj.Execute sql_qry

  • Owner information from Device ID when creating provisioning profile

    Hi,
    Is it possible to get information about the owner of the iPhone whose Device ID is added while creating provisioning profile for ad-hoc distribution?
    All the best,
    Saad

    I don't think so... if it's possible I doubt it's easy.... but you can give each device any name you want in your profile (rather than the name of their iPhone or iPod, which can be pretty random)
    So when I enter them here, I use the person's name as my identifier in the provisioning profile (post-its can do wonders if you have a whole pile of phones to enter)... that way you can easily tell whose phones you've already set up and whose you have not....

  • Sql query to find out when was the skillgroup created

    Doees anyone know the field which points to the date time when a skillgorup created?I have refered to the schema document-but most dbtime usually points to The current date and time stamp when the records are written to the DBDATETIME’,’ Date and time the agent logged into the skill group,etc.

    Looking at the first time a call was offered against the skill group, or looking at the time stamp of the first ICM script to reference the SG sound like the best options... but still leave a lot of room for error. They basically give you a "created no later than" date. If your ICM is set to automatically keep only a certain number of script versions, you lose history of skill group creation date after a few new script version saves. Call data has a retention period depending on your setup as well.
    One more date you can look at is the earliest schedule on the Call Type. This will have the longest-held dates, but of course this won't give you anything for call types which you only reference within scripts, and will miss data for any schedules you've previously removed from Call Types. (I typically only schedule Call Types that are assigned to DNs, and use Go To Script nodes for script-to-script movement instead of Requalify Call for ease of viewing call flows)
    Why do you need to see when Call Types were created?
    -Jameson

  • SQL Query with 3 tables to create a view

    Hi
    I have got an existing view "View_output" formed with a query which works fine:
    select A,B,C,D,E,F,G,H from GTS1 where D is not null
        UNION
       select A,B,C,D,E,F,G,H from GTSN1 where D is not null;It works fine, in the output I have columns A,B,C,D,E,F,G,H
    New requirement : Modify the view, by adding a new column 'I' so that the view should have
    columns A through I, and no column values should be null.
    This column "I" is coming from a table, say DLC
    Data in DLC is a subset of the original view "View_output"and DLC have the foll.columns:
    ("View_output" is a datablock source for a form and only selected column values are put as output in DLC
    after form manipulation)
    DLC is having only 5 columns -B,C,F,H,I
    When I give:
    (select A,B,C,D,E,F,G,H,NULLfrom GTS1 where D is not null
        UNION
       select A,B,C,D,E,F,G,H,NULL from GTSN1 where D is not null)
    UNION
    select NULL,B,C,NULL,NULL,F,NULL,H,I
        from
        DLC where I IS NOT NULL;It UNIONS all required rows in the 3 tables but columns A,D,E,G are NULL, but how can I get
    data in these columns?
    Edited by: Krithi on 30-Oct-2009 05:43
    Edited by: Krithi on 30-Oct-2009 08:13

    Hi arun thats not the real isue..
    I have corrected the second code now, it was a typo from my side..
    all three tables already have 9 columns selected..
    The view created from GTS1 and GTSN1 is constantly changing
    There is no way to add column 'I' to any of these above tables
    The view is the input to a form..User ticks a tickbox corresponding to records needed by them (These are the columns in the original view mentioned above)..and based on certain logic,only selected columns are now inserted/updated into the output table through the form..this is the table DLC
    Now they want to insert a new data(free text) through the form, this field correspond to each record in the form ;this is supposed to be column 'I'(not designed yet)..
    this is not there in the original input tables selected for the view...But then I added this column to the output table DLC (Cant think of any other method) so that column I can also get combined in the view.
    Now what I want is recreate the view through,
    create or replace view statement.
    the view should effectively pull data from 3 tables .
    The relation between 3 tables :
    DLC is a subset of GTS1 and GTSN1
    but may also contain data which is not in union of GTS1 and GTSN1
    Only field I need from DLC is field 'I', and that too if the data is there in the union of GTS1 and GTSN1

Maybe you are looking for

  • Shell script for cols backup

    I wrote shell scriptevery thing is working like showning me names of datafiles but now showing member of redo logs and name of controlfile #!/usr/bin/sh TNS_ADMIN=/disk2/oracle/product/10.2.0/Db_1/network/admin export TNS_ADMIN ORACLE_HOME=/disk2/ora

  • Distributed Document Capture and date fields

    Greetings! We are using Oracle Distributed Document Capture and Universal Content Management as repository, it works fine. However we defined a custom metadata field with data type "date" in UCM and we defined a scan profile with its asssociated date

  • Bluetooth or AirPlay?  Have MacBook Pro/iPhone4/iPad

    I would like to: 1) Play content from my iPhone 4 through external stereo speakers 2) Play content from my iPad through same 3) Play content on my MacBook Pro As of now I have no external speakers.  I watch movies/videos on all three, play albums in

  • HELP!!! No free space since Photos transition

    Long story short- Photos is somehow locking up space on my iPad. In "usage" on the iPad, it says "Photos and camera" takes up 31.2GB. In the subdivision under that, 30.5GB are "synced from iTunes Library".  My camera roll is empty, and there are only

  • Outlook Backup Using Online Backup and Share

    I just started using online backup and share.  I selected the files for automatic backup including my Outlook PST and Archive PST(Outlook) Files.  It looks like my archive file backed up but not my main Outlook PST file.  Does Outlook need to be clos