SQL Extract Variable String in Variable Position with Variable length from ntext field

i want to extract a variable string from an ntext field. 
Sample Data in Background_text (ntext)
function changeFocus()  {         document.getElementById('skipContent').style.visibility = 'visible';         document.getElementById('flashContent').blur();        
document.getElementById('skip').focus();  }  </script>    </head>  <body onload='hideDiv()'>    <div id="flashContent" align="center">     <object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="440" id="Animation" align="middle">      <param name="movie"
value="/assets/abc/images/abcdef.swf" />      <param name="quality" value="high" />
I want to extract this data:      "/assets/abc/images/abcdef.swf"
The string will always be preceded by value="     AND end in
.swf"
As a first attempt, I tried
SELECT SUBSTRING([Background_text], CHARINDEX('value="/assets/', [background_text]) + 15, LEN(convert(varchar(max), background_text) -
CHARINDEX('value="/assets/', [Background_text]) + 15) - 1)
but I received this error
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value .......  to data type int
This query won't completely accomplish what I want. Do you have a suggestion?
Thanks.

I'd add an extra bit of logic into the expression to only look for 'swf' AFTER the start of the string - it might be that you can guarantee that no occurrence of 'swf' will ever appear in the ntext, but who knows what might change in the future, and it's
good practice to code defensively.
SELECT
SUBSTRING(
Background_text,
CHARINDEX('value="/assets/', background_text) + 6,
CHARINDEX('.swf', SUBSTRING(
Background_text,
CHARINDEX('value="/assets/', background_text) + 6,
LEN(cast(background_text as varchar(max)))
) + 4

Similar Messages

  • Output data to txt file with full length of the field as in database

    Hi
    I have a problem related to output data I ntxt file on server
    for eg
    CONCATENATE
    wa_sagadr_outtab-seqno
    wa_sagadr_outtab-bpext
    wa_sagadr_outtab-name_org1
    wa_sagadr_outtab-country INTO wa_sagadr_text SEPARATED BY ''.
    the output is separated by single space irrespective of database length of the field , I want to display all the lenth of the database field eventhough the remaining space is blank ie if a field is 20 char in dtabase and only filled with 6 char the whole 20 char lenth should be displayed in the output file
    ouput as below
    required format ie space equvalent to as in database lenght
    000001       700006               C4 Plant AMD Export Sdn.Bhd.so on.
    my format as coming single space in between only
    000001 700006 C4 Plant AMD Export Sdn.Bhd
    pls suggest

    For this maintain an work area with the fields and structure same as the one which you want.
    ten populate the work are and write to file.
    concatenate will not work.
    e.g.
    DATA: begin of wa_sagadr_text,
              seqno like wa_sagadr_outtab-seqno,
              bpext like wa_sagadr_outtab-bpext,
              name_org1 like wa_sagadr_outtab-name_org1,
              country like wa_sagadr_outtab-country
              end of wa_sagadr_text,
    clear wa_sagadr_text.
    wa_sagadr_text-seqno = wa_sagadr_outtab-seqno.
    wa_sagadr_text-bpext= wa_sagadr_outtab-bpext.
    wa_sagadr_text-name_org1 = wa_sagadr_outtab-name_org1.
    wa_sagadr_text-country = wa_sagadr_outtab-country INTO wa_sagadr_text.
    transfer wa_sagadr_text to outputfile
    or write:/ your fields.

  • SQL Server Connexion string throw a proxy with EF

    I have asked some day later about config of the EF (Entity Framework) to connect to the sql server via proxy.
    https://social.msdn.microsoft.com/Forums/en-US/387e675e-9d74-46d0-a0c3-aafdec205a24/config-entity-framework-to-use-proxy-to-connect-to-the-server?forum=adodotnetentityframework
    I don't have any replay according to my probleme. So if here we can help me please.
    So, 
    Now I want to get a StringConnexion for EF that allow proxy or the config is included to the StringConnexion.
    The connexion now is using a url,port exemple: mydb.example.com,23455 like as follow:
    connectionString="metadata=res://*/Data.DatabasesMappers.MyDBMapper.csdl|res://*/Data.DatabasesMappers.MyDBMapper.ssdl|res://*/Data.DatabasesMappers.MyDBMapper.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tcp:mydb.mydns.com,23455;initial catalog=MyDB;user id=MyUser;password=ThePassword;MultipleActiveResultSets=True;App=EntityFramework&quot;"
    What I could add on the ConnexionString to be able to connect throw a proxy.
    Thanks

    Hi,
    What you need to do, is to ensure your connection string is something like
    <connectionStrings>
    <add name="conn2" connectionString="Data Source=192.?.?.?\your_db_instance;Initial Catalog=your_db_schema;Integrated Security=False;User ID=your_db_login;Password=??????" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    within Web.config/app.config file in your project, to ensure the project will work fine with the database.
    Many Thanks & Best Regards, Hua Min

  • SQL Developer: How do I copy data with Column Headers from the output grid?

    Hello,
    I am using Version 2.1.1.64.
    I run a SQL query, I get the results grid in the "Query Result" window down below. Say I get 10 rows returned, with 5 columns.
    I want to Copy this entire grid, plus the column headers/names, to the clipboard. So I can paste it under the original query to document the results of that query.
    I can't find any way to do this. I can copy/paste the results grid, but it doesn't copy the headers.
    The only way I see to do it is to go through numerous steps to Export to a TXT file, then paste that. Unfortunately, that is a lot of wasted steps if I need to do this over and over, plus, the output gets pasted in an ugly format with double quotes, etc.
    It seems like the simplest functionality is to copy/paste the entire results grid, and of course you might the headers. Why is this so complicated/impossible to do?
    (I believe Toad has the same problem. DBArtisan allows you to copy/paste the entire results, plus headers, though.)
    Any assistance would be appreciated!
    Thanks,
    John

    Ah, ok...
    I had tried that before, and it didn't work, it seemed to copy the path of filename I was using. But I think that was because I had clicked on a Column Header first, and it had asked me if I wanted to filter. I think then it lost track that it was in the grid. It's a little flukey.
    What I did now was to click on an individual cell in the output, then hit CTRL-A to select all, then hit SHIFT-CTRL-C. That gives me exactly what I want.
    Thanks very much for your quick solution, I appreciate it!
    John

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

  • How to compare text field length with the length of input characers

    I hae a problem with the length of text field
    I want to fix the length of TextField by taking the length of attribute to, whihc i have to use in text field
    Like i have set the max length of Attribut to 10 and set the length of textfield also 10.
    But the problem is that if i enter 10 'i' it dosn't fill even half the space in TextField
    And opposit if i enter 10 'W'
    I wonder if there is a solution for this problem
    i ma using True Type of Font

    * paint method in your own class that extends Canvas
    * @param g where to paint e.g. printer, screen, ram
    public void paint (Graphics g)
    // display word "today" centred at x,y
    FontMetrics fm = getFontMetrics( g.getFont( ) );
    String wording = "today" ;
    int xadj = fm.stringWidth( wording )/ 2;
    // position bottom left corner of the text
    g.drawString(wording , x-xadj, y );
    // draw a red line from x1,y1 to x2,y2
    g.setColor( Color .red );
    g.drawLine( x1 , y1, x2, y2);
    // draw an pre-existing Image. imX,imY is top left corner of the Image.
    g.drawImage ( image , imX, imY , imWidth, imHeight , this);
    } //end paint

  • Problem with variables in dynamic SQL/PLSQL

    Hi, I have a problem I am trying to solve using a very short piece of dynamic SQL/PLSQL but I am having problems getting the variable values out of the dynamic block.
    I need to increment a counter which could be any one of 16 counters I am using and I want to avoid using nested IF statements.
    The variable to be incremented is made up of the 'scheme', the 'contributory category' and the 'employment category' (although not every combination is valid)
    The 'scheme' can be either 'no1', 'no2', 'off', 'cg' or 'amc'
    The 'contributory category' can be either 'cont' or 'noncont'
    The 'employment category' can be either 'ft' or 'pt'
    For example the total variable name could be 'v_cg_noncont_ft_count'
    I have created a variable by concatenating the various elements called v_incr_count_name which holds the name of the variable I want to increment.
    I am running this within an anonymous PLSQL block so I cannot use global variables meaning that my variables are not visible within a dynamic PLSQL block.
    As a result I think I will need to use bind variables with a PLSQL block or a SELECT FROM INTO SQL string
    I have tried various solutions including the following PLSQL solution:
    v_incr_count_name := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'BEGIN :a := :a + 1; END;';
    EXECUTE IMMEDIATE sql_stmt USING v_incr_count_name;
    Unfortunately I am getting the 'IN bind variable bound to an OUT position' error which I suppose makes sense as I am trying to change the value of a variable in the main PLSQL block from within the dynamic block.
    Another (SQL) solution I tried was:
    v_incr_count_name := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'SELECT '||v_incr_count_name||' + 1 FROM DUAL';
    EXECUTE IMMEDIATE sql_stmt INTO v_return;
    While this executes and returns the incremented value into v_return, I am still left unable to copy the returned value into the variable whose name is stored in v_incr_count_name
    Any help appreciated
    Cheers, Dan

    this shows the syntax for the using clause
    declare
    a number := 1;
    b number := null;
    v varchar2(10) := 'A';
    begin
    execute immediate 'begin :v1 := :v1 + 1; end;' using in out a;
    dbms_output.put_line(a);
    end;
    /but what you want cannot be done
    SQL> declare
      2  a number := 1;
      3  b number := null;
      4  v varchar2(10) := 'A';
      5  begin
      6  execute immediate 'begin '||v||' := :v1 + 1; end;' using in out a;
      7  dbms_output.put_line(a);
      8  end;
      9  /
    declare
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'A' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ORA-06512: at line 6the variable "V" contains the name of the desired output variable ("A"). this errors because "A" is not defined within the scope of the dynamic sql.
    "into the variable whose name is stored in v_incr_count_name"
    pl/sql does not support dereferencing variables, so you can't do it.

  • Testing VOs that have positional bind variables with BC4J Tester

    Hi
    I am doing some OAF development for eBusiness 12.1.3 and would like to understand whether VOs that have positional bind variables can be tested using the BC4J Tester in JDeveloper 10.1.3 (the latest version of JDev compatible with OAF development). It looks like it should work as when you choose "Oracle Positional" in the VO wizard Binding Style it adds another text box to the to the Bind Variables page called Bind Positions, I assume that this is so you can create variables that you can populate in the Tester that will relate name to position but I get an error regarding column index when I use the BC4J Tester:
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT CASE
    WHEN ph.closed_code IN ('CANCELLED', 'CLOSED','FINALLY CLOSED')
    THEN 'Expired Item'
    WHEN prl.unit_price <> pl.unit_price
    THEN 'Price Update'
    ELSE ''
    END item_status
    FROM po_lines pl,
    po_headers ph,
    po_requisition_lines prl
    WHERE ph.po_header_id = pl.po_header_id
    AND prl.blanket_po_header_id = pl.po_header_id
    AND prl.blanket_po_line_num = pl.line_num
    AND pl.po_header_id = :1
    AND pl.line_num = :2
    AND prl.requisition_line_id = :3
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:833)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:891)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:805)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:799)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3575)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.jbo.jbotester.VariableDialog.save(VariableDialog.java:144)
         at oracle.jbo.jbotester.GenericDialog.actionPerformed(GenericDialog.java:219)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at oracle.jbo.jbotester.JTDialog.show(JTDialog.java:121)
         at oracle.jbo.jbotester.JboTesterUtil.editBindParameters(JboTesterUtil.java:169)
         at oracle.jbo.jbotester.SimpleForm.setIterator(SimpleForm.java:65)
         at oracle.jbo.jbotester.SimpleForm.<init>(SimpleForm.java:51)
         at oracle.jbo.jbotester.VOTreeNode.showForm(VOTreeNode.java:115)
         at oracle.jbo.jbotester.BaseTree.processTreeMouseClicked(BaseTree.java:471)
         at oracle.jbo.jbotester.BaseTree.mav$processTreeMouseClicked(BaseTree.java:45)
         at oracle.jbo.jbotester.BaseTree$TreeMouseListener.mouseClicked(BaseTree.java:125)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
         at java.awt.Component.processMouseEvent(Component.java:5491)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ## Detail 0 ##
    java.sql.SQLException: Invalid column index
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240)
         at oracle.jdbc.driver.OraclePreparedStatement.setNUMBERInternal(OraclePreparedStatement.java:5891)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7674)
         at oracle.jdbc.driver.OraclePreparedStatement.setCustomDatumInternal(OraclePreparedStatement.java:7410)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8178)
         at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8166)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParamValue(BaseSQLBuilderImpl.java:1847)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3890)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13759)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:801)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:891)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:805)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:799)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3575)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.jbo.jbotester.VariableDialog.save(VariableDialog.java:144)
         at oracle.jbo.jbotester.GenericDialog.actionPerformed(GenericDialog.java:219)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at oracle.jbo.jbotester.JTDialog.show(JTDialog.java:121)
         at oracle.jbo.jbotester.JboTesterUtil.editBindParameters(JboTesterUtil.java:169)
         at oracle.jbo.jbotester.SimpleForm.setIterator(SimpleForm.java:65)
         at oracle.jbo.jbotester.SimpleForm.<init>(SimpleForm.java:51)
         at oracle.jbo.jbotester.VOTreeNode.showForm(VOTreeNode.java:115)
         at oracle.jbo.jbotester.BaseTree.processTreeMouseClicked(BaseTree.java:471)
         at oracle.jbo.jbotester.BaseTree.mav$processTreeMouseClicked(BaseTree.java:45)
         at oracle.jbo.jbotester.BaseTree$TreeMouseListener.mouseClicked(BaseTree.java:125)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
         at java.awt.Component.processMouseEvent(Component.java:5491)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ----- LEVEL 1: DETAIL 0 -----
    java.sql.SQLException: Invalid column index
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240)
         at oracle.jdbc.driver.OraclePreparedStatement.setNUMBERInternal(OraclePreparedStatement.java:5891)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7674)
         at oracle.jdbc.driver.OraclePreparedStatement.setCustomDatumInternal(OraclePreparedStatement.java:7410)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8178)
         at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8166)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParamValue(BaseSQLBuilderImpl.java:1847)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3890)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13759)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:801)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:891)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:805)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:799)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3575)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.jbo.jbotester.VariableDialog.save(VariableDialog.java:144)
         at oracle.jbo.jbotester.GenericDialog.actionPerformed(GenericDialog.java:219)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at oracle.jbo.jbotester.JTDialog.show(JTDialog.java:121)
         at oracle.jbo.jbotester.JboTesterUtil.editBindParameters(JboTesterUtil.java:169)
         at oracle.jbo.jbotester.SimpleForm.setIterator(SimpleForm.java:65)
         at oracle.jbo.jbotester.SimpleForm.<init>(SimpleForm.java:51)
         at oracle.jbo.jbotester.VOTreeNode.showForm(VOTreeNode.java:115)
         at oracle.jbo.jbotester.BaseTree.processTreeMouseClicked(BaseTree.java:471)
         at oracle.jbo.jbotester.BaseTree.mav$processTreeMouseClicked(BaseTree.java:45)
         at oracle.jbo.jbotester.BaseTree$TreeMouseListener.mouseClicked(BaseTree.java:125)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
         at java.awt.Component.processMouseEvent(Component.java:5491)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Is there some other configuration I need to do when using positional Bind Variables? If I switch the query to use named parameters and replace :1 with :var1 for example it works fine in the Tester. The reason I am not using named bind variables is that Oracle recommend using positional for eBus, probably because it was predominantly built on older versions of JDev.
    Thanks in advance
    Stacy
    Edited by: Stacy Carpenter on 26-Mar-2013 06:40

    There are actually 2 issues here. The first is that bind positions start at 0 (not 1) and that will resolve the invalid column index issue above. However it seems there is a relatively unknown error in JDeveloper 10.1.3 that keeps resetting the bind position of all bind variables each time you update any of them. So if I create var1 with a position of 0 and then create var2 with a position of 1 then the position of var1 will also be overwritten with 1. I tried listing 0,1 for both to see whether the the IDE would intuitively sort out what was supposed to be where but all that happens is that var2 ends up populating positions 0 and 1, which unless the values are meant to be the same is obviously no good. It seems the only way to get around this in this version of JDeveloper is to close the IDE, edit the VO xml to put the variables against their correct positions, and then reopen. Opening the VO wizard will reset them all to the same again so do not do this (unknowingly) and simply right click the AM and run the BC4J Tester which should now let you edit the bind variables and produce the expected results.
    Cheers
    Stacy

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

  • How to create dynamic connection string with variables using ssis.

    Hello,
    Can anyone let me know on how to create dynamic connection string with variables using ssis?
    Any help would be appreciated.

    Hi vinay9738,
    According to your description, you want to connect multiple database from multiple servers using dynamic connection.
    If in this case, we can create a Table in our local database (whatever DB we want) and load all the connection strings.  We can use Execute SQL Task to query all the connection strings and store the result-set in a variable of object type in SSIS package.
    Then use ForEach Loop container to shred the content of the object variable and iterate through each of the connection strings. And then Place an Execute SQL task inside ForEach Loop container with the SQL statements we have to run in all the DB instances. 
    For more details, please refer to the following blog:
    http://sql-developers.blogspot.kr/2010/07/dynamic-database-connection-using-ssis.html
    If there are any other questions, please feel free to let me know.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • 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

  • Prepared XmlQueryExpression with variables vs String query

    John,
    I have ran into another performance problem. This time it is the same xpath expression. The difference is one is a prepared one with variables that are being reset for each execution thread where as the other one is alway a new string query with each execution thread.
    dbxml> info
    Version: Oracle: Berkeley DB XML 2.3.10: (January 30, 2007)
    Berkeley DB 4.5.20: (September 20, 2006)
    Default container name: en-US
    Type of default container: NodeContainer
    Index Nodes: on
    Shell and XmlManager state:
    Verbose: on
    Query context state: LiveValues,Eager
    declare default element namespace "http://dto.destination.dbxml.valhalla.starwood.com";
    collection("en-US")/City[CityDetail/PropertyIds/PropertyId=100]/CityItems/CityItem[@CityItemId=(actual collection of 500 double values)]
    Time: 498 ms
    vs
    declare default element namespace "http://dto.destination.dbxml.valhalla.starwood.com"; collection("en-US")/City[CityDetail/PropertyIds/PropertyId=$PropertyId]/CityItems/CityItem[@CityItemId=$Ids]
    Time: 104291 ms
    A snippet of query plans is following:
    dbxml> queryplan 'declare default element namespace "http://dto.destination.dbxml.valhalla.starwood.com";
    collection("en-US")/City[CityDetail/PropertyIds/PropertyId=100]/CityItems/CityItem[@CityItemId=(196970,339036)]'
    <XQuery>
    <DbXmlNav>
    <LookupIndex container="en-US">
    <ValueQP index="node-element-equality-double" operation="eq" child="PropertyId:http://dto.destination.dbxml.valhalla.starwood.com"
    value="100"/>
    </LookupIndex>
    <DbXmlStep axis="parent-of-child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="PropertyIds" nodeType="element"/>
    <DbXmlStep axis="parent-of-child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="CityDetail" nodeType="element">
    <OQPlan>P(node-element-presence-none,=,CityDetail:http://dto.destination.dbxml.valhalla.starwood.com)</OQPlan>
    </DbXmlStep>
    <Join type="parent-of-child" return="argument">
    <DbXmlNav>
    <QueryPlanFunction result="collection" container="en-US">
    <OQPlan>n(P(node-element-presence-none,=,CityDetail:http://dto.destination.dbxml.valhalla.starwood.com),V(node-element-equality-double,P
    ropertyId:http://dto.destination.dbxml.valhalla.starwood.com,=,'100'),u(n(P(node-element-presence-none,=,CityItem:http://dto.destination
    .dbxml.valhalla.starwood.com),V(node-attribute-equality-double,@CityItemId,=,'196970')),n(V(node-attribute-equality-double,@CityItemId,=
    ,'339036'),P(node-element-presence-none,=,CityItem:http://dto.destination.dbxml.valhalla.starwood.com))))</OQPlan>
    </QueryPlanFunction>
    <DbXmlStep axis="child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="City" nodeType="element"/>
    </DbXmlNav>
    </Join>
    <DbXmlStep axis="child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="CityItems" nodeType="element"/>
    <DbXmlStep axis="child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="CityItem" nodeType="element">
    <OQPlan>P(node-element-presence-none,=,CityItem:http://dto.destination.dbxml.valhalla.starwood.com)</OQPlan>
    </DbXmlStep>
    <Join type="attribute" return="context_item">
    <LookupIndex container="en-US">
    <UnionQP>
    <ValueQP index="node-attribute-equality-double" operation="eq" child="CityItemId" value="196970"/>
    <ValueQP index="node-attribute-equality-double" operation="eq" child="CityItemId" value="339036"/>
    </UnionQP>
    </LookupIndex>
    </Join>
    </DbXmlNav>
    </XQuery>
    <XQuery>
    <DbXmlNav>
    <LookupIndex container="en-US">
    <ValueQP index="node-element-equality-double" operation="eq"
    child="PropertyId:http://dto.destination.dbxml.valhalla.starwood.com">
    <Variable name="PropertyId"/>
    </ValueQP>
    </LookupIndex>
    <DbXmlStep axis="parent-of-child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="PropertyIds" nodeType="element"/>
    <DbXmlStep axis="parent-of-child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="CityDetail" nodeType="element">
    <OQPlan>P(node-element-presence-none,=,CityDetail:http://dto.destination.dbxml.valhalla.starwood.com)</OQPlan>
    </DbXmlStep>
    <Join type="parent-of-child" return="argument">
    <DbXmlNav>
    <QueryPlanFunction result="collection" container="en-US">
    <OQPlan>n(P(node-element-presence-none,=,CityDetail:http://dto.destination.dbxml.valhalla.starwood.com),P(node-element-presence-none,=,C
    ityItem:http://dto.destination.dbxml.valhalla.starwood.com),P(node-attribute-equality-double,prefix,@CityItemId),P(node-element-presence
    -none,=,PropertyId:http://dto.destination.dbxml.valhalla.starwood.com))</OQPlan>
    </QueryPlanFunction>
    <DbXmlStep axis="child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="City" nodeType="element"/>
    </DbXmlNav>
    </Join>
    <DbXmlStep axis="child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="CityItems" nodeType="element"/>
    <DbXmlStep axis="child" uri="http://dto.destination.dbxml.valhalla.starwood.com" name="CityItem" nodeType="element">
    <OQPlan>P(node-element-presence-none,=,CityItem:http://dto.destination.dbxml.valhalla.starwood.com)</OQPlan>
    </DbXmlStep>
    <Join type="attribute" return="context_item">
    <DbXmlNav>
    <LookupIndex container="en-US">
    <PresenceQP index="node-attribute-equality-double" operation="prefix" child="CityItemId"/>
    </LookupIndex>
    <DbXmlCompare name="equal" join="self">
    <Variable name="Ids"/>
    </DbXmlCompare>
    </DbXmlNav>
    </Join>
    </DbXmlNav>
    </XQuery>
    Any ideas of what is going on?
    Thanks,
    Dmitriy

    Dmitriy,
    Do you have patch #4 for 2.3.10 applied?
    http://www.oracle.com/technology/products/berkeley-db/xml/update/2.3.10/patch.2.3.10.html
    Regards,
    George

  • Log the local variables (string type) to the database (SQL Server)

    i have a customized PreUUT callback so that my own VI gets the information from barcode. it contains serial number as well as other information. i am collecting the information into local variables of the PreUUT callback.
    Now i want to log the local variables (string type) to the database (SQL Server).
    i have a successful connection to the database and i am using a generic recordset schema.
    can anyone help me how to do it?
    also shall i have to create the corrosponding fields (columns) in the database? or is there any option in TestStand4.0 to do it?

    Hello i like original,
    After re-reading your original message, I think I might have a better understanding of what you would like to do.  I have included a few links to Knowledge Base and Developer Zone articles that should be very useful for you.  I have included these links below:
    Logging a New UUT Property to a Database in TestStand
    Logging a New Step Property to a Database in TestStand
    Creating a TestStand Database Schema from Scratch
    Thanks,
    Jonathan C
    Staff Application Engineering Specialist | CTD | CLA
    National Instruments

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • Using include with variables (String)?

    Is it possible to include a *.jspf page from a variable (string)?
    I'm currently trying something like this, but I know it isn't quite correct (the PAGE string is already defined):
    <%@ include file="${PAGE}" %>I'm sure this is simple, but I'm pretty new to using JSP (I'm used to normal Java classes and the JSP syntax can be confusing at first...).
    Thanks!

    Ok, you're mixing up your EL expressions with scriptlet variables.
    These things are not the same.
    String PAGE = "pages/home.jspf"; decleares a scriptlet variable called PAGE
    You can normally access it using the scriptlet expression tag like <%= PAGE %>
    ${PAGE} is an EL expression.
    The EL variables are stored as attributes in the page, request, session and application scopes.
    So ${PAGE} will not give you the value of the scriptlet variable Page.
    ${PAGE} is approximately equal to pageContext.findAttribute("PAGE") in java.
    Probably the easiest fix would be to use a scriptlet expression rather than an EL expression.
    <jsp:include page="<%= PAGE %>"/>The better fix would be not to use any scriptlet code at all in your JSP, and maybe just use the JSTL conditional tags.
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <c:set var="PAGE" value="${requestScope.page}"/>
    <c:if test="${empty requestScope.page}">
      <c:set var="PAGE" value="pages/home.jspf"/>
    </c:if>
    <jsp:include page="${PAGE}"/>
    //or
    <c:import url="${PAGE}"/>Cheers,
    evnafets

Maybe you are looking for

  • Performance Report in EM

    Is it possible to produce a performance report of a database in Enterprise Manager over 1 month to 1 year ???

  • When my phone is looked, i would see or hear that there is a message or a missed call

    When my phone is looked, i would see or hear that there is a message or a missed call on my phone; Is it an App that enable this function?

  • IChat text is not showing up

    I have used iChat without incidence for over a year. Recently, however, every time I open iChat an empty chat window appears. When I open a new chat, I type something, but my screen only shows the "..." in my bubble. I have confirmed that those I am

  • "Subject Area" in Info Business Event Group

    What is the application "Training Center" in ESS? Why shoul I check/uncheck "Subject Area" check box so that a Business Event Group displays/not displays in the Training Center? Points assured! Thanks, Nivedita.

  • My skype got deleted?

    Dear folks, yesterday I was logged on my skype and talked with people like normal. I was eating, and when I came back, I was logged off... I tried to log in, but I couldn't log in. It says wrong username/pw, even though I'm pretty sure its the correc