Problems in SQL transform with variable in statement

Hi,
I have an sql transform with a variable in the statement. It looks like this:
SELECT * FROM I.X where I.X.CUSTOMERNUMBER IN ([$variable])
I have a script running prior which sets the $variable = '\'366800\',\'000933\'';
(the CUSTOMERNUMBER field is a string)
The problem is when DI compiles the SQL with the variable value, it is replacing each single quote with two single quotes, and thus turning my list of values into a single string (as recognised by DB2).
How can I work around this? The CUSTOMERNUMBER field is indexed and the table is very large, so I want to use a very efficient statement to retrieve the data. I'm inserting this data into a different database, so I can't use the sql() function to execute the query and insert the rows into a new table in the same database (don't have authority to do that).
I also need the sql to be dynamic because the customer numbers required will change from time to time. They're listed in another database and I plan on writing a loop to set the $variable value to contain all values in the lookup table, but I can't use that in a join because its in a different database and would not be efficient.
Does anyone have any ideas? I'm literally all out, have tried a wide range of things to no avail, and none of my colleagues can work it out either.
Thanks very much,
-Steve

I assume the SQL Transform is used only because of that in-list, not for other reasons....
In this book page here: https://boc.sdn.sap.com/node/20046 at the very bottom it isdescribed on how to use the pushdown_sql() function in a where clause to add *any* text of your choice into the select statement DI generates. In this example I used a "where exists" but you can easily change the text to
where key=5 and       pushdown_sql('my_datastore', 'CUSTOMERNUMBER IN ([$variable])')    and gender='M'
I used the key=5 and gender=M just to clarify the syntax (I hope).
For the SQL Transform, I wonder if you need the [$variable] syntax as well....

Similar Messages

  • SQL Transform with VARIABLE

    Hello!
    I have the SQL Transform with global variable.
    First, I have a script for iniciality the variable:
    $DATE_CUST= to_date('2011/11/15 00:00:00.000','YYYY/MM/DD HH24:MI:SS.FF');
    I print the variable, in the execution write:
    2800     896     PRINTFN     2011.11.15 00:00:00.000000000
    STEP in SQL Transforms: 
    1.  SELECT * FROM TABLE_CUSTOMER
    2.  PUSH the update Schema button
    3.  add the where clause:  WHERE DATE_CUSTOMER > [$DATE_CUST]
    4.  save the DataFlow.
    When the execute the job, But we got error...  The variable is null or empty
    In the log trace: 
    |Data flow DF_VAR|Reader SQL
    SELECT query <select * from TABLE_CUSTOMER
    WHERE DATE_CUSTOMER  > 
    The database error message is <Sybase SQL Server <CRMGCPSA> error message for operation <ct_results>: <Sybase ASE Server message number <102> State <1> Severity <15> From Server <ASEDWHD>:   Message Text is: Incorrect syntax near ')'.
    >.
    Why no have value the variable ?
    The script correct should be
    SELECT query <select * from TABLE_CUSTOMER
    WHERE DATE_CUSTOMER  >  2011.11.15 00:00:00.000000000

    Both braces and square brackets can be used to reference variables, however they behave slightly differently.
    suppose I have the following hard-coded SQL statement
    select * from al_funcinfo where name = 'avg'
    Now I want to make it dynamic, I can use a variable and some square brackets
    select * from al_funcinfo where name = '[$G_Name]'
    or braces
    select * from al_funcinfo where name = {$G_Name}
    As you can see, braces adds single quotes around the varible value.  It is very useful when constructing complex statements requiring string values to be delimited with quotes (as most SQL DBs do).  These variable interpolation techniques can be used in scripts.
    M

  • Cell Offload will Happen for pl/sql Block with variables

    Hello Experts,
    i am working on procedures on exadata now. i was confused with cell offload in exadata. somehow offload is not happening when i ran the sql statement in in pl/sql block with variables.
    here are my findings.
    when i ran insert into from select with values at toad, my query response time is very good. the total process is completed in less than a minute.
    i checked offload is happening.
    same sql statement is placed in plsql block with variable, procedure is taking lot of time and it is not completing. this case offload is not happening.
    is it true, if i use variables in pl/sql block will not use cell offload and smart scan?
    if yes, what is the work around.
    Thanks
    #! Pavan

    Hello Marc,
    Thanks for quick response.
    when i ran the query with literals in toad session i am getting response.
    when i run it with pl/sql block , block is not completing at all.
    here is the plsql block:
    My Apologies for sending big code,with out proper format.
    DECLARE
    P_BUSINESS_DATE DATE;
    P_BATCH_ID NUMBER;
    UTC_OFFSET NUMBER;
    BEGIN
    P_BUSINESS_DATE := to_date('02/01/2012', 'MM/DD/YYYY');
    P_BATCH_ID := 1;
    UTC_OFFSET := 0;
    INSERT /*+ APPEND */ INTO UPL_CLIENT_tbl
    ( reportdate,
    LastName,
    FirstName,
    MiddleInitial,
    AccountNumber,
    Address,
    City,
    State,
    Zip,
    HomePhone,
    WorkPhone,
    BirthDate,
    Age,
    Sex,
    NumberOfChildren,
    Occupation,
    LeadSource,
    Consultant,
    ProgramDirector,
    CallTaker,
    LeadDate,
    FirstVisitDate,
    LastVisitDate,
    BillType,
    ClientType,
    PreviousClientType,
    AppointmentDate,
    DoctorLetterRequired,
    OneYearPermStabilizationDate,
    UnlimitedPermStabilizationDate,
    MaritalStatus,
    ReferrerName,
    ReferrerCentreID,
    CentreID,
    PaymentDateOne,
    PaymentAmountOne,
    PaymentDateTwo,
    PaymentAmountTwo,
    PaymentDateThree,
    PaymentAmountThree,
    PaymentDateFour,
    PaymentAmountFour,
    LibraryPurchased,
    BalanceDue,
    FoodNSFBalance,
    ProductNSFBalance,
    ProgramNSFBalance,
    StartWeight,
    CurrentWeight,
    GoalWeight,
    Height,
    DateGoalWeightAchieved,
    DateSuccessPlusPurchased,
    ReturnToActiveDate,
    VersionNumber,
    HalfWayDate,
    LastLSCDate,
    LastUpdatedDate,
    VitaminWaiverSigned,
    LastSupplementPurchaseDate,
    LastSupplementCodePurchased,
    LastTotalSupplementSupplyCycle,
    LastAddtlSupplPurchaseDate,
    LastAddtlSupplCodePurchased,
    LastAddtlSupplSupplyCycle,
    DiabetesClient,
    DietControlled,
    TakingOralMed,
    TakingInsulin,
    EmailId,
    CTADate,
    RWLDate,
    Address2)
    (SELECT /*+ full(S_CONTACT) full(REFERRER) full(Consultant) full(ProgramDirector) full(CallTaker) full(S_CONTACT_X) full(a) full(a2) full (a3) */ distinct p_business_date reportdate,
    SUBSTR(S_CONTACT.LAST_NAME,1,25) AS LastName,
    SUBSTR(S_CONTACT.FST_NAME,1,25) AS FirstName,
    SUBSTR(S_CONTACT.MID_NAME,1,1) AS MiddleInitial,
    S_CONTACT.X_JC_ACNT_NUM + 900000000 AS AccountNumber,
    SUBSTR(S_ADDR_PER.ADDR,1,40) AS ADDRESS,
    SUBSTR(S_ADDR_PER.CITY,1,20) AS City,
    S_ADDR_PER.STATE AS State,
    SUBSTR(S_ADDR_PER.ZIPCODE,1,15) AS Zip,
    SUBSTR(REPLACE(S_CONTACT.HOME_PH_NUM,'-',''),1,10) AS HomePhone,
    SUBSTR(REPLACE(S_CONTACT.WORK_PH_NUM,'-',''),1,10) AS WorkPhone,
    S_CONTACT.BIRTH_DT AS BirthDate,
    CASE WHEN FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) < 0 THEN NULL ELSE FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) END AS AGE,
    S_CONTACT.SEX_MF AS SEX,
    NULL AS NumberOfChildren,
    S_CONTACT_X.ATTRIB_34 AS OCCUPATION,
    CASE WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Othe' THEN 'Othr'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Inte' THEN 'Intr'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Prin' THEN 'News'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Gues' THEN 'Gst'
    ELSE SUBSTR(S_CONTACT_X.ATTRIB_37,1,4) END AS LeadSource,
    SUBSTR(Consultant.EMP_NUM,1,10) AS CONSULTANT,
    ProgramDirector.EMP_NUM AS ProgramDirector,
    CallTaker.EMP_NUM CallTaker,
    S_CONTACT.X_LEAD_DT AS LeadDate,
    LEAST(nvl(S_CONTACT.X_LAST_CONSULTATION_DATE,O.FirstPurchaseDate ), nvl(O.FirstPurchaseDate,S_CONTACT.X_LAST_CONSULTATION_DATE+1) ) AS FirstVisitDate, --X_LAST_CONSULTATION_DATE stores the performed date or the legacy client firstvisitdate
    GREATEST(nvl(S_CONTACT_XM.X_CONSULTATION_DT ,S_CONTACT_X.ATTRIB_29), nvl(S_CONTACT_X.ATTRIB_29, S_CONTACT_XM.X_CONSULTATION_DT-1) ) AS LastVisitDate,
    CASE WHEN S_CONTACT.X_INSTALLMENT_BALANCE > 0 THEN 'B' ELSE NULL END AS BillType,
    ct.current_client_type ClientType,
    SUBSTR(ct.saved_client_type,1,1) PreviousClientType,
    S_CONTACT.LAST_CREDIT_DT AS AppointmentDate,
    CASE WHEN a.X_DR_LETTER_STATUS IS NOT NULL THEN 'Y' ELSE 'N' END AS DoctorLetterRequired,
    NULL AS OneYearPermStabilizationDate,
    DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT ,NULL) AS UnlimitedPermStabilizationDate,
    SUBSTR(S_CONTACT.MARITAL_STAT_CD,1,1) AS MaritalStatus,
    SUBSTR(REFERRER.FST_NAME ||' '|| REFERRER.LAST_NAME,1,34) AS ReferrerName,
    ORGEXT_REF.LOC AS ReferrerCentreID,
    S_ORG_EXT.LOC AS CentreID,
    NULL AS PaymentDateOne,
    NULL AS PaymentAmountOne,
    NULL AS PaymentDateTwo,
    NULL AS PaymentAmountTwo,
    NULL AS PaymentDateThree,
    NULL AS PaymentAmountThree,
    NULL AS PaymentDateFour,
    NULL AS PaymentAmountFour,
    NULL AS LibraryPurchased,
    nvl(S_CONTACT.X_INSTALLMENT_BALANCE,0) + nvl(S_CONTACT.X_PREPAID_BALANCE,0) AS BalanceDue, -- Changed operation from (-) prepaid to (+) prepaid since the sign was flipped in OLTP.
    NULL AS FoodNSFBalance,
    NULL AS ProductNSFBalance,
    NULL AS ProgramNSFBalance,
    a2.X_START_WEIGHT AS StartWeight,
    a2.X_CURRENT_WEIGHT AS CurrentWeight,
    a2.X_GOAL_WEIGHT AS GoalWeight,
    a3.X_HEIGHT AS Height,
    a2.X_FAXSENT_DATETIME DateGoalWeightAchieved,
    DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT,NULL) AS DateSuccessPlusPurchased,
    CASE WHEN A2.ARCHIVE_FLG = 'N' THEN a2.START_DT ELSE NULL END AS ReturnToActiveDate,
    600 VersionNumber,
    a2.X_FAXRECV_DATETIME AS HalfWayDate,
    NULL AS LastLSCDate,
    TRUNC(S_CONTACT.LAST_UPD-UTC_OFFSET/24) AS LastUpdatedDate,
    NULL AS VitaminWaiverSigned,
    LastSupplementPurchaseDate,
    LastSupplementCodePurchased,
    LastTotalSupplementSupplyCycle,
    LastAddtlSupplPurchaseDate,
    LastAddtlSupplCodePurchased,
    LastAddtlSupplSupplyCycle,
    CASE WHEN (a.X_DIABETES_NO_MEDS_FLG='Y' OR a.X_DIABETES_ORAL_MEDS_FLG = 'Y' OR a.X_DIABETES_ON_INSULIN_FLG = 'Y') THEN 'Y' ELSE 'N' END AS DiabetesClient,
    DECODE(a.X_DIABETES_NO_MEDS_FLG,'Y','Y','N') AS DietControlled,
    a.X_DIABETES_ORAL_MEDS_FLG AS TakingOralMed,
    a.X_DIABETES_ON_INSULIN_FLG AS TakingInsulin,
    S_CONTACT.EMAIL_ADDR AS EmailId,
    NULL CTADATE,
    NULL RWLDATE,
    SUBSTR(S_ADDR_PER.ADDR_LINE_2,1,40) AS Address2
    FROM S_CONTACT,
    S_CONTACT REFERRER,
    S_CONTACT Consultant,
    S_CONTACT ProgramDirector,
    S_CONTACT CallTaker,
    S_CONTACT_X,
    (SELECT /*+ parallel full(S_CONTACT_XM) */ PAR_ROW_ID, attrib_05, MAX(X_CONSULTATION_DT) AS X_CONSULTATION_DT FROM S_CONTACT_XM
    WHERE (S_CONTACT_XM.last_upd_by < '1-14WD'
    or S_CONTACT_XM.last_upd_by > '1-14WD')
    AND S_CONTACT_XM.ATTRIB_05 IN (SELECT row_id FROM S_ORG_EXT WHERE S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) LOC IN (SELECT centreid FROM UPL_LIVE_CENTRES WHERE LIVE = 'Y' AND BATCHID = p_batch_id)) where S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) --
    GROUP BY PAR_ROW_ID, attrib_05) S_CONTACT_XM,
    (SELECT CONTACT_ID, ACCNT_ID,
    MAX(LastSupplementPurchaseDate) AS LastSupplementPurchaseDate,
    MAX(LastSupplementCodePurchased) AS LastSupplementCodePurchased,
    MAX(LastTotalSupplementSupplyCycle) AS LastTotalSupplementSupplyCycle,
    MAX(LastAddtlSupplPurchaseDate) AS LastAddtlSupplPurchaseDate,
    MAX(LastAddtlSupplCodePurchased) AS LastAddtlSupplCodePurchased,
    MAX(LastAddtlSupplSupplyCycle) AS LastAddtlSupplSupplyCycle,
    MIN(FirstPurchaseDate) AS FirstPurchaseDate,
    MAX(LastPurchaseDate) AS LastPurchaseDate
              FROM (
              SELECT /*+ parallel full(S_ORDER) full(S_ORDER_XM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
    NULL AS LastSupplementPurchaseDate,
    NULL AS LastSupplementCodePurchased,
    NULL AS LastTotalSupplementSupplyCycle,
    NULL AS LastAddtlSupplPurchaseDate,
    NULL AS LastAddtlSupplCodePurchased,
    NULL AS LastAddtlSupplSupplyCycle,
    (S_ORDER_XM.X_BUSINESS_DATE) FirstPurchaseDate,
    (S_ORDER_XM.X_BUSINESS_DATE) LastPurchaseDate
              FROM S_ORDER,S_ORDER_XM
              WHERE S_ORDER.ROW_ID = S_ORDER_XM.PAR_ROW_ID
              AND S_ORDER.STATUS_CD IN ('Complete', 'Submitted', 'Ready')
              AND TRUNC(S_ORDER_XM.X_BUSINESS_DATE - UTC_OFFSET/24) <= (p_business_date)
              --GROUP BY S_ORDER.CONTACT_ID
              UNION ALL
              SELECT /*+ parallel full(S_ORDER) full (S_ORDER_ITEM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN S_ORDER.CREATED ELSE NULL END) AS LastSupplementPurchaseDate,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 931 ELSE NULL END) AS LastSupplementCodePurchased,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 7 ELSE NULL END) AS LastTotalSupplementSupplyCycle,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN S_ORDER.CREATED ELSE NULL END) AS LastAddtlSupplPurchaseDate,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 920 ELSE NULL END) AS LastAddtlSupplCodePurchased,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 28 ELSE NULL END) AS LastAddtlSupplSupplyCycle,
              NULL FirstPurchaseDate,
              NULL LastPurchaseDate
              FROM S_ORDER,S_ORDER_ITEM, S_PROD_INT
              WHERE S_ORDER_ITEM.PROD_ID = S_PROD_INT.ROW_ID
                   AND S_ORDER.ROW_ID = S_ORDER_ITEM.ORDER_ID
                   AND S_ORDER_ITEM.qty_req <> 0
                   AND s_order.created_by <> '1-14WD'
                   AND S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
                   AND (S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
                   OR EXISTS (select 1 from S_ORDER_ITEM i2,s_prod_int p
    where i2.row_id = S_ORDER_ITEM.PAR_ORDER_ITEM_ID
    and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
    and i2.prod_id = p.row_id
                   AND S_ORDER.status_cd in ('Complete', 'Submitted', 'Ready')
                   and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
    GROUP BY CONTACT_ID,ACCNT_ID) O,
    S_CONTACT_TNTX,
    S_ORG_EXT,
    S_ORG_EXT ORGEXT_REF,
    S_ADDR_PER,
    S_ASSET a,
    S_PROD_INT,
    S_ASSET a2,
    S_ASSET a3,
    UPL_CLIENT_TYPES ct,
    (select /*+ parallel */ o.contact_id, o.accnt_id
    from S_ORDER o, S_ORDER_XM oxm
    where o.row_id = oxm.par_row_id
    and trunc(oxm.X_BUSINESS_DATE - (UTC_OFFSET/24)) = trunc(p_business_date)
    group by o.contact_id, o.accnt_id) oxm2
    WHERE S_CONTACT.ROW_ID = S_CONTACT_X.PAR_ROW_ID
    AND S_CONTACT_X.ROW_ID = S_CONTACT_XM.PAR_ROW_ID (+)
    AND (S_ORG_EXT.ROW_ID = S_CONTACT.PR_DEPT_OU_ID
    OR S_ORG_EXT.ROW_ID = oxm2.accnt_id
    OR S_ORG_EXT.ROW_ID = S_CONTACT_XM.attrib_05)
    AND ORGEXT_REF.ROW_ID(+) = REFERRER.PR_DEPT_OU_ID
    AND S_CONTACT.CON_ASST_PER_ID = Consultant.ROW_ID
    AND S_ORG_EXT.X_DIRECTOR_ID = ProgramDirector.ROW_ID (+)
    AND S_CONTACT.CREATED_BY = CallTaker.ROW_ID
    AND S_CONTACT.ROW_ID = a.PR_CON_ID (+)
    AND S_CONTACT.PR_PER_ADDR_ID = S_ADDR_PER.ROW_ID (+)
    AND S_CONTACT_TNTX.PAR_ROW_ID (+) = S_CONTACT.ROW_ID
    AND REFERRER.ROW_ID(+) = S_CONTACT_TNTX.REFERRED_BY_ID
    AND a.PROD_ID = S_PROD_INT.ROW_ID (+)
    AND O.CONTACT_ID (+) = S_CONTACT.ROW_ID
    AND a.STATUS_CD (+) = 'Active'
    AND a.TYPE_CD (+) ='Program'
    AND S_CONTACT.ROW_ID = a2.PR_CON_ID (+)
    AND a2.STATUS_CD (+) = 'Active'
    AND a2.TYPE_CD (+) = 'Lifecycle'
    AND a3.PR_CON_ID(+) = S_CONTACT.ROW_ID
    AND a3.STATUS_CD (+) = 'Active'
    AND a3.TYPE_CD (+) = 'HealthSheet'
    AND S_CONTACT.X_JC_ACNT_NUM = ct.CLIENT_NUMBER (+)
    --AND S_ORG_EXT.LOC NOT LIKE 'F%'
    AND S_ORG_EXT.ACCNT_TYPE_CD NOT IN 'Division'
    --AND S_ORG_EXT.Loc in (select to_char(centreid) from UPL_LIVE_CENTRES where LIVE = 'Y')
    AND (trunc(S_CONTACT.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) or trunc(S_CONTACT_X.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) OR (S_CONTACT_XM.X_CONSULTATION_DT = p_business_date) OR oxm2.CONTACT_ID IS NOT NULL)
    AND S_CONTACT.last_upd_by not in ('1-14WD')
    AND oxm2.CONTACT_ID (+) = o.CONTACT_ID
    AND S_ORG_EXT.LOC <> 'CW_846'
    AND (a.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a.pr_accnt_id is null)
    AND (a2.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a2.pr_accnt_id is null)
    AND (a3.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a3.pr_accnt_id is null));
    rollback;
    END;
    --------------------------------------------------------------------------------------------------

  • Problem using SQL Loader with ODI

    Hi,
    I am having problems using SQL Loader with ODI. I am trying to fill an oracle table with data from a txt file. At first I had used "File to SQL" LKM, but due to the size of the source txt file (700MB), I decided to use "File to Oracle (SQLLDR)" LKM.
    The error that appears in myFile.txt.log is: "SQL*Loader-101: Invalid argument for username/password"
    I think that the problem could be in the definition of the data server (Physical architecutre in topology), because I have left blank Host, user and password.
    Is this the problem? What host and user should I use? With "File to SQL" works fine living this blank, but takes to much time.
    Thanks in advance

    I tried to use your code, but I couldn´t make it work (I don´t know Jython). I think the problem could be with the use of quotes
    Here is what I wrote:
    import os
    retVal = os.system(r'sqlldr control=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.ctl log=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.log userid=MYUSER/myPassword @ mySID')
    if retVal == 1 or retVal > 2:
    raise 'SQLLDR failed. Please check the for details '
    And the error message is:
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 5, in ?
    SQLLDR failed. Please check the for details
         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.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.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)

  • Problem connecting sql developer with a remote database MAc OSX Snow Leopar

    Hi everyone, sorry for my poor english but i don 't speak this language.
    I'm trying to connect Sql develper to a remote database and it does not work, showing this error: The Network Adapter could not establish the connection.
    Before running sql developer i install the oracle instant client and sql plus, i use the same tnsnames.ora file as my windows machine and sqlplus (in snow leopard) connect perfect.
    i set the path of my tnsnames in the setup of sql developer but i can't do it work.
    Anyone can help me please? thanks a lot.

    Duplicate thread Problem running Sql developer in Mac OSX Snow Leopard.

  • VERY URGENT: problem in sql query with long datatype in weblogic

    I have a problem while tryind to retrieve a column value with a long datatype using servlet and oci driver and the server is weblogic5.1 .I have used prepared statement the problem comes in the
    preparedStatement.executeQuery().
    The sql Query is simple query and runs well in all cases and fails only when the long datatype column is included in the query.
    The exception that comes on the weblogic server is that :
    AN UNEXPECTED EXCEPTION DETECTED IN THE NATIVE CODE OUTSIDE THE VM.

    Did you try changing the driver then?
    Please use Oracle's thin driver instead of the oci driver.
    There are many advantages of using the type 4 driver. the first and foremost being that it does not require oracle client side software on your machine. Therefore no enteries to be made in tnsnames.ora
    The thin driver is available in a jar called classes112.zip the class which implements the thin driver is oracle.jdbc.driver.OracleDriver
    the connection string is
    jdbc:oracle:thin:@<machine name>:1521:<sid>
    please try out with the thin driver and let me know.
    regards,
    Abhishek.

  • SQL Query with variable range

    Hi
      I want to give range to a user to enter in a variable through sql query . If there are 200 records , if user wants to display from 5-45 , 75-110 , 130-145. how it can be done through SQl Query
    Thanks
    Edited by: Matt on Aug 31, 2010 6:23 PM - modified title - please use a meaningful title in future

    Dear Saini,
    This query will allow you to choose the values only when you know them.
    SELECT T0.[DocEntry], T0.[ItemCode] FROM INV1 T0 WHERE T0.[LineNum] >[%0]   and T0.[LineNum] <[%1]
    If you run it in the query Generator in SAP Business One a little window will pop up and will ask you to choose the 2 variables.
    You can choose different variables every time you run it. At least you won't have to save many queries with different values.
    If you want 2 different groups, e.g. from 10 to 20 and from 30 to 40, then you can add another part in the where clause:
    SELECT T0.[LineNum], T0.[ItemCode], T0.[DocEntry] FROM INV1 T0 WHERE T0.[LineNum]  >= [%0] and  T0.[LineNum]  <= [%2] and T0.[LineNum]  >= [%4] or  T0.[LineNum]  <= [%6]
    Please, let me know if this query helps.
    Regards,
    Marcella Rivi
    SAP Business One Forums Team

  • Problem accessing SQL Developer with user sys

    Hi Experts;
    I'm working with Oracle 10G, in Solaris 10, The DB apparently is working properly, but I can not access the DB thru SQL Developer. When I try to acccess with user sys, and I enter de password, in oracle role I select sysdba, when I choose connect I get this error message:
    ORA-01017: invalid username/password; logon denied
    However, I can connect with other user without any problem.
    I was connecting directly in the server, with sqlplus /as sysdba and I changed the password for user sys, but still the problem continues.
    What is wrong with this. I got the same problem if try to connect thru OEM.
    Thanks and regards
    Al
    Edited by: user12048358 on Jul 8, 2011 12:02 PM

    Hi Buntoro;
    Thank you for answer.
    First, I'm completely sure I'm using the correct password, to be sure I changed the password thru sqlplus.
    I'm using tns connection, btw, with the same connection, I can connect, but with other user.
    I was trying again, however, with the same results previous explained.
    But also I have the same problen when I tried to connect to OEM, and I was trying to stop the dbconsole, and found this:
    export ORACLE_SID=YAWIDBLAB
    emctl status dbconsole
    OC4J Configuration issue. /opt/oracle/102/oc4j/j2ee/OC4J_DBConsole_yawi-db-lab01_YAWIBLAB not found.
    export ORACLE_SID=YAWIDBLA
    emctl status dbconsole
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    http://yawi-db-lab01:1158/em/console/aboutApplication
    Oracle Enterprise Manager 10g is running.
    Logs are generated in directory /opt/oracle/102/yawi-db-lab01_YAWIDBLA/sysman/log
    If I type export ORACLE_SID=YAWIDBLA and then sqlplus /nolog
    SQL> connect /as sysdba
    Connected to an idle instance.
    But, when I connect settiong the SID in this way:
    export ORACLE_SID=YAWIDBLAB
    sqlplus /nolog
    SQL*Plus: Release 10.2.0.4.0 - Production on Sat Jul 9 23:03:15 2011
    Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
    SQL> connect /as sysdba
    Connected.
    SQL>
    Apparently, there is problem with the tnsnames. When I see the tnsnames in SQL DEVELOPER I see this: YAWIDBLA
    So, here is the tnsname, in order you have a better idea, what I have.
    YAWIDBLA =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = yawi-db-lab01)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = YAWIDBLAB)
    Is the first time I see this kind of problem.
    Have an idea of what's happening;
    Best Regards;
    Al

  • PL/SQL cursor with FOR UPDATE STATEMENT

    Welcome,
    I have some troubles with cursors. When I try update values in table using cursor i receive ORA-01410 Error : "INVALID ROWID".
    I use code as below:
    ALTER SESSION SET CURRENT_SCHEMA=TEST_SCHEMA;
    DECLARE
    TYPE LogTable_typ IS TABLE OF ADMIN_FILE_LOG%ROWTYPE;
    v_ModuleId KTIMS.ADMIN_FILE_LOG.MODULE_ID%TYPE;
    v_CDR KTIMS.ADMIN_FILE_LOG.CDR_SUCCESS%TYPE;
    CURSOR c1 IS
    SELECT MODULE_ID, cdr_success FROM ADMIN_FILE_LOG
    FOR UPDATE OF CDR_SUCCESS NOWAIT;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_ModuleId,v_CDR;
    IF v_ModuleId = 'LOAD' THEN
    UPDATE ADMIN_FILE_LOG SET CDR_SUCCESS = 70 WHERE CURRENT OF c1;
    END IF;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM || SQLCODE);
    END;
    When I use ROWID in cursor declaration all works fine.Working code is:
    ALTER SESSION SET CURRENT_SCHEMA=KTIMS;
    DECLARE
    TYPE LogTable_typ IS TABLE OF ADMIN_FILE_LOG%ROWTYPE;
    v_ModuleId KTIMS.ADMIN_FILE_LOG.MODULE_ID%TYPE;
    v_CDR KTIMS.ADMIN_FILE_LOG.CDR_SUCCESS%TYPE;
    v_id ROWID;
    CURSOR c1 IS
    SELECT MODULE_ID, cdr_success, ROWID FROM ADMIN_FILE_LOG
    FOR UPDATE OF CDR_SUCCESS NOWAIT;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_ModuleId,v_CDR,v_id;
    IF v_ModuleId = 'LOAD' THEN
    UPDATE ADMIN_FILE_LOG SET CDR_SUCCESS = 70 WHERE ROWID = v_id;
    END IF;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM || SQLCODE);
    END;
    What is difference in this two cases ?
    I try to find this in Oracle documentation "Database PL/SQL User's Guide and Reference" ( http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#i45288 ).
    Please help.

    Hi,
    I think the USE of NOWAIT clause in cursor for update is, to remove the lock immediately after the transaction is over.
    In the second example where you are fetching the rowid explicitly and use the same id in loop to make the update, so there should not be any problem in this case.
    In the first example when you are using CURRENT OF to do the update, it is basically work on basis of latest fetched row from cursor and do the update (but i think implicitly it use the reference of row id also).
    I am not sure about it , but still try once by removing the NOWAIT clause from your cursor for update and try once , see whether you are still facing the error or not.

  • Copy process instance with variables and state

    Hello,
    I want to make a kind of "snapshot" of my running BPEL instance.
    It should be possible to change some variable values of the snapshot
    and then continue the snapshot process with the changed parameters.
    Thus, I need to copy not only the BPEL description, but also the variable values,
    the state of the process and the outcome of the already finished activities.
    Any idea how this can be done ?
    Thanks in advance.
    Bernd

    Could you describe the use case? Because there are other options as well, like designing your process in such a way it can start at several distinct entrypoints, depending on the message it receives.
    I find the kind of solution you suggest very dangerous, as you try to 'hack' the BPEL engine. This makes your solution very vulnerable, as it probably will be affected by patches and new releases, whereas a more functional approach, using the standard functions, will be less so.
    Just my 2 cents, though.

  • Problem while restricting onfoprovider with variable

    Hi All.
    I have a scenario where i have to restrict the infoprovider(Data package field )in the characteristic restrictions with an variable.But iam unable to restrict it and iam getting the following error.
    Unhandled exception has occured and also Index was out of range.Must be non-negative and less than the size of the collection.
    please guide me accordingly to solve this.
    Regards
    Amar.

    Hi Karthik,
    The problem is that this query it´s not suposed to have any navigation, because it will be used as a data provider in WAD, so it must run without any user interaction(to select the period again, for instance).
    There´s some place that I would check the standard exit?
    Kind Regards,
    Tomas Prusaczyk

  • Problem in Sql*loader with specifc characters like "ù,°,€ ...."

    Hello,
    I have problems by loadinf a flat file which contains specific characters.
    These characters multiplies by 2 the size of the zone.
    For example, in chains of 10 characters.
    If the value is :
    ' ABCDEFGHIJ' OK (10)
    ' ABCDEFGHI° ' NOK (9 + 1*2) 11 > 10
    ' Aù°?° ' OK (2*5)
    ' A°°°°° ' NOK (1 + 5*2) 11 > 10
    For your information :
    PARAMETER     Base     Instance     Session
    NLS_CALENDAR     GREGORIAN          GREGORIAN
    NLS_CHARACTERSET     AL32UTF8          
    NLS_COMP     BINARY          BINARY
    NLS_CURRENCY     $          F
    NLS_DATE_FORMAT     DD-MON-RR          MM/DD/YYYY HH24:MI:SS
    NLS_DATE_LANGUAGE     AMERICAN          FRENCH
    NLS_DUAL_CURRENCY     $          €
    NLS_ISO_CURRENCY     AMERICA          FRANCE
    NLS_LANGUAGE     AMERICAN     AMERICAN     FRENCH
    NLS_LENGTH_SEMANTICS     BYTE     BYTE     BYTE
    NLS_NCHAR_CHARACTERSET     AL16UTF16          
    NLS_NCHAR_CONV_EXCP     FALSE     FALSE     FALSE
    NLS_NUMERIC_CHARACTERS     .,          ,.
    NLS_RDBMS_VERSION     9.2.0.4.0          
    NLS_SORT     BINARY          FRENCH
    NLS_TERRITORY     AMERICA     AMERICA     FRANCE
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM          DD/MM/RR HH24:MI:SSXFF
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR          DD/MM/RR HH24:MI:SSXFF TZR
    NLS_TIME_FORMAT     HH.MI.SSXFF AM          HH24:MI:SSXFF
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR          HH24:MI:SSXFF TZR

    On my PC with these parameters we have no problem:
    NLS_CALENDAR     GREGORIAN          GREGORIAN
    NLS_CHARACTERSET     WE8MSWIN1252          
    NLS_COMP     BINARY          BINARY
    NLS_CURRENCY     $          F
    NLS_DATE_FORMAT     DD-MON-RR          MM/DD/YYYY HH24:MI:SS
    NLS_DATE_LANGUAGE     AMERICAN          FRENCH
    NLS_DUAL_CURRENCY     $          €
    NLS_ISO_CURRENCY     AMERICA          FRANCE
    NLS_LANGUAGE     AMERICAN     AMERICAN     FRENCH
    NLS_LENGTH_SEMANTICS     BYTE     BYTE     BYTE
    NLS_NCHAR_CHARACTERSET     AL16UTF16          
    NLS_NCHAR_CONV_EXCP     FALSE     FALSE     FALSE
    NLS_NUMERIC_CHARACTERS     .,          ,.
    NLS_RDBMS_VERSION     9.2.0.1.0          
    NLS_SORT     BINARY          FRENCH
    NLS_TERRITORY     AMERICA     AMERICA     FRANCE
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM          DD/MM/RR HH24:MI:SSXFF
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR          DD/MM/RR HH24:MI:SSXFF TZR
    NLS_TIME_FORMAT     HH.MI.SSXFF AM          HH24:MI:SSXFF
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR          HH24:MI:SSXFF TZR
    So, what is the solution ?

  • Problems using SQL*Loader with Oracle SQL Developer

    I have been using TOAD and able to import large (milllions of rows of data) in various file formats into a table in an Oracle database. My company recently decided not to renew any more TOAD licenses and go with Oracle SQL Developer. The Oracle database is on a corporate server and I access the database via Oracle client locally on my machine. Oracle SQL Developer and TOAD are local on my desktop and connected through TNSnames using the Windows XP platform. I have no issues with using SQL*Loader via the import wizard in TOAD to import the data in these large files into an Oracle table and producing a log file. Loading the same files via SQL*Loader in SQL Developer, freezes up my machine and I cannot get it to produce a log file. Please help!

    I am using SQL Developer version 3.0.04. Yes, I have tried it with a smaller file with no success. What is odd is that the log file is not even created. What is created is a .bat file a control file and a .sh file but no log file. The steps that I take:
    1.Right click on the table I want to import to or go to actions
    2. Import Data
    3. Find file to import
    4. Data Preview - All fields entered according to file
    5. Import Method - SQL Loader utility
    6. Column Definitions - Mapped
    7. Options - Directory of files set
    8. Finish
    With the above steps I was not able to import 255 rows of data. No log file was produced so I don't know why it is failing.
    thanks.
    Edited by: user3261987 on Apr 16, 2012 1:23 PM

  • Trigger problem on Sql Server with linked server to Oracle

    Hi All,
    I have a simple insert trigger on Sql Server 2005, it uses linked server to Oracle.
    like that ;
    USE [YTM08]
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ANSI_NULLS ON
    go
    ANSI_WARNINGS ON
    CEATE TRIGGER [dbo].[YTM_TBLSTSABIT_I]
    ON [dbo].[TBLSTSABIT] FOR INSERT
    AS
    BEGIN
    INSERT INTO YTM_ORACLE..SECTOR.STOCKS
    stock_name,
    stock_code,
    insert_date
    SELECT
    SBT.STOCKNAME,
    SBT.STOCKCODE,
    GETDATE()
    FROM INSERTED SBT
    END
    The YTM_ORACLE is a linked server and it's provider is OraOLEDB.Oracle.
    Trigger does not works for that linked server but other triggers for local
    sql server works fine...
    I get this error from sql server
    'Heterogeneous queries require the ANSI_NULLS and
    ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.'
    Does someone know how to solve this issue the right way?
    Thanks in advance.
    Thanks !
    Adam

    Hi Lars,
      Thanks for the data. I've already read this note and configure all this parameters. But when I'm executing the Create Source System in the BI system the process dies.
      If I look into the logs I see this:
    M  call semaphore clean-up function ...
    M  ***LOG Q0E=> DpSigGenHandler, Exception (c06d007e) [dpnttool.c   432]
      That's the reason why I start guessing about other possible problem.
    Regards

  • Problem in Sql Loader With Win2000 Professional

    Hi,
    I am using Win-2000 prof. while loading data with sqlldr I am not comming out from the prompt after inserting all the data in the table.
    c:\>sqlldr system/manager@scs party.ctl silent=ALL --enter
    ^c
    c:\>
    I have to press Ctrl+C to come out from the prompt.
    help me

    he guys no reply for this topic

Maybe you are looking for

  • Feature request: smooth zooming in develop module

    It would be very helpful if the develop module (especially) allowed viewing not just at 1:1, 2:1, 3:1 etc but also at every % in between. This would make it far easier to properly evaluate the image at output size where you intend to upsize (or down

  • Merging a collection into a table

    I have a table with some blank columns. I take all the data from the table in a collection and then process the data to fill those empty columns. Now i have the collection with all the valid data. Is it possible to cast this same collection into a ta

  • Migrate from Test to New Server - OBIEE

    Hi, I have been 'evaluating' OBIEE functinality on a small test server for some time, where I have done a large amount of work on both writing reports. developing dashboards, configuring user security and the necessary data architecture in the physic

  • How can update camera raw 8.6 ?

    Lightroom 5.6 needs Camera Raw 5.6 for a full compability. How can update camera raw 8.6? Thanks!

  • FSG Row set Definition

    Hi , In FSG Report Row set Definition, we have assigned the one parent account and choose expand for the Natural account . But the requirement is to fetch from multiple set of books , so we copied the same account assignment and assigned different se