HQL join query not working

Hi All,
I don't know whether this is the right forum to post this topic...
I am very new to Hibernate. I have written the following query.
          query = session.createQuery(" SELECT a.userId FROM com.myhibernatetrials.vo.UserVO a left join ArtifactVO b where a.roleId='B' and a.userId = b.qaReviewerId group by a.userId order by count(b.artifactNum)");
When I run the application I am getting the error 'Path expected for join! '
Please see the detailed message below.
org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [ SELECT a.userId FROM com.myhibernatetrials.vo.UserVO a left join ArtifactVO b  where a.roleId='B' and a.userId = b.qaReviewerId  group by a.userId order by count(b.artifactNum)]
     at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
     at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
     at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
     at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
     at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
     at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
     at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
     at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
     at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
     at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
     at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
     at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
     at com.myhibernatetrials.dao.CreateArtifactDAO.createArtifact(CreateArtifactDAO.java:23)
     at com.myhibernatetrials.action.SelectReviewerAction.execute(SelectReviewerAction.java:32)
     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
     at java.lang.Thread.run(Thread.java:595)
Please help to resolve this.
Thanks
Neelambary

Change like this
SELECT SINGLE
T1~PERNR
T1~BEGDA
T1~ENAME
T1~PLANS
T1~KOSTL
T2~STRAS
T2~PSTLZ
T2~ORT01
T3~PLSTX
T4~LTEXT
INTO FS_TAB
FROM PA0001 AS T1
INNER JOIN PA0006 AS T2 ON T1~PERNR eq T2~PERNR
INNER JOIN T528T AS T3 ON T1~PLANS EQ T3~PLANS
LEFT OUTER JOIN CSKT AS T4 ON T1~KOSTL EQ T4~KOSTL
WHERE T1~PERNR eq p_pernr.
OR
SELECT SINGLE
T1~PERNR
T1~BEGDA
T1~ENAME
T1~PLANS
T1~KOSTL
T2~STRAS
T2~PSTLZ
T2~ORT01
T3~PLSTX
T4~LTEXT
INTO FS_TAB
FROM PA0001 AS T1
LEFT OUTER JOIN PA0006 AS T2 ON T1~PERNR eq T2~PERNR
LEFT OUTER JOIN T528T AS T3 ON T1~PLANS EQ T3~PLANS
LEFT OUTER JOIN CSKT AS T4 ON T1~KOSTL EQ T4~KOSTL
WHERE T1~PERNR eq p_pernr.
as long as the table is not used in where condition, u can use left outter join.

