Teradata Source SQL Server where clause In SSIS

Hi All,,
I want pull the data from Teradata to SQLServer .But Teradata source query in where clause around 200 productcodes manually. Instead of that one I want pass sqlserver table dynamically . creating  one temp table in ssis for sqlserver data and  
Teradata source query joining the temp table (with out where clause) Is it possible to implement this task in SSIS or
Best method to implement this task in ssis
Thanks
CMK...

Hi CMK,
You can create a staging table to store the productcodes used in the WHERE clause in the Teradata source query. Then, you can use Lookup Transformation in SSIS to achieve your goal.
If you use Enterprise or Developer Edition of SSIS 2008 or higher, you can install the Microsoft Connector Version for Teradata by Attunity to obtain the OLE DB provider for Teradata. You can use an OLE DB Source adapter to extract data from the Teradata
database without WHERE clause, then add a Lookup Transformation which lookups records from the staging table, and output the lookup match records to the destination SQL Server table.
Reference:
https://www.simple-talk.com/sql/ssis/implementing-lookup-logic-in-sql-server-integration-services/
Regards,
Mike Yin
TechNet Community Support

Similar Messages

  • Change my sql query where-clause in an extended controller

    Hello,
    i am trying to change my sql query where-clause in an extended controller
    personAplListVO.setWhereClause(null); // first set to null
    personAplListVO.setWhereClauseParams(null); // first set to null
    personAplListVO.setWhereClause(personAplListVOWhereClause +
    newWhereClause);
    personAplListVO.setWhereClauseParams(whereClauseParams);
    personAplListVO.executeQuery();
    System.out.println(">>>>>>>>getQuery = " + personAplListVO.getQuery());
    when i get the query ( personAplListVO.getQuery()) after executeQuery(), the new newWhereClause values are missing.
    Also i am getting null from personAplListVO.getWhereClause() after executeQuery()
    as if the above code is not making any effect.
    any ideas why?
    Thank you

    Hello,
    My Query:
    /* Formatted on 2011/06/15 15:50 (Formatter Plus v4.8.8) */
    SELECT /*+ FIRST_ROWS */
    NULL AS selectflag, ppf.full_name AS person_name,
    ppf.first_name AS person_first_name, ppf.last_name AS person_last_name,
    ppf.email_address, addr.derived_locale, addr.address_id,
    phn.phone_number, phn.phone_id, ppf.date_of_birth, addr.address_line1,
    (SELECT COUNT (*)
    FROM per_all_assignments_f paf2,
    per_all_people_f ppf2
    WHERE paf2.assignment_type = 'A'
    AND :1 BETWEEN paf2.effective_start_date AND paf2.effective_end_date
    AND paf2.person_id = ppf2.person_id
    AND paf2.effective_start_date BETWEEN ppf2.effective_start_date
    AND ppf2.effective_end_date
    AND ppf2.party_id = ppf.party_id
    HAVING COUNT (*) > 0) AS jobs_applied_for,
    (SELECT MAX (paf.effective_start_date)
    FROM per_all_assignments_f paf,
    per_all_people_f ppf2
    WHERE paf.assignment_type = 'A'
    AND :2 >= paf.effective_start_date
    AND paf.person_id = ppf2.person_id
    AND paf.effective_start_date BETWEEN ppf2.effective_start_date
    AND ppf2.effective_end_date
    AND ppf2.party_id = ppf.party_id) AS last_application,
    ppf.person_id, ppf.effective_start_date, ppf.effective_end_date,
    DECODE (vac.manager_id, :3, 'Y', 'N') AS my_applicants,
    vac.NAME AS vacancy_name, vac.vacancy_id, paf.assignment_id,
    (SELECT /*+ push_subq */
    MIN (pasf.effective_start_date)
    FROM per_all_assignments_f pasf
    WHERE pasf.assignment_id = paf.assignment_id) AS application_date,
    paf.effective_end_date AS assignment_end_date,
    ast.user_status AS application_status, ast.assignment_status_type_id,
    vac.status AS vacancy_status, mgr.full_name AS recruiting_manager,
    mgr.person_id AS recruiting_manager_id,
    mgr.effective_start_date AS effective_start_date1,
    mgr.effective_end_date AS effective_end_date1,
    rec.full_name AS recruiter, rec.person_id AS recruiter_id,
    rec.effective_start_date AS effective_start_date2,
    rec.effective_end_date AS effective_end_date2,
    ppf.per_information_category, ppf.per_information1,
    ppf.per_information2, ppf.per_information3, ppf.per_information4,
    ppf.per_information5, ppf.per_information6, ppf.per_information7,
    ppf.per_information8, ppf.per_information9, ppf.per_information10,
    ppf.per_information11, ppf.per_information12, ppf.per_information13,
    ppf.per_information14, ppf.per_information15, ppf.per_information16,
    ppf.per_information17, ppf.per_information18, ppf.per_information19,
    ppf.per_information20, ppf.per_information21, ppf.per_information22,
    ppf.per_information23, ppf.per_information24, ppf.per_information25,
    ppf.per_information26, ppf.per_information27, ppf.per_information28,
    ppf.per_information29, ppf.per_information30,
    FLOOR
    (irc_location_utility.sdo_miles (iwp.geometry, loc.geometry, 0.01)
    ) AS distance_to_location,
    loc.location_id, loc.derived_locale AS derived_locale1,
    doc.document_id, doc.file_name,
    NVL2 (doc.document_id, 'Y', 'N') AS previewenabled,
    inp.notification_preference_id, ppf.attribute_category, ppf.attribute1,
    ppf.attribute2, ppf.attribute3, ppf.attribute4, ppf.attribute5,
    ppf.attribute6, ppf.attribute7, ppf.attribute8, ppf.attribute9,
    ppf.attribute10, ppf.attribute11, ppf.attribute12, ppf.attribute13,
    ppf.attribute14, ppf.attribute15, ppf.attribute16, ppf.attribute17,
    ppf.attribute18, ppf.attribute19, ppf.attribute20, ppf.attribute21,
    ppf.attribute22, ppf.attribute23, ppf.attribute24, ppf.attribute25,
    ppf.attribute26, ppf.attribute27, ppf.attribute28, ppf.attribute29,
    ppf.attribute30, TO_CHAR (ROWNUM) AS rownumber,
    TO_CHAR
    ((irc_utilities_pkg.get_recruitment_person_id (ppf.person_id, :4))
    ) AS root_person_id,
    TO_CHAR
    (irc_skills_matching_pkg.vacancy_match_percent
    (irc_utilities_pkg.get_recruitment_person_id (ppf.person_id,
    :5
    vac.vacancy_id,
    :6
    ) AS match_percent,
    ppf.party_id, paf.effective_start_date AS assignment_start_date,
    pov.vendor_id, pov.vendor_name, regatmpt.attempt_id AS reg_attempt_id,
    TO_NUMBER (DECODE (regatmpt.raw_score, -1000, NULL, regatmpt.raw_score)
    ) AS reg_attempt_score,
    NVL2
    (regatmpt.mastery_score,
    DECODE (GREATEST (regatmpt.mastery_score, regatmpt.raw_score),
    regatmpt.raw_score, 'P',
    'F'
    NVL2 (fnd_profile.VALUE ('IRC_REGISTER_TEST'),
    NVL2 (inp.attempt_id, 'A', 'N'),
    NULL
    ) AS reg_attempt_status,
    aplatmpt.attempt_id AS apl_attempt_id,
    TO_NUMBER (DECODE (aplatmpt.raw_score, -1000, NULL, aplatmpt.raw_score)
    ) AS apl_attempt_score,
    NVL2
    (aplatmpt.mastery_score,
    DECODE (GREATEST (aplatmpt.mastery_score, aplatmpt.raw_score),
    aplatmpt.raw_score, 'P',
    'F'
    NVL2 (vac.assessment_id, NVL2 (iad.attempt_id, 'A', 'N'), NULL)
    ) AS apl_attempt_status,
    hrl.meaning, hrl.lookup_type, hrl.lookup_code,
    iad.assignment_details_id, iad.considered AS considered,
    vac.business_group_id,
    NVL
    ((SELECT iav.manage_applicants_allowed
    FROM irc_agency_vacancies iav
    WHERE iav.vacancy_id = vac.vacancy_id
    AND iav.agency_id = fnd_profile.VALUE ('IRC_AGENCY_NAME')),
    'Y'
    ) AS manage_applicants_allowed,
    DECODE (paf.source_type, 'ER', 'Y', 'N') AS referred,
    ircreferralinfoeo.start_date, ircreferralinfoeo.end_date,
    (SELECT meaning
    FROM hr_lookups
    WHERE lookup_code = ircreferralinfoeo.source_type
    AND lookup_type = 'REC_TYPE') AS sourcetype,
    DECODE (ircreferralinfoeo.source_type,
    'ER', (SELECT full_name
    FROM per_all_people_f
    WHERE person_id = ircreferralinfoeo.source_person_id
    AND SYSDATE BETWEEN effective_start_date
    AND effective_end_date),
    ircreferralinfoeo.source_name
    ) AS sourcename,
    ircreferralinfoeo.object_id, ircreferralinfoeo.object_type
    FROM per_addresses addr,
    per_phones phn,
    per_all_people_f ppf,
    per_all_assignments_f paf,
    per_all_vacancies vac,
    per_assignment_status_types_v ast,
    per_all_people_f mgr,
    per_all_people_f rec,
    irc_notification_preferences inp,
    hr_locations_all_vl loc,
    irc_documents doc,
    irc_search_criteria iwp,
    per_all_people_f irc_ppf,
    po_vendors pov,
    ota_attempts regatmpt,
    irc_assignment_details_f iad,
    ota_attempts aplatmpt,
    hr_lookups hrl,
    irc_referral_info ircreferralinfoeo
    WHERE irc_utilities_pkg.get_recruitment_person_id (ppf.person_id, :7) =
    irc_ppf.person_id
    AND :8 BETWEEN ppf.effective_start_date AND ppf.effective_end_date
    AND irc_ppf.party_id = ppf.party_id
    AND ppf.person_id = paf.person_id
    AND paf.assignment_type = 'A'
    AND paf.vacancy_id = vac.vacancy_id
    AND :9 BETWEEN paf.effective_start_date AND paf.effective_end_date
    AND paf.assignment_status_type_id = ast.assignment_status_type_id
    AND irc_ppf.person_id = doc.person_id(+)
    AND irc_ppf.person_id = phn.parent_id(+)
    AND phn.parent_table(+) = 'PER_ALL_PEOPLE_F'
    AND phn.phone_type(+) = 'H1'
    AND :10 BETWEEN NVL (phn.date_from(+), :11) AND NVL (phn.date_to(+), :12)
    AND vac.manager_id = mgr.person_id(+)
    AND :13 BETWEEN mgr.effective_start_date(+) AND mgr.effective_end_date(+)
    AND vac.recruiter_id = rec.person_id(+)
    AND :14 BETWEEN rec.effective_start_date(+) AND rec.effective_end_date(+)
    AND irc_ppf.person_id = inp.person_id(+)
    AND inp.person_id = addr.person_id(+)
    AND NVL (inp.address_id, DECODE (addr.address_type(+), 'REC', addr.address_id(+),
    -1)) = addr.address_id(+)
    AND :15 BETWEEN addr.date_from(+) AND NVL (addr.date_to(+), :16)
    AND loc.location_id(+) = vac.location_id
    AND doc.TYPE(+) LIKE '%RESUME'
    AND doc.end_date(+) IS NULL
    AND irc_ppf.person_id = iwp.object_id(+)
    AND iwp.object_type(+) = 'WPREF'
    AND :17 BETWEEN irc_ppf.effective_start_date AND irc_ppf.effective_end_date
    AND ( inp.agency_id = fnd_profile.VALUE ('IRC_AGENCY_NAME')
    OR fnd_profile.VALUE ('IRC_AGENCY_NAME') IS NULL
    AND inp.agency_id = pov.vendor_id(+)
    AND inp.attempt_id = regatmpt.attempt_id(+)
    AND paf.assignment_id = iad.assignment_id(+)
    AND :18 BETWEEN iad.effective_start_date(+) AND iad.effective_end_date(+)
    AND iad.latest_details(+) = 'Y'
    AND iad.attempt_id = aplatmpt.attempt_id(+)
    AND hrl.lookup_type(+) = 'VACANCY_STATUS'
    AND vac.status = hrl.lookup_code(+)
    AND paf.assignment_id = ircreferralinfoeo.object_id(+)
    AND SYSDATE BETWEEN ircreferralinfoeo.start_date(+) AND ircreferralinfoeo.end_date(+)
    AND ( 1 = 1
    AND (NVL (doc.document_id, 1) =
    NVL ((SELECT MAX (idoc1.document_id)
    FROM irc_documents idoc1
    WHERE idoc1.person_id = irc_ppf.person_id
    AND idoc1.TYPE IN ('RESUME', 'AUTO_RESUME')
    AND idoc1.end_date IS NULL
    AND idoc1.last_update_date =
    (SELECT MAX (idoc2.last_update_date)
    FROM irc_documents idoc2
    WHERE idoc2.person_id = irc_ppf.person_id
    AND idoc2.TYPE IN
    ('RESUME', 'AUTO_RESUME')
    AND idoc2.end_date IS NULL)),
    1
    and my where clause that i want to append to the existing one:
    and ppf.sex = 'M' and ppf.nationality = '1680'
    my processFormRequest function in my extended CO
    public void processFormRequest(OAPageContext pageContext,
    OAWebBean webBean) {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String genderValue = pageContext.getParameter("gender");
    String nationality = pageContext.getParameter("nationality");
    ViewObject personAplListVO = am.findViewObject("PersonAplListVO");
    String personAplListVOWhereClause = personAplListVO.getWhereClause();
    Object[] whereClauseParams = personAplListVO.getWhereClauseParams();
    String newWhereClause = "";
    //gender
    if (genderValue != null && !genderValue.trim().equals("")) {
    newWhereClause += " and ppf.sex = '" + genderValue + "'";
    //nationality
    if (nationality != null && !nationality.trim().equals("")) {
    newWhereClause += " and ppf.nationality = '" + nationality + "'";
    System.out.println("\n>>>>>>>>getQuery = " + personAplListVO.getQuery());
    System.out.println("\n>>>>>>>>newWhereClause = " + newWhereClause);
    if (!newWhereClause.equals("")) {
    personAplListVO.clearCache();
    personAplListVO.setWhereClause(null); // first set to null
    personAplListVO.setWhereClauseParams(null); // first set to null
    personAplListVO.setWhereClause(personAplListVOWhereClause +
    newWhereClause);
    personAplListVO.setWhereClauseParams(whereClauseParams);
    personAplListVO.executeQuery();
    // System.out.println(">>>>>>>>newWhereClause" +
    // personAplListVOWhereClause + newWhereClause);
    // System.out.println(">>>>>>>>getWhereClause" +
    // personAplListVO.getWhereClause());
    // System.out.println(">>>>>>>>getQuery = " +
    // personAplListVO.getQuery());
    any tips?
    thanks a lot

  • Tables in MS SQL server where role names are stored

    hi
    Please let me know the table in MS SQL server where the authorisations and role names are stored

    Hi,
    Table agr_define stores the roles.
    Some more tables in this regard are as under
    AGR_AGRS                       Roles in Composite Roles
    AGR_PROF                       Profile name for role 
    AGR_SELECT                     Assignment of roles to Tcodes
    AGR_TCDTXT                     Assignment of roles to Tcodes
    AGR_TCODE3                     Assignment of roles to Tcodes
    AGR_TCODES                     Assignment of roles to Tcodes
    AGR_USERS                      Assignment of roles to users 
    AGR_USERT                      Assignment of roles to users 
    etc etc.
    To explore more in Tcode SE11 enter AGR* and search.
    Table USOBT details reln between tcode and auth object.
    Hope this helps
    Pl dont forget to award points.
    Regards

  • SQL SERVER - Error while executing SSIS package on specific environment : Connection manager - The specified module could not be found

    I have deployed my SSIS packages on SQL 2008 server.
    I have a .bat file which will invoke these packages and also the bat file is placed in the server where the SSIS packages are deployed.
    Scenario 1:
    I double clicked on the bat file to invoke the SSIS packages and ; this executed successfully
    Scenario 2:
    I have used the IBM Tivoli work scheduler(TWS)  to invoke the bat file which in tern will invoke the ssis packges; 
    but when i do this i am getting the below error
     Code: 0x8007007E
       Source: SSIS_Master_Event_Data_Transfer Connection manager "Config DB"
       Description: The specified module could not be found.
    Config BD is a connection manager which will get the connection string from the config file of the SSIS package.
    Please help me to resolve this issue.
    Regards,
    Prakash

    Check you TWS jobmanrc.cmd configuration file.   You may need to add a PATH environment variable in that file that includes your SQL Server file locations.   When TWS jobs are executed, they may not be executing with the same
    PATH variable as when you execute the SSIS outside of TWS.

  • Performance Point Services Data Source Sql Server Table.

    Hi,
    I have a requirement where I need to create a matrix report which shows resource capacity and deomand fromProject Server 2010 databases which involves joining of multiple tables and views from the database.
    But in Performance Point Service 2010 I am not able to write query to join multiple tables it'sjust showing one option in Data Connection to create connection to a database and specific one table not like SSRS where we can connect to database and can query
    multiple tables and views to render the report as required.
    So can any body suggest in case I am missing something in PPS 2010 or we cant joing or write sql query in PPS 2010
    Thanks

    I would join the tables in a view as Regis suggested or simply pull the information into a PowerPivot model and use that in SharePoint to connect to in PPS.  If you go that route then you will be able to use a multidimensional source and can create
    Analytical Reports.
    http://denglishbi.wordpress.com/2011/01/03/using-powerpivot-with-performancepoint-services-pps-2010/
    http://denglishbi.wordpress.com/2012/02/09/using-performancepoint-services-pps-with-powerpivot-sql-server-2012-rc0/

  • Need to load the data from oledb source(sql server table to ) ODBC destination table. )

    I have around 700,000 records that is needed to be moved from a table that exists in my sql server 2012 database table to the DB3 database table. I am using currently oledb source and ado.net as destination to do this
    transfer. But its taking more than 2 hrs, I need to get this done fast, there should be a way. but I am not able to get it done faster can any one help please....
    Thank you 

    I suspect you are talking about DB2 database. In that case I would recommend you check the commercial COZYROC
    DB2 Destination component. It is 20x faster compared to the standard RBAR insertion.
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • SQL SERVER AGENT JOB ERROR - SSIS PACKAGE

    Hi , 
    I have a SQL server agent job which runs SSIS package as the daily job. The SSIS package contains multiple child package. Its a master package which calls other SSIS package. The master package calls 23 SSIS packages, few of the packages runs in parallel.
    I am getting the below 2 different errors more frequently. It fails only in the production server, I scheduled the job in UAT server, it did not fail. Also when we run the master package with out sql agent job, it did not fail. 
    Error 1 :
    R6025  - pure virtual function call.  The return value was unknown.  The process exit code was 255.  The step failed.
    Error 2 : The step did not generate any output.  The return value was unknown.  The process exit code was -1073741819.  The step failed.
    We tried browsing for the answers ,no luck. It failing in live , so we need to run the package manually in live server every time. 
    Please help me to resolve this issue. Thanks in advance.
    Regards, 
    Dhivya Sivakumar

    Hi Vijeth, 
    Thanks for your reply. 
    1) Run the Package manually and check whether it runs successfully.  -
    No Failures. Package completed succesfully
    2) If Step 1 is successful,
    a) Point the same package to the UAT database and run it and check whether it runs successfully or not. -
    We tried to schedule the package almost for 1 month. No failures in UAT. 
    b) In UAT database, point to the Production database and run the package. - I am not sure, if i can do this.I will try and let you know the result.
         These steps will help us identify whether the problems lies within the package or the Environment. 
    3) Run the Package manually in production Environment using dtexec utilily. -
    No Failures. Success.
    4) Check the ID used to run the SQL Agent job and modify to an account with elevated permissions or GRANT more permissions to the existing ID. -
    The account used currently is having all the privileges. Its the most powerful user in live DB. 
    Regards, 
    Dhivya S

  • PPR error with sql with where clause

    dear pakar,
    why my PPR report error using this query
    Select process_id,
    to_char(start_date, 'Dy DD-Mon-YYYY HH24:MI:SS') start_date,
    to_char(finish_date, 'Dy DD-Mon-YYYY HH24:MI:SS') finish_date,
    to_char(sysdate, 'Dy DD-Mon-YYYY HH24:MI:SS') timestamp
    From status_process_list
    where created_by = :P9_GLOBAL_EMPLOYEE_ID
    (:P9_GLOBAL_EMPLOYEE_ID is in form, and value i can see, type text)
    call by functions :
    function mon_Refresh()
    if(html_SelectValue('P9_UPDATE_TIME') != 0)
    setInterval("mon_User_Refresh()",html_SelectValue('P9_UPDATE_TIME') * 1000);
    mon_User_Refresh()
    function mon_User_Refresh()
    var lGrab = $x('UPDATE_REPORT_body');
    var lReport = getElementsByClass('standard',lGrab,'TABLE')[0];
    var lReport_ID = lReport.id;
    html_PPR_Report_Page (null,lReport_ID.substring(2),$x(lReport_ID).getAttribute('htmldb:href'))
    thanks

    I'm having the same problem.
    One potential solutions is to use a custom SQL server JDBC driver instead of going through the ODBC bridge. This will minimize dependencies and should also improved performance. Hope this helps.
    - Joe

  • Sql server agent job with SSIS

    Hello Experts
    i have a sql server agent job that has four steps in tsql,ssis,tsql and tsql orders. the job run automatically every night and i copy paste the error message right here, any ideas please:
    Date                     
    1/27/2014 7:30:00 AM
    Log                        
    Job History (test [Mon-Fri AM])
    Step ID                
    1
    Server                  
    server1
    Job Name                           
    name [Mon-Fri AM]
    Step Name                        
    step one
    Duration                             
    00:34:33
    Sql Severity                       
    0
    Sql Message ID                
    0
    Operator Emailed                           
    Operator Net sent                          
    Operator Paged                               
    Retries Attempted                         
    0
    Message
    Executed as user x\serveragent. The step was cancelled (stopped) as the result of a stop job request.

    you can try default trace / event viewer to check if there is any entry on same .
    How to read default trace in sql server
    Thanks Saurabh Sinha
    http://saurabhsinhainblogs.blogspot.in/
    Please click the Mark as answer button and vote as helpful
    if this reply solves your problem

  • Import into SQL Server db from Sybase 7 data source - SQL Server 2008 R2/2012

    Hi,
    I need to import Sybase 7 data into a SQL Server 2008 R2 or 2012 database.
    Has anyone any experiences about this import?
    Thanks

    The nuance is in basically setting your connection manager right.
    If I remember correctly, I did that using the ODBC/ADO, but I do not remember the Sybase version.
    I suggest you visit a post dedicated to this operation (the author chose to use the ADO.NET type of a provider):
    http://msbimentalist.wordpress.com/2013/11/01/import-and-export-from-sql-server-to-sybase-db-using-ssis/ 
    Arthur My Blog

  • JBO datasources: avoiding literal SQL in where clause

    I understand that it is possible to set the where clause when defining a datasource with datatags:
    e.g.
    <jbo:DataSource id="ds" appid="wms_bc4j.Wms_bc4jModule" viewobject="WebUsersView" whereclause="USER_ID = 1"/>
    However this results in literal SQL being sent to the database. Does anyone know of a method of using bind variables in this instance and thus avoid the literal SQL?

    Hi,
    You need to "CAST" the bind variable to get the comma separated individual values.
    Check this out article (Search for Using Comma-Separated String Bind for Variable IN List) on how to achieve this.
    It has been developed on 10g. But, i think it will hold good for 11g as well.
    -Arun

  • Data source - SQL server in company LAN

    Hi,
    I am using the trial version of PowerBI. I need to use SQL server as source which is available in my company LAN. If I create datasource providing the server name, will that provide access to PowerBI ? Is that related to IP  (no direct IP, thru company
    virtual LAN) ?
    Thanks,
    Paddy

    Scheduled Refresh FAQs
    Hi Paddy,
    You author the reports locally the same way you did before, i.e., connect through the PowerPivot tools to the local database or use Power Query to do that.
    When you upload the workbook to Power BI, you can configure schedule refresh on it, HOWEVER, for the schedule refresh to work properly, a Gateway and a Datasource need to be configured in the Power BI Admin Center. This step also includes downloading an
    agent that is installed on-premises and allows the data to be transferred upon refresh.
    Here are some useful links:
    Power BI Admin Center Help
    Scheduled Data Refresh for Power BI
    GALROY

  • Derive found flag in SQL with where clause using TABLE(CAST function

    Dear All,
    Stored procedure listEmployees
    ==========================
    CREATE OR REPLACE TYPE STRING_ARRAY AS VARRAY(8000) OF VARCHAR2(15);
    empIdList STRING_ARRAY
    countriesList STRING_ARRAY
    SELECT EMP_ID, EMP_COUNTRY, EMP_NAME, FOUND_FLAG_
    FROM EMPLOYEE WHERE
    EMP_ID IN
    (SELECT * FROM TABLE(CAST(empIdList AS STRING_ARRAY))
    AND EMP_COUNTRY IN
    (SELECT * FROM TABLE(CAST(countriesList AS STRING_ARRAY))
    =================
    I have a stored procedure which lists the employees using above simple query.
    Here I am using table CAST function to find the list of employees in one go
    instead of looping through each and every employee
    Everything fine until requirements forced me to get the FOUND_FLAG as well.
    Now I wanted derive the FOUND_FLAG by using rownum, rowid, decode functions
    but I was not successful
    Can you please suggest if there is any intelligent way to say weather the
    row is found for given parameters in the where clause?
    If not I may have to loop through each set of empIdList, countriesList
    and find the values individually just to set a flag. In this approach I can’t use
    the TABLE CAST function which is efficient I suppose.
    Note that query STRING_ARRAY is an VARRAY. It is very big in size and this procedure
    suppose to handle large sets of data.
    Thanks In advance
    Regards
    Charan
    Edited by: kmcharan on 03-Dec-2009 09:55
    Edited by: kmcharan on 03-Dec-2009 09:55

    If your query returns results, you have found them... so your "FOUND" flag might be a constant,...

  • Error : Data load from relation source (SQL Server 2005) to Essbase Cube

    Hi All,
    I am looking help from you. I am trying to load data from SQLServer 2005 table to Essbase Cube using IKM SQL to Hyperion Essbase (Metadata) Modules.
    I am getting below error. Let me know if i am missing some things.
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 61, in ?
    com.hyperion.odi.essbase.ODIEssbaseException: Invalid value specified [RULES_FILE] for Load option [null]
         at com.hyperion.odi.essbase.ODIEssbaseMetaWriter.validateLoadOptions(Unknown Source)
         at com.hyperion.odi.essbase.AbstractEssbaseWriter.beginLoad(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
         at org.python.core.PyMethod.__call__(PyMethod.java)
         at org.python.core.PyObject.__call__(PyObject.java)
         at org.python.core.PyInstance.invoke(PyInstance.java)
         at org.python.pycode._pyx3.f$0(<string>:61)
         at org.python.pycode._pyx3.call_function(<string>)
         at org.python.core.PyTableCode.call(PyTableCode.java)
         at org.python.core.PyCode.call(PyCode.java)
         at org.python.core.Py.runCode(Py.java)
         at org.python.core.Py.exec(Py.java)
         at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    com.hyperion.odi.essbase.ODIEssbaseException: com.hyperion.odi.essbase.ODIEssbaseException: Invalid value specified [RULES_FILE] for Load option [null]
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)

    ODI Step: Prepare for Loading Step:
    from java.util import HashMap
    from java.lang import Boolean
    from java.lang import Integer
    from com.hyperion.odi.common import ODIConstants
    from com.hyperion.odi.connection import HypAppConnectionFactory
    # Target planning connection properties
    serverName = "HCDCD-HYPDB01"
    userName = "admin"
    password = "<@=snpRef.getInfo("DEST_PASS") @>"
    application = "BUDGET01"
    database = "PLAN1"
    portStr = "1423"
    srvportParts = serverName.split(':',2)
    srvStr = srvportParts[0]
    if(len(srvportParts) > 1):
    portStr = srvportParts[1]
    # Put the connection properites and initialize the essbase loader
    targetProps = HashMap()
    targetProps.put(ODIConstants.SERVER,srvStr)
    targetProps.put(ODIConstants.PORT,portStr)
    targetProps.put(ODIConstants.USER,userName)
    targetProps.put(ODIConstants.PASSWORD,password)
    targetProps.put(ODIConstants.APPLICATION_NAME,application)
    targetProps.put(ODIConstants.DATABASE_NAME,database)
    targetProps.put(ODIConstants.WRITER_TYPE,ODIConstants.DATA_WRITER)
    print "Initalizing the essbase wrapper and connecting"
    pWriter = HypAppConnectionFactory.getAppWriter(HypAppConnectionFactory.APP_ESSBASE, targetProps);
    tableName = "BUDGET01_PLAN1"
    rulesFile = r"ActLd"
    ruleSeparator = "Tab"
    clearDatabase = "None"
    calcScript = r""
    maxErrors = 1
    logErrors = 1
    errFileName = r"E:\OraHome_ODI\Error\Budget01Plan1.err"
    logEnabled = 1
    logFileName = r"E:\OraHome_ODI\Error\Budget01Plan1.log"
    errColDelimiter = r","
    errRowDelimiter = r"\r\n"
    errTextDelimiter = r"'"
    logHeader = 1
    commitInterval = 1000
    calcOnly = 0
    preMaxlScript = r""
    postMaxlScript = r""
    abortOnPreMaxlError = 1
    # set the load options
    loadOptions = HashMap()
    loadOptions.put(ODIConstants.CLEAR_DATABASE, clearDatabase)
    loadOptions.put(ODIConstants.CALCULATION_SCRIPT, calcScript)
    loadOptions.put(ODIConstants.RULES_FILE, rulesFile)
    loadOptions.put(ODIConstants.LOG_ENABLED, Boolean(logEnabled))
    loadOptions.put(ODIConstants.LOG_FILE_NAME, logFileName)
    loadOptions.put(ODIConstants.MAXIMUM_ERRORS_ALLOWED, Integer(maxErrors))
    loadOptions.put(ODIConstants.LOG_ERRORS, Boolean(logErrors))
    loadOptions.put(ODIConstants.ERROR_LOG_FILENAME, errFileName)
    loadOptions.put(ODIConstants.RULE_SEPARATOR, ruleSeparator)
    loadOptions.put(ODIConstants.ERR_COL_DELIMITER, errColDelimiter)
    loadOptions.put(ODIConstants.ERR_ROW_DELIMITER, errRowDelimiter)
    loadOptions.put(ODIConstants.ERR_TEXT_DELIMITER, errTextDelimiter)
    loadOptions.put(ODIConstants.ERR_LOG_HEADER_ROW, Boolean(logHeader))
    loadOptions.put(ODIConstants.COMMIT_INTERVAL, Integer(commitInterval))
    loadOptions.put(ODIConstants.RUN_CALC_SCRIPT_ONLY,Boolean(calcOnly))
    loadOptions.put(ODIConstants.PRE_LOAD_MAXL_SCRIPT,preMaxlScript)
    loadOptions.put(ODIConstants.POST_LOAD_MAXL_SCRIPT,postMaxlScript)
    loadOptions.put(ODIConstants.ABORT_ON_PRE_MAXL_ERROR,Boolean(abortOnPreMaxlError))
    #call begin load
    pWriter.beginLoad(loadOptions)
    Execution step from opartor:
    Read rows: 0
    Insert/Delete/updat rows: 0
    ODI Step: Load Data Into Essbase
    from com.hyperion.odi.common import ODIConstants
    from com.hyperion.odi.connection import HypAppConnectionFactory
    from java.lang import Class
    from java.lang import Boolean
    from java.sql import *
    from java.util import HashMap
    # Get the select statement on the staging area:
    sql= """select C1_ACCOUNT "Account",C3_TIMEPERIOD "TimePeriod",C4_LOBS "LOBs",C5_TREATY "Treaty",C6_SCENARIO "Scenario",C7_VERSION "Version",C8_CURRENCY "Currency",C9_YEAR "Year",C10_DEPARTMENT "Department",C11_ENTITY "Entity",C2_DIVLOC "DivLoc",C12_DATA "Data" from OdiMapping.dbo.C$_0BUDGET01_PLAN1Data where      (1=1) """
    srcCx = odiRef.getJDBCConnection("SRC")
    stmt = srcCx.createStatement()
    srcFetchSize=30
    stmt.setFetchSize(srcFetchSize)
    rs = stmt.executeQuery(sql)
    #load the data
    stats = pWriter.loadData(rs)
    #close the database result set, connection
    rs.close()
    stmt.close()
    ODI Step: Report Statistics
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 2, in ?
    Essbase Writer Load Summary:
         Number of rows successfully processed: 1
         Number of rows rejected: 0
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    Where am i doing wronge for data load in Essbase? How I will find correct information to load data into Essbase?

  • Plain SQL Conditional WHERE Clause with two sub-selects

    Hi SQL Experts,
    I need a bit quick of help with a query.
    This is a "select" statement for an OBI repository phyiscal table source object.
    So I cant put PL/SQL or Stored Procedures in it. I just need
    to have two different conditions/selects depending on the user role (this information comes
    from the session).
    The above, does not work:
    --------------ORA00905. 00000 -  "missing keyword"
      SELECT OFFICENO FROM orgunit
      WHERE
      CASE WHEN 'SESSION_VARIABLE' LIKE '%globalmanager%' THEN  
            ASSIGNEDOFFICES =
            SELECT DISTINCT ASSIGNEDOFFICES
            FROM USERSTABLE INNER JOIN orgunit ON
            orgunit.OFFICEKEY = USERSTABLE.OFFICEKEY
            WHERE USERSTABLE.USERNAME ='VALUEOF(NQ_SESSION.USER)'
      ELSE
            OFFICENO =
            SELECT DISTINCT OFFICENO FROM USERSTABLE
            INNER JOIN orgunit ON
            orgunit.OFFICEKEY = USERSTABLE.OFFICEKEY
            WHERE USERSTABLE.USERNAME ='VALUEOF(NQ_SESSION.USER)'
      END;   
    Can anyone help?

    Hi,
    I can't tell what you want to do just by looking at code that doesn't do it. Maybe:
    SELECT  officeno
    FROM    orgunit
    WHERE   (    session_variable  LIKE '%globalmanager%'
            AND  assignedofficies  IN
                     SELECT  assignedoffices
                     FROM    usertable  u1
                     JOIN    orgunit    o1  ON o1.officekey = u1.officekey
                     WHERE   u1.username    = 'VALUEOF(NQ_SESSION.USER)'
    OR      (    NVL ( session_variable
                     )        NOT LIKE '%globalmanager%'
            AND  officeno        IN
                     SELECT  officeno
                     FROM    usertable  u2
                     JOIN    orgunit    o2  ON  o2.officekey = u2.officekey
                     WHERE   u2.username   = 'VALUEOF(NQ_SESSION.USER)'
    There might be some simpler and more efficient way, depending on your tables and your reuirements.
    The condition u2.username   = 'VALUEOF(NQ_SESSION.USER)' is almost certainly not what you really want.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002

Maybe you are looking for