Similar Messages

  • Inner join query not working properly

    Hi everyone,
    It does not gives any error, but it is not fetching any values...but when i dont include fourth table CSKT AND THE FIELD LTEXT it is fetching the values.
    SELECT SINGLE
          T1~PERNR
          T1~BEGDA
          T1~ENAME
          T1~PLANS
          T1~KOSTL
          T2~STRAS
          T2~PSTLZ
          T2~ORT01
          T3~PLSTX
          T4~LTEXT
          INTO  FS_TAB
          FROM PA0001 AS T1
          INNER JOIN PA0006 AS T2 ON T1PERNR eq T2PERNR
          INNER JOIN T528T AS T3 ON T1PLANS EQ T3PLANS
          INNER JOIN CSKT AS T4 ON T1KOSTL EQ T4KOSTL
          WHERE T1~PERNR eq p_pernr.

    Change like this
    SELECT SINGLE
    T1~PERNR
    T1~BEGDA
    T1~ENAME
    T1~PLANS
    T1~KOSTL
    T2~STRAS
    T2~PSTLZ
    T2~ORT01
    T3~PLSTX
    T4~LTEXT
    INTO FS_TAB
    FROM PA0001 AS T1
    INNER JOIN PA0006 AS T2 ON T1~PERNR eq T2~PERNR
    INNER JOIN T528T AS T3 ON T1~PLANS EQ T3~PLANS
    LEFT OUTER JOIN CSKT AS T4 ON T1~KOSTL EQ T4~KOSTL
    WHERE T1~PERNR eq p_pernr.
    OR
    SELECT SINGLE
    T1~PERNR
    T1~BEGDA
    T1~ENAME
    T1~PLANS
    T1~KOSTL
    T2~STRAS
    T2~PSTLZ
    T2~ORT01
    T3~PLSTX
    T4~LTEXT
    INTO FS_TAB
    FROM PA0001 AS T1
    LEFT OUTER JOIN PA0006 AS T2 ON T1~PERNR eq T2~PERNR
    LEFT OUTER JOIN T528T AS T3 ON T1~PLANS EQ T3~PLANS
    LEFT OUTER JOIN CSKT AS T4 ON T1~KOSTL EQ T4~KOSTL
    WHERE T1~PERNR eq p_pernr.
    as long as the table is not used in where condition, u can use left outter join.

  • Oracle date parameter query not working?

    http://stackoverflow.com/questions/14539489/oracle-date-parameter-query-not-working
    Trying to run the below query, but always fails even though the parameter values matches. I'm thinking there is a precision issue for :xRowVersion_prev parameter. I want too keep as much precision as possible.
    Delete
    from CONCURRENCYTESTITEMS
    where ITEMID = :xItemId
    and ROWVERSION = :xRowVersion_prev
    The Oracle Rowversion is a TimestampLTZ and so is the oracle parameter type.
    The same code & query works in Sql Server, but not Oracle.
    Public Function CreateConnection() As IDbConnection
    Dim sl As New SettingsLoader
    Dim cs As String = sl.ObtainConnectionString
    Dim cn As OracleConnection = New OracleConnection(cs)
    cn.Open()
    Return cn
    End Function
    Public Function CreateCommand(connection As IDbConnection) As IDbCommand
    Dim cmd As OracleCommand = DirectCast(connection.CreateCommand, OracleCommand)
    cmd.BindByName = True
    Return cmd
    End Function
    <TestMethod()>
    <TestCategory("Oracle")> _
    Public Sub Test_POC_Delete()
    Dim connection As IDbConnection = CreateConnection()
    Dim rowver As DateTime = DateTime.Now
    Dim id As Decimal
    Using cmd As IDbCommand = CreateCommand(connection)
    cmd.CommandText = "insert into CONCURRENCYTESTITEMS values(SEQ_CONCURRENCYTESTITEMS.nextval,'bla bla bla',:xRowVersion) returning ITEMID into :myOutputParameter"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.ReturnValue
    p.DbType = DbType.Decimal
    p.ParameterName = "myOutputParameter"
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion"
    v.Value = rowver
    cmd.Parameters.Add(v)
    cmd.ExecuteNonQuery()
    id = CType(p.Value, Decimal)
    End Using
    Using cmd As IDbCommand = m_DBTypesFactory.CreateCommand(connection)
    cmd.CommandText = " Delete from CONCURRENCYTESTITEMS where ITEMID = :xItemId and ROWVERSION = :xRowVersion_prev"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.Input
    p.DbType = DbType.Decimal
    p.ParameterName = "xItemId"
    p.Value = id
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion_prev"
    v.Value = rowver
    v.Precision = 6 '????
    cmd.Parameters.Add(v)
    Dim cnt As Integer = cmd.ExecuteNonQuery()
    If cnt = 0 Then Assert.Fail() 'should delete
    End Using
    connection.Close()
    End Sub
    Schema:
    -- ****** Object: Table SYSTEM.CONCURRENCYTESTITEMS Script Date: 1/26/2013 11:56:50 AM ******
    CREATE TABLE "CONCURRENCYTESTITEMS" (
    "ITEMID" NUMBER(19,0) NOT NULL,
    "NOTES" NCHAR(200) NOT NULL,
    "ROWVERSION" TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL)
    STORAGE (
    NEXT 1048576 )
    Sequence:
    -- ****** Object: Sequence SYSTEM.SEQ_CONCURRENCYTESTITEMS Script Date: 1/26/2013 12:12:48 PM ******
    CREATE SEQUENCE "SEQ_CONCURRENCYTESTITEMS"
    START WITH 1
    CACHE 20
    MAXVALUE 9999999999999999999999999999

    still not comming...
    i have one table each entry is having only one fromdata and one todate only
    i am running below in sql it is showing two rows. ok.
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  '830' and  '850'  and t1.U_frmdate ='20160801'  and  t1.u_todate='20160830'
    in commond promt
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  {?FromEmid} and  {?ToEmid} and t1.U_frmdate ={?FDate} and  t1.u_todate={?TDate}
    still not showing any results..

  • Cancel Query not working

    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.

    jemar98 wrote:
    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.Please post the details of the application release, database version and OS.
    Was this working before? If yes, any changes been done recently?
    Please review (Canceling Long Running Queries in Oracle Applications 11i [ID 138159.1]) and make sure you complete all the steps.
    Thanks,
    Hussein

  • Join is not working in webi report

    I have let's say three tables; one fact and two dimensions;
    I manually joined each dimension table with the fact with 1 to many cardinality...
    Now I'm trying to run a test report using few fields from each dimension and it doesn't seem to join; in the SQL Viewer in Edit Query mode, it has two queries under Synchronization...it doesn't show a joined query between tables....
    I have a similar setup in another universe that is out of the box solution and that seems to work just fine...
    Am I missing something here...Please help!

    Hi Ahmed,
    Along with the context that is present in your universe, check under the parameters the fifth tab i.e. the sql tab.
    In this see whether the options are checked or not.
    the options :
    1.Multiple sql statements for each context.
    2.Multiple sql statements for each measure.
    Gaurav

  • Query not working while creating Sales Order... Need suggestions

    Dear All,
    My client requirement involves creation of Sales Orders both as standalone as well as based on Quotations, depending on the case. Now there is a UDF created in the Item Master Data called "U_Unit" which should be populated in another UDF (U_BPQty) in the Sales Order and Sales Quotation which can be changed at the transaction level.
    The requirement is if the Sales Order is created based on Quotation, the system should take the value from 'U_BPQty" of "Sales Quotation" and populate in the Sales Order. if the Sales Order is created as stand-alone, it should take the value from U_Unit field of the Item Master Data. I wrote the following query for that purpose and using it as a FMS but its not working.
    Can you suggest me where I am going wrong?
    Declare @Base varchar
    Declare @Item varchar
    Declare @Draw varchar
    Declare @BaseQty varchar
    Set @Base = (Select Case When $[$38.44.0] is Null then 0 when $[$38.44.0] is not Null then $[$38.44.0] end)
    Set @Item = ($[$38.1.0])
    Set @Draw = (SELECT T0.U_BPQty from QUT1 T0 INNER JOIN OQUT T1 ON T0.DocEntry = T1.DocEntry INNER JOIN RDR1 T2 ON T2.BaseRef = T1.DocNum WHERE T0.ItemCode = @Item)
    Set @BaseQty = (SELECT T0.U_Unit from OITM T0 WHERE T0.ItemCode = $[$38.1.0])
    Select Case when (@Base = 0) then @BaseQty when (@Base <> 0) then @Draw end
    Thanks and regards,
    Bharath S

    Hi Bharath.......
    As you said if SQ not there and SO is directly punched then it should Pick up U_Unit else if SQ has target of SO then U_BP then your query working fine.
    But if SQ not there and Del is directly punched instead of SO then it should Pick up U_Unit else if SQ has target of Delivery and not SO then U_BP. Is it?
    In such case its not working?
    If yes then use this query.......
    declare @basedoc as nvarchar
    set @basedoc=$[DLN1.BaseType.0]
    If @basedoc<1
    Begin
    Select T0.U_Unit from OITM T0 Where T0.ItemCode=$[DLN1.ItemCode.0]
    End
    If @basedoc>1
    Begin
    Select T0.U_BPQty From QUT1 T0 where T0.docentry=$[DLN1.BaseEntry.0] and T0.ItemCode=$[DLN1.ItemCode.0]
    End
    Else use this......
    declare @basedoc as nvarchar
    set @basedoc=$[DLN1.BaseType.0]
    If @basedoc<1
    Begin
    Select T0.U_Unit from OITM T0 Where T0.ItemCode=$[DLN1.ItemCode.0]
    End
    If @basedoc>1
    Begin
    Select T0.U_BPQty From RDR1 T0 where T0.docentry=$[$38.45.0] and T0.ItemCode=$[DLN1.ItemCode.0]
    End
    Regards,
    Rahul

  • Pld Query Not Working..

    Dear All,
    Following Query is not working when i Use the condition please guide me...
    SELECT     DocNum, DocDate, Linenum,ItemCode,Dscription,Quantity,Unitmsr,paymentterm,cardName,
                            SUM(AED)  AS AED,SUM(CST) as CST,
                         SUM(BED) AS BED, SUM(eCess) AS eCess, SUM(HSC) AS HSC, SUM(VAT) AS Vat
    FROM         (SELECT     t1.Linenum,t0.DocEntry,t0.DocNum, t0.cardName , t0.DocDate,t1.ItemCode, t1.Dscription, t1.Quantity,t1.Unitmsr,t4.pymntgroup as 'paymentterm',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'CUS%' THEN t2.basesum ELSE 0 END), 0) AS 'NetAV',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'CUS%' THEN t2.TaxSum ELSE 0 END), 0) AS 'BasicCD',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'CST%' THEN t2.TaxSum ELSE 0 END), 0) AS 'CST',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'AED%' THEN t2.TaxSum ELSE 0 END), 0) AS 'AED',
    ISNULL((CASE WHEN upper(t2.statype) = - 90 THEN t2.TaxSum ELSE 0 END), 0) AS 'BED', ISNULL((CASE WHEN upper(t2.statype) = - 60 THEN t2.TaxSum ELSE 0 END), 0)
                                                  AS 'eCess', ISNULL((CASE WHEN upper(t2.statype) = - 55 THEN t2.TaxSum ELSE 0 END), 0) AS 'HSC',
                                                  ISNULL((CASE WHEN upper(t2.stacode) LIKE 'Vat%' THEN t2.TaxSum ELSE 0 END), 0) AS 'VAT'
                                                                                    FROM  OINV AS t0 INNER JOIN
                         INV1 AS t1 ON t0.DocEntry = t1.DocEntry INNER JOIN
                   OCTG as t4 on t0.groupnum=t4.groupnum inner join
                                                  OITM AS t3 ON t1.ItemCode = t3.ItemCode INNER JOIN
                                                inv4 AS t2 ON t1.DocEntry = t2.DocEntry AND t1.LineNum = t2.LineNum LEFT OUTER JOIN
                                                  [@BTT_RG23D] AS t6 ON t1.U_FolioNo = t6.Code
                                           ) AS T
                       GROUP BY DocNum,cardName,Linenum, DocDate,Quantity,Dscription,ItemCode,CST,paymentterm,Unitmsr
    Thanks
    Mangesh Pagdhare

    Dear Mangesh Pagdhare,
    You need T. in front of all your main query fields at least.
    Thanks,
    Gordon

  • Select query not working in Dev but working in QA and PRD

    Hi All,
    I have a select query with inner join which is not working in the DEV but working in QA and PRD. Anyone has any idea why is it happening, I think it to be a basis issue. Just want to confirm if anyone has any other idea.
    Thanks in advance,
    Barjinder Singh.

    Hi Barjinder Singh,
    In development you can't find the records for the table.
    In testing system only you can test even the program(report).
    If it is the DEV system you can't get the data.
    Go and see into the table wether it has records or not(in DEV system).
    It doesn't has the records in DEV system.
    Regards,
    Balakrishna.N

  • Query not working fine

    Hi
    db version is 9.2.0.8.0
    in dev the query is working fine.But in qa the query is not working fine(hanging).I had checked the explain plans.
    Both are different.This is due to difference in volume of data.
    I am pasting the explain plans of both the queries in qa and dev
    qa explain plan
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 606M| 118G| | 107M (1)|
    | 1 | SORT GROUP BY | | 606M| 118G| 524G| 107M (1)|
    | 2 | HASH JOIN | | 1869M| 363G| | 50748 (1)|
    | 3 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 9066 | 318K| | 331 (1)|
    | 4 | HASH JOIN | | 2474K| 408M| 2232K| 50400 (1)|
    | 5 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 54396 | 1593K| | 330 (1)|
    | 6 | HASH JOIN | | 2474K| 337M| | 31791 (1)|
    | 7 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 206 | 3296 | | 25 (4)|
    | 8 | HASH JOIN | | 3162K| 382M| | 31745 (1)|
    | 9 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 3087 | 27783 | | 25 (4)|
    | 10 | HASH JOIN | | 3162K| 355M| 2952K| 31699 (1)|
    | 11 | MERGE JOIN CARTESIAN | | 62930 | 2212K| | 14627 (1)|
    | 12 | INDEX FAST FULL SCAN | SYS_C0013071 | 2923 | | | 4 (25)|
    | 13 | BUFFER SORT | | 22 | 792 | | 14623 (1)|
    | 14 | TABLE ACCESS BY INDEX ROWID| CURCY_CONVERT_RATE | 22 | 792 | | 6 (17)|
    | 15 | INDEX RANGE SCAN | XPKCURRATE | 22 | | | 5 (20)|
    | 16 | TABLE ACCESS FULL | SHIPPABLE_BACKLOG_FACT | 321K| 25M| | 15494 (1)|
    dev explain plan
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 17M| 2978M| | 927K (1)|
    | 1 | SORT GROUP BY | | 17M| 2978M| 6504M| 927K (1)|
    |* 2 | HASH JOIN | | 17M| 2978M| | 2726 (1)|
    |* 3 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 4992 | 180K| | 416 (1)|
    |* 4 | HASH JOIN | | 41051 | 5852K| 2872K| 2309 (1)|
    | 5 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 69888 | 2047K| | 415 (1)|
    |* 6 | HASH JOIN | | 41051 | 4650K| | 1504 (1)|
    |* 7 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 206 | 3296 | | 37 (3)|
    |* 8 | HASH JOIN | | 52460 | 5123K| | 1467 (1)|
    | 9 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 3087 | 27783 | | 37 (3)|
    |* 10 | HASH JOIN | | 52460 | 4661K| | 1430 (1)|
    |* 11 | TABLE ACCESS FULL | SHIPPABLE_BACKLOG_FACT | 7718 | 414K| | 513 (1)|
    | 12 | MERGE JOIN CARTESIAN | | 48941 | 1720K| | 915 (0)|
    | 13 | INDEX FULL SCAN | SYS_C0060330 | 1827 | | | 7 (15)|
    | 14 | BUFFER SORT | | 27 | 972 | | 913 (0)|
    | 15 | TABLE ACCESS BY INDEX ROWID| CURCY_CONVERT_RATE | 27 | 972 | | 2 (50)|
    |* 16 | INDEX RANGE SCAN | XPKCURRATE | 27 | | | 4 (25)|
    Here is the query
    SELECT 'BACKLOG' AS SUBJECT_AREA, 'CURRENT' AS TIME_RANGE
    ,GEO_ROLLUP.GEOGRAPHY_HIER_KEY
    ,PRODUCT_ROLLUP.PRODUCT_HIER_KEY
    , backlog_FACT.DISTRIBUTION_CH_ID
    , backlog_FACT.SALES_DISTRICT_ID
    , SUM(NVL(backlog_FACT.GC_SCHEDULED_AMT,0) - NVL(backlog_FACT.GC_biilled_AMT,0)) AS billing_backlog_AMT
    , SUM(NVL(backlog_FACT.GC_SCHEDULED_AMT,0)- NVL(backlog_FACT.GC_DELIVERED_AMT,0)) AS delivery_backlog_AMT
    , SUM(NVL(backlog_FACT.GC_SCHEDULED_AMT,0) - NVL(backlog_FACT.GC_REV_REC_AMT,0)) AS rev_rec_backlog_AMT
    , CURCY.VALID_FROM
    FROM fact.shippable_backlog_FACT backlog_FACT
    , DIM.DIM_PRODUCT_HIER PRODUCT
    , DIM.DIM_GEOGRAPHY_HIER GEO
    , DIM.DIM_DATE DT
    , DIM.DIM_PRODUCT_HIER PRODUCT_ROLLUP
    , DIM.DIM_GEOGRAPHY_HIER GEO_ROLLUP
    , DIM.CURCY_CONVERT_RATE CURCY
    WHERE
    PRODUCT.PRODUCT_HIER_KEY = backlog_FACT.GEF_PRODUCT_HIER_KEY
    AND GEO.GEOGRAPHY_HIER_KEY = backlog_FACT.GEF_SHIP_TO_GEO_HIER_KEY
    AND ( backlog_FACT.DELIVERY_COMPLETE_DATE IS NULL
         OR backlog_FACT.BILLING_COMPLETE_DATE IS NULL
         OR backlog_FACT.REV_REC_COMPLETE_DATE IS NULL
    AND PRODUCT.PRODUCT_TYPE = PRODUCT_ROLLUP.PRODUCT_TYPE
    AND PRODUCT_ROLLUP.HIER_LEVEL_NUM = 4
    AND PRODUCT_ROLLUP.CURRENT_RECORD_IND = 'Y'
    AND GEO_ROLLUP.SUB_POLE = GEO.SUB_POLE
    AND GEO_ROLLUP.HIER_LEVEL_NUM = 3
    AND GEO_ROLLUP.CURRENT_RECORD_IND = 'Y'
    AND CURCY.VALID_FROM <= BACKLOG_FACT.ORDER_LINE_CREATE_DATE
    AND CURCY.VALID_TO > BACKLOG_FACT.ORDER_LINE_CREATE_DATE
    AND CURCY.EXCHANGE_TYPE_ID = 'M'
    AND CURCY.TO_CURRENCY_ID = 'USD'
    AND CURCY.FROM_CURRENCY_ID = BACKLOG_FACT.DOCUMENT_CURRENCY_ID
    GROUP BY
    PRODUCT_ROLLUP.PRODUCT_HIER_KEY,
    GEO_ROLLUP.GEOGRAPHY_HIER_KEY,
    backlog_FACT.DISTRIBUTION_CH_ID,
    backlog_FACT.SALES_DISTRICT_ID,
    CURCY.VALID_FROM;
    I analyzed all the tables involved in it.
    can anybody give me suggestion in crating indexes or anything else?
    Thanks
    Veer

    Veer,
    Modify your post and enclose your code and output between \ tags for formatting
    \Your code or output goes here
    \Now, are table stats are upto date on all the table on QA machine? If not, analyze your table and indexes and re-run your query
    Regards
    Edited by: OrionNet on May 7, 2009 3:35 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Mismatch query not working. Not sure what I did wrong.

    In my query, I have created two CTE's. One pulls in the records of all people who are assigned to an audience. The other pulls in all people who are assigned to the same audience AND completed a certain course.
    What I wanted to do from there, was to do a mismatch query, not to find the PEOPLE, but just the departments that were represented in the audience, but had no people in the list of those who completed the course. (In other words, say the HR Department had
    three people in the audience... two completed the course, one did not. The HR Department should NOT show up in my mismatch query because some of their people completed the course. Then, say the IT Department had five people in the audience, and none of them
    have completed the course. The IT Department SHOULD show up in my mismatch query. For this case, I don't care about the people who didn't complete it, just the departments where nobody did yet.)
    I thought I was doing the mismatch query correctly, but I guess I must not. I will share the relevant parts of my query below (there is more to my query, but I don't think you necessarily need to see it to assist with this particular problem). (Side note:
    Yes, I know the way I am doing the fiscal calendar is not ideal, but I've looked up other ways to do it, and do not understand it. Given time, I can break it down and understand it, but I am in a rush to finish this report.)
    gm101certtbl
    AS
    select
    dimUser.EmpFK MeasureEmpFK,
    RIGHT(OrgCode2, LEN(OrgCode2) - 2) MeasurePC,
    audusersName MeasureAudName,
    dimActivity.ActivityName MeasureActName,
    dimActivity.Code MeasureActCode,
    CASE
    WHEN OrgCode2 LIKE 'US%' then 'US'
    WHEN OrgCode2 LIKE 'CA%' then 'CA' END
    CountryCode,
    'ACTUALS_GM101' SOURCESYSTEMID,
    Null CURRENCYCODE,
    'GM101CERT' MEASUREID,
    Null MEASUREDOLLARS,
    CASE
    WHEN GETDATE() Between '20131001 00:00:00' AND '20140930 11:59:59' THEN '2014'
    WHEN GETDATE() Between '20141001 00:00:00' AND '20150930 11:59:59' THEN '2015'
    WHEN GETDATE() Between '20151001 00:00:00' AND '20160930 11:59:59' THEN '2016'
    WHEN GETDATE() Between '20161001 00:00:00' AND '20170930 11:59:59' THEN '2017' END
    FiscalYear,
    CASE
    WHEN MONTH(GETDATE()) = '10' THEN '1'
    WHEN MONTH(GETDATE()) = '11' THEN '2'
    WHEN MONTH(GETDATE()) = '12' THEN '3'
    WHEN MONTH(GETDATE()) = '1' THEN '4'
    WHEN MONTH(GETDATE()) = '2' THEN '5'
    WHEN MONTH(GETDATE()) = '3' THEN '6'
    WHEN MONTH(GETDATE()) = '4' THEN '7'
    WHEN MONTH(GETDATE()) = '5' THEN '8'
    WHEN MONTH(GETDATE()) = '6' THEN '9'
    WHEN MONTH(GETDATE()) = '7' THEN '10'
    WHEN MONTH(GETDATE()) = '8' THEN '11'
    WHEN MONTH(GETDATE()) = '9' THEN '12' END
    FiscalMonthNbr
    from
    dimUser INNER JOIN
    audusers ON audusers.DataSetUsers_EmpFK = dimUser.EmpFK INNER JOIN
    Org ON dimUser.PrimaryDomFK = Org.Org_PK INNER JOIN
    factUserRequiredActivity ON factUserRequiredActivity.UserID = dimUser.ID INNER JOIN
    dimActivity ON dimActivity.ID = factUserRequiredActivity.ActivityID INNER JOIN
    dimRequirementStatus ON factUserRequiredActivity.ReqStatusID = dimRequirementStatus.ID LEFT OUTER JOIN
    UsrOrgs ON dimUser.ID = UsrOrgs.UserID LEFT OUTER JOIN
    UsrDoms ON dimUser.ID = UsrDoms.UserID
    WHERE
    dimActivity.ActivityName = 'GM101 Program Completion'
    AND
    dimRequirementStatus.name = 'Satisfied'
    AND
    (audusersName = @audparam)
    gm101availtbl
    AS
    select
    dimUser.EmpFK MeasureEmpFK,
    RIGHT(OrgCode2, LEN(OrgCode2) - 2) MeasurePC,
    audusersName MeasureAudName,
    Null MeasureActName,
    Null MeasureActCode,
    CASE
    WHEN OrgCode2 LIKE 'US%' then 'US'
    WHEN OrgCode2 LIKE 'CA%' then 'CA' END
    CountryCode,
    'ACTUALS_GM101' SOURCESYSTEMID,
    Null CURRENCYCODE,
    'GM101AVAIL' MEASUREID,
    Null MEASUREDOLLARS,
    CASE
    WHEN GETDATE() Between '20131001 00:00:00' AND '20140930 11:59:59' THEN '2014'
    WHEN GETDATE() Between '20141001 00:00:00' AND '20150930 11:59:59' THEN '2015'
    WHEN GETDATE() Between '20151001 00:00:00' AND '20160930 11:59:59' THEN '2016'
    WHEN GETDATE() Between '20161001 00:00:00' AND '20170930 11:59:59' THEN '2017' END
    FiscalYear,
    CASE
    WHEN MONTH(GETDATE()) = '10' THEN '1'
    WHEN MONTH(GETDATE()) = '11' THEN '2'
    WHEN MONTH(GETDATE()) = '12' THEN '3'
    WHEN MONTH(GETDATE()) = '1' THEN '4'
    WHEN MONTH(GETDATE()) = '2' THEN '5'
    WHEN MONTH(GETDATE()) = '3' THEN '6'
    WHEN MONTH(GETDATE()) = '4' THEN '7'
    WHEN MONTH(GETDATE()) = '5' THEN '8'
    WHEN MONTH(GETDATE()) = '6' THEN '9'
    WHEN MONTH(GETDATE()) = '7' THEN '10'
    WHEN MONTH(GETDATE()) = '8' THEN '11'
    WHEN MONTH(GETDATE()) = '9' THEN '12' END
    FiscalMonthNbr
    from
    dimUser INNER JOIN
    audusers ON audusers.DataSetUsers_EmpFK = dimUser.EmpFK INNER JOIN
    Org ON dimUser.PrimaryDomFK = Org.Org_PK LEFT OUTER JOIN
    UsrOrgs ON dimUser.ID = UsrOrgs.UserID LEFT OUTER JOIN
    UsrDoms ON dimUser.ID = UsrDoms.UserID
    WHERE
    audusersName = @audparam
    missingPC
    AS
    select distinct
    NULL MeasureEmpFK,
    gm101availtbl.MeasurePC,
    gm101availtbl.MeasureAudName,
    gm101availtbl.MeasureActName,
    gm101availtbl.MeasureActCode,
    gm101availtbl.CountryCode,
    gm101availtbl.SOURCESYSTEMID,
    gm101availtbl.CURRENCYCODE,
    'GM101CERT' MEASUREID,
    gm101availtbl.MEASUREDOLLARS,
    gm101availtbl.FiscalYear,
    gm101availtbl.FiscalMonthNbr
    from
    gm101availtbl LEFT OUTER JOIN
    gm101certtbl on gm101certtbl.MeasurePC = gm101availtbl.MeasurePC
    WHERE gm101certtbl.MeasurePC IS NULL
    If anybody can help, I would greatly appreciate it. I'm trying to do this so I can pull these records into a final table to count the records from the other two, but then include these as a 0 count where these departments have nobody certified.
    To test if this was working, I created a query using this Mismatch query instead as the main query. Instead, it seemed to give me the exact opposite. It seemed to be giving me all of the Departments (MeasurePC) where the records were represented.

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. We have no sample data, so we cannot even guess. 
    >> In my query, I have created two CTE's. One pulls in the records [sic] of all people who are assigned to an audience. The other pulls in all people who are assigned to the same audience AND completed a certain course. <<
    Please, please learn the basic terms. Rows are not records. And THEN learn what “redundancy” means so you will not write two CTEs in the future. 
    >> What I wanted to do from there, was to do a mismatch query, not to find the PEOPLE, but just the departments that were represented in the audience, but had no people in the list of those who completed the course. (In other words, say the HR Department
    had three people in the audience... two completed the course, one did not. The HR Department should NOT show up in my mismatch query because some of their people completed the course. THEN, say the IT Department had five people in the audience, and none of
    them have completed the course. The IT Department SHOULD show up in my mismatch query. For this case, I don't care about the people who didn't complete it, just the departments where nobody did yet.) <<
    This is a Relational Division. It is one of Dr. Codd's original 8 operations. 
    We do not use the Sybase CURRENT_TIMESTAMP any more. We have DATE data types tody, rtoo. We never tibble in good code; it is a design flaw that used meta-data affixes like “tbl” in schema object _names, PK in column _names, etc. We do not have repeated groups
    like “org_code_2”; we do not use arrays in RDBMS. Why is your data so screwed up you have use 
    CASE 
    WHEN org_code2 LIKE 'US%' THEN 'US'
    WHEN org_code2 LIKE 'CA%' THEN 'CA' END 
    to clean it up in a query; the DDL should have prevented this problem. 
    Why are you doing calendar computing in your query? Where is the Calendar table? 
    “Users.id = UsrOrgs.user_id” says that you have magic, generic “id” that can change its name from table to table. Likewise, a generic, magic “code”, etc. What might be even worse is that totally different data elements have the same name! “Automobiles, squids
    and Lady Gaga” programming is not RDBMS. 
    You have never heard of ISO-11179 and data modeling? 
    Here is a skeleton for fiscal calendar table to replace your current row by row temporal math: 
    CREATE TABLE Calendar 
    (cal_date DATE NOT NULL PRIMARY KEY, 
     fiscal_month CHAR(10) NOT NULL,
    INSERT INTO  Calendar
    VALUES 
    ('2014-10-01', '2015-01-00', ..), 
    ('2014-09-30', '2015-12-00', ..), 
    You can use a spread sheet and a text edit to fill in the table for 50 or 100 years. 
    I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601 data format required by Standard SQL and it is
    language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • SAP Query not working

    Hi,
    I am facing problem with SAP Query. My query is not working for one particular date. Its giving timeout error when i just give date as input. I tried executing it by giving some particular document as input, then its giving "no data" message but when i check the table data, there are some records for that input condition.
    I debugged it, i found that the statement "FETCH NEXT CURSOR cursorname" is throwing sy-subrc eq 4. I couldn't understand the problem.
    Any inputs will be very helpful.
    Regards,
    Mahidhar.

    Hi Azeem,
    There are more than 10 tables that were used in this query with different types joins like inner join, left outer, right outer join. So i wasnt able to decode the select query that was present in open cursor command.
    I have given the date and executed the same in background. It ran in 19min. But when i add one more input parameter, then its running more than a day(still running ). Didn't get the exact problem still.
    Regards,
    Mahidhar.

  • Dynamic query not working

    hi
    im using a dynamic query to put in an internal table but its not working
    Can you see whats wrong in that?
    gv_query = ' au~uname AS OTCTUSERNM,'.
    CONCATENATE gv_query  'a1object' '.' 'a1field'  ' AS  0TCTAUTH'  INTO gv_query.
    CONCATENATE gv_query  'au~to_dat AS OTCTADTO, OTCTOBJNM, ' INTO gv_query.
    SELECT DISTINCT (gv_query)
      INTO CORRESPONDING FIELDS OF TABLE gi_ds1
      FROM agr_users AS au INNER JOIN
      agr_1251 AS a1
      ON auagr_name = a1agr_name.

    Hello,
    Following are the observations:
    1. gv_query = ' au~uname AS OTCTUSERNM,'.
    >> In above string i think you want to use uname column as OTCTUSERNM and it is correct
    2. CONCATENATE gv_query 'a1object' '.' 'a1field' ' AS 0TCTAUTH' INTO
        gv_query.
    >> In statement 2 above I am not able to understand whey 'a1object' '.' 'a1field'  this is incorrect.
         Also '.' (dot) in not required in query it will be either '~' or 'AS' as valid chars.
    3. CONCATENATE gv_query 'au~to_dat AS OTCTADTO, OTCTOBJNM, ' INTO gv_query.
    >> In statement 3 above whey OTCTOBJNM is used there is no such column exit in AGR_USERS.
    4. SELECT DISTINCT (gv_query)
        INTO CORRESPONDING FIELDS OF TABLE gi_ds1
        FROM agr_users AS au INNER JOIN
        agr_1251 AS a1
        ON auagr_name = a1agr_name.
    >> In above statement a1 is used as alias for AGR_USERS then why it it not there in statement 3 where instead au is used.
    Normarlly query is like this
    '<alias1><col_name1> as <col_desc1>, <alias2><col_name2> as <col_desc2>......up to n cols
    In this case it is possible that alias1 and alias2 are used for different table in case of joins and for same table in case of self joins.
    Finally, You can only define colums in dynamic query those are available in the table from which we have to select the data.
    Hope this helps.
    Thanks,
    Augustin.

  • OSD: SCCM 2012 collection which should exclude Windows 7 clients (query not working fine)

    Hi,
    We have an SCCM 2012 collection to which we deploy Windows 7.
    Vista clients get a SCCM 2012 client in SCCM 2007 and once they have it, they get a Windows 7 deployment.
    The group is populated by an AD query and that works fine. However, when we try to exclude Windows 7 machines (query = not Windows NT ... 6.1) the query does not return any result.
    Please advise.
    J.
    Jan Hoedt

    Please check your query. It should be like the following.
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.Version != "6.1.7601"
    Juke Chou
    TechNet Community Support

  • Link for BUT000 table and ADRC in CRM and inner join is not working in PCUI

    Hi Gurus,
       Please tell me the link btween BUT000 and ADRC table. and i wrote one inner join between BUT000 and BUT0id table but it not working. I m in CRM 4.0 version working with PCUI.
    select but000partner but000name_org1 but000name_org2 but000bus_sort1 but0id~parnter1
          but0ididnumber from but000 inner join but0id on but0idpartner = but000~parnter
    into corresponding fields of table it_result where partner in s_partner.
    It is giving error as partner unknown from but000 table. I delcared everything and tried with alias names also.
    please clarify me.
    regards,
    Ramakrishna.

    Hi Frederic,
       thanks a lot. But is inner join between BUT000 and BUT0ID will work. for me it is not working. plesae see this code.
    tables : but000,
             but0id,
             crmm_but_custno,
             adrc.
    types : begin of typ_but000,
            partner type bu_partner,
            name_org1 type BU_NAMEOR1,
            name_org2 type BU_NAMEOR2,
            bu_sort1  type BU_SORT1,
            idnumber type BU_ID_NUMBER,
            partner1 type bu_partner,
            end of typ_but000.
    data: lt_but000 type table of typ_but000,
          ls_but000 like line of lt_but000.
    *select-options : s_partnr for but000-partner.
    start-of-selection.
          select but000partner but000name_org1 but000name_org2 but000bu_sort1 but0id~parnter1
                    but0id~idnumber into corresponding fields of table lt_but000 from  but000
                    inner join but0id on but0idpartner = but000parnter. " where partner in s_partner.
    it is giving error as but000-partner is not know or but0id-partner not known.
    So, i think if it not works then i should write two select stmts.
    please clarify me.
    i gave u rating.
    thanks
    ramakrishna.

  • Inline transform for Sql Query not working in SAP MII 12.1 Version 12.1.8 B

    Hi All,
    I applied an xslt for an sql query which returns an xml file.
    I used inline transform icon in sql query to load an xsl file which has to return me a string
    Any idea why is not working for me..?
    My Sample XML file:
                                     <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="/XMII/CM/BatchDisposition/BatchQueueManagement/StyleSheets/ProductXsl.xsl"?>
    <Rowsets DateCreated="2011-05-05T07:27:45" EndDate="2011-05-05T07:27:45" StartDate="2011-05-05T06:27:45" Version="12.1.8 Build(20)">
         <Rowset>
              <Columns>
                   <Column Description="ProductName" MaxRange="1" MinRange="0" Name="ProductName" SQLDataType="12" SourceColumn="ProductName"/>
              </Columns>
              <Row>
                   <ProductName>Asprin 100mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row>
                   <ProductName>Asprin 300mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row><ProductName>Ibprooven 200mg Tablets 12 x 10 strip</ProductName></Row>
              <Row><ProductName>RipTide 50mg Tablets 40 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 200mg Tablets 6 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 400mg Tablets 12 x10 strip</ProductName></Row>
         </Rowset>
    </Rowsets>
    My Sample XSl File:
                                    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <xsl:text>["</xsl:text>
         <xsl:for-each select="Rowsets/Rowset/Row">
              <xsl:value-of select="ProductName"/>
              <xsl:if test="position() &lt; last()">
                   <xsl:text>","</xsl:text>
                    </xsl:if>
              <xsl:if test="position()=last()">
                           <xsl:text>"]</xsl:text>
                    </xsl:if>
         </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Any Suggestions  are Welcome:
    Thanks

    Something like this should work...
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
              <Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">
                   <xsl:copy-of select="/Rowsets/FatalError"/>
                   <xsl:copy-of select="/Rowsets/Messages"/>
                   <Rowset>
                   <Columns>
                        <Column Description="Mycol1" MaxRange="1" MinRange="0" Name="Mycol1" SQLDataType="12" SourceColumn="Mycol1" />
                   </Columns>
                   <Row>
                   <Mycol1>
                   <xsl:text>["</xsl:text>
                        <xsl:for-each select="/Rowsets/Rowset/Row">
                             <xsl:value-of select="." />
                             <xsl:choose>
                                  <xsl:when test="position() &lt; last()"><xsl:text>","</xsl:text></xsl:when>
                                  <xsl:otherwise><xsl:text>"]</xsl:text></xsl:otherwise>
                             </xsl:choose>
                        </xsl:for-each>
                   </Mycol1>
                   </Row>
                   </Rowset>
              </Rowsets>
         </xsl:template>
    </xsl:stylesheet>

Maybe you are looking for