Wierd Query

Hi,
I have a problem regarding a query.
In the query i want to get the values which are greater than some specific value.
Its some thing like this..
SELECT blah..blah..
FROM X
WHERE x.col1 > (SELECT blah1 FROM Y where someconditions)
Since the sub query returns multiple records (and it should return multiples) i cant use > sign here..
So is there anyway to overcome this and fix the query..
thanks in advance..
/garuka

You can use ALL or ANY operator. Below is an example with ALL
ALL - will return all the rows greater than the min value from the subquery
ANY - will return all the rows greater than the max value from the subquery
SQL> create table tab1(no number(10));
Table created.
SQL> create table tab2(no number(10));
Table created.
SQL> insert into tab1 values(10);
1 row created.
SQL> insert into tab1 values(20);
1 row created.
SQL> insert into tab1 values(30);
1 row created.
SQL> insert into tab2 values(21);
1 row created.
SQL> insert into tab2 values(22);
1 row created.
SQL> insert into tab2 values(23);
1 row created.
SQL> insert into tab2 values(25);
1 row created.
SQL> insert into tab1 values(40);
1 row created.
SQL> insert into tab1 values(45);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from tab1
  2  /
        NO
        20
        30
        40
        45
        10
SQL> select * from tab2;
        NO
        22
        23
        25
        21
SQL> select * from tab1 where no > all(select no from tab2);
        NO
        30
        40
        45
SQL>

Similar Messages

  • How to convert (multiple) rows output to multiple (columns)

    Hii
    I have wierd query. But not sure of how to get result out of it!!!
    My query returns two rows for a query that i have posed.
    Current Result
    10
    20
    Expected Result
    10 20
    My problem here is i wanted the above two values to be stored in two variables in a single select statement.
    If i use a cursor my problem will be solved.But i am not much intrested to use a cursor for a simple select statement.
    is there any possibilty that i can convert the output of two rows to two columns??
    I am using Oracle Release 10.1.0.2.0
    Operating system Windows Xp.
    People here will not appreciate the tags "Urgent". I know that :-(.
    But some how i am forced to use this tag "urgent". Sorry for that.
    If no answers i will in other way have to go to cursor :-(
    Any help will be appreciated.
    Thanks,
    Pavan

    Another solution with model and you don't need a subquery
    SELECT  DEPT ,SUBSTR(LOCATION1,2) LOCATION1, SUBSTR(LOCATION2,2) LOCATION2,SUBSTR(LOCATION3,2) LOCATION3
        FROM   T
        MODEL
          RETURN UPDATED ROWS 
         PARTITION BY ( DEPT )
          DIMENSION BY ( ROW_NUMBER() OVER (PARTITION BY DEPT ORDER BY LOCATION ) AS POSITION )
          MEASURES     ( location,CAST ( LOCATION AS VARCHAR2(15)) AS LOCATION1 ,CAST ( LOCATION AS VARCHAR2(15)) AS LOCATION2,
                                   CAST ( LOCATION AS VARCHAR2(15)) AS LOCATION3 )IGNORE NAV
         RULES
           UPSERT
           ITERATE( 1000)
             UNTIL ( PRESENTV(LOCATION[ITERATION_NUMBER+2],1,0) = 0)
           ( LOCATION1[0] =LOCATION1[0] || CASE WHEN ITERATION_NUMBER+1=1 THEN  ',' || LOCATION1[ ITERATION_NUMBER+1] END,
             LOCATION2[0] =LOCATION2[0] || CASE WHEN ITERATION_NUMBER+1=2 THEN  ',' || LOCATION2[ ITERATION_NUMBER+1] END,
              LOCATION3[0] =LOCATION3[0] || CASE WHEN ITERATION_NUMBER+1=3 THEN  ',' || LOCATION3[ ITERATION_NUMBER+1] END  )
       ORDER BY DEPT
    Demo
    SQL> WITH T AS (   SELECT 'AB' DEPT,'MEB' LOCATION FROM DUAL UNION ALL
      2                SELECT 'AB','MEB1' FROM DUAL UNION ALL
      3                SELECT 'AB','MEB2' FROM DUAL UNION ALL
      4                SELECT 'BC','MEB' FROM DUAL UNION ALL
      5                SELECT 'BC','MEB' FROM DUAL UNION ALL
      6                SELECT 'CD','MEN' FROM DUAL UNION ALL
      7                SELECT 'CD','MEN' FROM DUAL
      8                )
      9  SELECT  DEPT ,SUBSTR(LOCATION1,2) LOCATION1, SUBSTR(LOCATION2,2) LOCATION2,SUBSTR(LOCATION3,2)
    LOCATION3
    10      FROM   T
    11      MODEL
    12        RETURN UPDATED ROWS 
    13       PARTITION BY ( DEPT )
    14        DIMENSION BY ( ROW_NUMBER() OVER (PARTITION BY DEPT ORDER BY LOCATION ) AS POSITION )
    15        MEASURES     ( location,CAST ( LOCATION AS VARCHAR2(15)) AS LOCATION1 ,CAST ( LOCATION AS
    VARCHAR2(15)) AS LOCATION2,
    16             CAST ( LOCATION AS VARCHAR2(15)) AS LOCATION3 )IGNORE NAV
    17       RULES
    18         UPSERT
    19         ITERATE( 1000)
    20           UNTIL ( PRESENTV(LOCATION[ITERATION_NUMBER+2],1,0) = 0)
    21         ( LOCATION1[0] =LOCATION1[0] || CASE WHEN ITERATION_NUMBER+1=1 THEN  ',' || LOCATION1[ I
    TERATION_NUMBER+1] END,
    22        LOCATION2[0] =LOCATION2[0] || CASE WHEN ITERATION_NUMBER+1=2 THEN  ',' || LOCATION2[ ITER
    ATION_NUMBER+1] END,
    23        LOCATION3[0] =LOCATION3[0] || CASE WHEN ITERATION_NUMBER+1=3 THEN  ',' || LOCATION3[ ITER
    ATION_NUMBER+1] END  )
    24     ORDER BY DEPT
    25     /
    DE LOCATION1      LOCATION2      LOCATION3
    AB MEB            MEB1           MEB2
    BC MEB            MEB
    CD MEN            MEN
    SQL>
    SQL> 

  • Error while running query for a specific table

    Hi All,
    I need your help please.
    I've configured everything correctly in my SCCM environment. And i used to connect the CAS database from a separate box(same domain) which has SSMS console installed in it. Now the problem is, whenever i try to run a query in CAS database locally, it runs
    successfully. But when i connect the CAS database remotely and run the same query with the same login i used in CAS, it says the below error. This is happening from past 2 days only. :'(
    Query ran :
    select top 100 * from v_GS_WORKSTATION_STATUS
    Error :
    Msg 18456, Level 14, State 1, Line 1
    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
    OLE DB provider "SQLNCLI11" for linked server "abc.domain.com" returned message "Invalid connection string attribute".
    I checked the SQL connection authentication information it says authenticated by kerberos using below query :
    SELECT 
        s.session_id
      , c.connect_time
      , s.login_time
      , s.login_name
      , c.protocol_type
      , c.auth_scheme
      , s.HOST_NAME
      , s.program_name
    FROM sys.dm_exec_sessions s
      JOIN sys.dm_exec_connections c
        ON s.session_id = c.session_id
    where s.host_name='servername'
    Result:
    136 2015-01-30 17:50:29.277 2015-01-30 17:50:29.280 domain\user TSQL KERBEROS servername Microsoft SQL Server Management Studio
    But, another wierd information is i can successfully run the below query in remote.
    select * from vSMS_R_System
    I think that specific table is not working in remote. Pleaseeeeeeee helppp me......
    Regards,
    Jay

    Hi JaySmiley,
    According to your description, you get the logon issue when connecting to CAS database remotely and execute query. Right?
    In this scenario, this error can happen when the SPN account is registered without setting 'trusted for delegation' property. Account must be trusted for delegation in order for Kerberos delegation to succeed. Here's a blog talking about your scenario, please
    refer to the link below:
    http://blogs.technet.com/b/umairkhan/archive/2013/10/19/the-distributed-views-do-not-get-created-in-configmgr-2012-sp1-because-of-the-login-issue.aspx
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • Query View name not saved in "Analysis Grid Properties" under Data Provider

    Hi BW World;)
    We are on BI 7.0
    I have created a BI workbook which contains a query view.
    However when we go into design mode and then "analysis grid properties" for this query view then "change data provider" it does not show the query view name but the query name. (we have saved the workbook)
    Is this the normal scenario?
    Surely should show the "query view name " and not the "query name" as confuses what data provider is being used?
    Is this a bug?
    Best
    Stevo.... Points of course... Thanks in advance.;)
    Edited by: bw4eva999 on Sep 10, 2009 4:40 PM     spelling

    Hi,
    You have created a workbook on top of a Query View which is again depends on a Query.Now the base for Query View is a Query.So the underlying Data Provider for a workbook is a Query.
    Hence when you go to Properties of grid->Change Data Provider,it shows the Query and the InfoCube,but not the Query View.
    So this is not a bug and this how its been designed.
    If you click for the Information of that workbook,it will show the Query and Info Provider,but not the query View.
    Though it looks like wierd,it is not a bug.
    Rgds,
    Murali

  • Error in query when adding prompts

    Hello Everyone,
    I have a simple query which is working just fine in query manager. Now, I need to narrow the query by adding two prompts. However, when I add a prompt, it will complain with an error saying:
    Incorrect Syntax Near pch1.itemcode...
    However, I am NOT using that table.. in fact, the query access an external table...
    I have read note 0000730960 SAP Business One does not identify variables in long queries, but this is not the case.
    I have reduced the query to just:
    select
         t0.airline_id as 'Airline'
    from     
         hostostmp..flights t0
    where
         t0.airline_id='[%0]'
    but it is still giving me the error...
    Even more, if I change the query for some actual real value, it will work. For instace, t0.airline_id='MP' it will work like a charm.
    I use prompts (up to 3 prompts) in many other querys with no problems...
    But this one, is a really wierd one. Support insists in reducing the query, based on the note, but this is simple a shot in the dark. They have no idea.
    So, any hint will certainly be apprecieted.
    Best regards,
    Leo

    Hi Leonardo,
    I'm afraid I don't think you can use prompts on external tables. Your other queries you mention, are the prompts on SBO tables or external tables?
    As you know, when a prompt is inserted in to a query, SBO generates a separate window that allows the user to enter values for any prompts. If SBO does not recognise the table as a system table then it cannot generate the prompt window and the query fails (..and you get that misleading error message).
    Kind Regards,
    Owen

  • Error executing a Oracle query when connection is fetched from Datasource

    Hi Folks,
    I am struggling with a rather wierd issue. The DBA of my application has exposed some function based view(not exactly sure what that means) which returns results like any query over a table. I am having a tough time consuming it in my java application. The name of the view is - `networknode_api.get_ftapp_networknode_hrchy` The SQL for it is(syntax might be a bit strange as there is actual word `table` in the query)
    view plaincopy to clipboardprint?
    Note: Text content in the code blocks is automatically word-wrapped
    01.SELECT * FROM table (networknode_api.get_ftapp_networknode_hrchy('19-Feb-2013'));
    SELECT * FROM table (networknode_api.get_ftapp_networknode_hrchy('19-Feb-2013'));
    The query returns a hierarchical result data, provided below is a sample output (ignore the ouput if the formatting is too werid)
    Parent_NODE | Child_NODE | NODE_DISPLAY_NAME | BEGIN_DATE | END_COB_DATE | LVL
    null | CCN | Connent Node | 01/20/2013 | 10/19/2013 | 1
    CCN | AVT | Avg Vol Turn | 01/20/2013 | 10/19/2013 | 2
    AVT | L:2 | L:2 | 01/20/2013 | 10/19/2013 | 3
    AVT | L:6 | L:6 | 01/20/2013 | 10/19/2013 | 3
    CCN | NUT | Nap Up Turn | 01/20/2013 | 10/19/2013 | 2
    I have the following method in my DAO -
    public List<NetworkNodeGroupDTO> fetchNetworkNodeHierarchy(Date cobDate) {
    try {
    InitialContext ic = new InitialContext();
    //DataSource ds1 = (DataSource) ic.lookup("jndiDsFlex");
    //Connection conn = ds1.getConnection();
    /* Using the RmiDataSource class for performance optimizations */
    weblogic.jdbc.common.internal.RmiDataSource ds = (weblogic.jdbc.common.internal.RmiDataSource) ic.lookup("jndiDsNex");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    boolean hasRows = stmt.execute("SELECT * FROM table (networknode_api.get_ftapp_networknode_hrchy('19-Feb-2013'))");
    rs = stmt.getResultSet();
    while(rs.next()) {
    System.out.println(rs.getString("parent_node"));
    System.out.println(rs.getString("child_node"));
    System.out.println(rs.getString("node_display_name"));
    stmt.close(); stmt = null;
    conn.close(); conn = null;
    } catch(Exception ex) {
    ex.printStackTrace();
    return null; // please ignore the return type for now
    Exception is thrown at line - stmt.execute(....)
    java.sql.SQLSyntaxErrorException: ORA-00904: : invalid identifier
    I debugged through the code and noted the driver and connection details that the connection object has embedded. Using that I wrote a sample java jdbc code-
    public static void main(String[] args) throws Exception {
    try {
    //Class.forName("oracle.jdbc.driver.OracleDriver");
    //Class.forName("weblogic.jdbc.rmi.Driver");
    Driver myDriver = (Driver) Class.forName("weblogic.jdbc.jts.Driver").newInstance();
    } catch (ClassNotFoundException e) {
    System.out.println("Where is your Oracle JDBC Driver?");
    e.printStackTrace();
    return;
    Connection connection = null;
    try {
    connection = DriverManager.getConnection(
    "jdbc:oracle:thin:@//ssn20331020-rt.eu.prog.net:1522/NEXSERV",
    "sample",
    "sample1234");
    } catch (SQLException e) {
    System.out.println("Connection Failed! Check output console");
    e.printStackTrace();
    return;
    Statement stmt = connection.createStatement();
    stmt.execute("SELECT * FROM table (flex_compnode_api.get_ftapp_compnode_hrchy('19-Feb-2013'))");
    ResultSet rs = stmt.getResultSet();
    int i = 0;
    while(rs.next()) {
    String pNode = rs.getString("parent_node");
    String cNode = rs.getString("child_node");
    String dName = rs.getString("node_display_name");
    System.out.println("Hello: "+i++);
    The above code works perfectly fine. Also tried the above code using normal Oracle JDBC driver and too works fine. I am baffled; what goes wrong when using the connection from a DataSource object. Does the driver treat SQL statements differently based on how the connection object is obtained? Appreciate your inputs/comments for same.
    The oracle db version is - Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    Application Server - Weblogic 10.3

    Below is the stacktrace and the driver details which are same for both the standalone basic Jdbc program and one where connection is fetched through datasource.
    Driver name: Oracle JDBC driver
    Driver version : 11.2.0.2.0
    Driver major ver: 11
    Driver minor ver: 2
    java.sql.SQLSyntaxErrorException: ORA-00904: : invalid identifier
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
    at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:852)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
    at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1890)
    at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1855)
    at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:304)
    at weblogic.jdbc.wrapper.Statement.execute(Statement.java:458)
    at com.rfs.gs.ggl.nex.persistence.jpa.FlagDao.fetchCompositeNodeHierarchy(FlagDao.java:258)
    at com.rfs.gs.ggl.nex.service.mars.GSServiceBean.searchCompositeNode(GSServiceBean.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:69)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
    at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:55)
    at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy119.searchCompositeNode(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:73)
    at $Proxy92.searchCompositeNode(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:101)
    at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:83)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:152)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:264)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at weblogic.wsee.jaxws.tubeline.FlowControlTube$FlowControlAwareTube.processRequest(FlowControlTube.java:148)
    at weblogic.wsee.jaxws.tubeline.FlowControlTube.processRequest(FlowControlTube.java:99)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:604)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:563)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:548)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:445)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:275)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:454)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:250)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:140)
    at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:319)
    at weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:232)
    at weblogic.wsee.jaxws.JAXWSServlet.doPost(JAXWSServlet.java:310)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at weblogic.wsee.jaxws.JAXWSServlet.service(JAXWSServlet.java:87)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3594)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    <Timestamp Fri Feb 22 11:41:19 EST 2013 (1361551279781)>

  • Why would white space and line breaks in sql query increase runtime

    Using 11.2.0.3.0 on unix sprac server, 8 cpus 32 cores 12TB storage. We have 16 batch servers doing inserts and ~100 users doing mostly queries.
    We have a wierd issue,  we have a long query that takes 30 seconds to run 1st time then 10-20 secs every other time. Based on knowledge of DB we expected it to take a lot less.  Then a developer reformatted it by taking removing extra white space and line breaks.  all of sudden query takes 6 secs first time and 0.8 every other time.  we tripled checked to ensure they are identical and that only difference is white space and line breaks.  We tried it with SQLDeveloper, TOAD, SQLPLUS, from out desktops, appserver. we could reproduce it every time, with white space 10-20 secs without it 0.8 secs.  Query is 200 lines long with white space 30 without it.
    Why would having white space make such a dramatic difference?  because the query is longer eventhough its identical?  We checked parsing times, etc, no difference.  Is there some network setting, oracle parameter, sqlnet setting?  We spent hours looking on google and found nother
    Slow:
      SELECT grt_student.student_id                                                                                                                                                                                                 
    AS student_id,
      grt_student.last_name                                                                                                                                                                                                       
    AS last_name,
      grt_student.first_name                                                                                                                                                                                                      
    AS first_name,
      grt_buyerinstance.buyerinstance_id                                                                                                                                                                                            
    AS buyerinstance_id,
      grt_buyerinstance.buyerfamily_id                                                                                                                                                                                              
    AS buyerfamily_id,
      grt_buyer.buyerfamily_acronym                                                                                                                                                                                                 
    AS buyerfamily_acronym,
      grt_reporting_utls_pkg.convert_gmrt_battery(grt_buyerinstance.buyerfamily_id,grt_buyer.battery)                                                                                                                                
    AS battery,
    fast:
    SELECT grt_student.student_id 
    AS student_id,  grt_student.last_name
    AS last_name, grt_student.first_name   AS first_name,  grt_buyerinstance.buyerinstance_id   AS buyerinstance_id,  grt_buyerinstance.buyerfamily_id
    AS buyerfamily_id,
      grt_buyer.buyerfamily_acronym  AS buyerfamily_acronym,  grt_reporting_utls_pkg.convert_gmrt_battery(grt_buyerinstance.buyerfamily_id,grt_buyer.battery)   AS battery,

    Do you have some sort of horrific network connection between the client and the database such that it would take 8.5 seconds to transmit a few kb of SQL to the server?  That seems most unlikely.
    How are you determining the query plan?  Are you absolutely sure that both SQL statements have the same plan_hash_value when they are actually executed (not just when you generate a query plan without executing it)?  What are the differences in wait events when you execute the two?
    The sql_id will change when you add or remove whitespace.  There are various methods of modifying query plans that are tied to a sql_id.  My wager would be that you have a profile/ outline/ etc. that is not there for the reformatted one which is causing a query plan difference.  My next guess is that you have an accepted plan for the old statement, you haven't set up a process to let the plan evolve, and the reformatted statement starts with the plan that the old statement would get if you allowed the plan to evolve.
    Justin

  • Syntax error in insert query

    I have a flash form that is used to inserts a record into an
    Access database table. In the for there are 4 datefields, several
    text input fields, and several select fields. When I submit the
    form, I get a syntax error that reads:
    Executing Database Query. [Macromedia][SequeLink JDBC
    Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]
    Syntax error in INSERT INTO statement.
    The error occurred on line 184. Complex object types cannot
    be converted to simple values.
    Line 184 is the last line of the Values in the insert query.
    The query looks like this:
    <CFQUERY DATASOURCE="#REQUEST.DataSource#">
    INSERT INTO EstimateNumber(
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    Updated,
    ReviewDate,
    ReviewedBy,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    #FORM.SafetyChecklistDate#,
    #FORM.QCChecklist#,
    '#FORM.QCChecklistDate#',
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    #FORM.Updated#,
    #FORM.ReviewDate#,
    #FORM.ReviewedBy#,
    #FORM.Discipline#,
    #FORM.BidDate#,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    </CFQUERY>
    Any recomendations?

    Date/Time in Access provide some pretty strage hurdles. In
    many occassions I have simply changed the field to a Text field and
    ran with that and never seemed to have problems with the result. I
    didn't like doing it but I never received errors. I have been
    receiving some parameter errors with <cfqueryparam> like the
    database doesn't recognized the preceding declared field in the
    update or insert query. Here is an example of a wierd error with
    Access. I have 2 tables. One is for estimate numbers and the other
    is for sub estimate numbers that can be assigned to specific
    estimate numbers. If is actually a complicated explanation about
    what is taking place behind the doors on this. The concept is
    simple on the surface. Both tables have the same fields except the
    subestimate table has 1 extra for a user defined subestimate
    number. The only relation between the two will be the estimate
    number. This insert works fine.
    INSERT INTO EstimateNumber(
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    ReviewDate,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    <cfqueryparam
    value="#FORM.SafetyChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.QCChecklist#,
    <cfqueryparam
    value="#FORM.QCChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    <cfqueryparam
    value="#FORM.ReviewDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.Discipline#,
    <cfqueryparam
    value="#FORM.BidDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    This next one is the same exact query with the same table
    setup with one added field but kicks back a parmeter error
    expecting 4. I can't explain it.
    INSERT INTO SubEstimate(SubBidNumber,
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    ReviewDate,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(#FORM.SubBidNumber#,
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    <cfqueryparam
    value="#FORM.SafetyChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.QCChecklist#,
    <cfqueryparam
    value="#FORM.QCChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    <cfqueryparam
    value="#FORM.ReviewDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.Discipline#,
    <cfqueryparam
    value="#FORM.BidDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    IF I get rid of the cfqueryparam fields it works. If I simply
    remove the param, I get a Syntax error. Needless to say I commented
    this query for the sake of sanity for the time being.

  • Bex Query calc key figures in Crystal report not showing technical names.

    Hi,
    I have created calculated key figures in a BEx query for which the data comes from a SAP BW cube. I have assigned each of the calculated key figures a proper technical name which I expect to see when I bring it to crystal report. When I bring that query in Crystal as a data source the calculated key figures show a wier network id names instead of the technical names. I am having a problem in using those wierd technical name in my report and my formula's as I am not able to identify what is what.
    Please urgent help requested.
    Thanks
    Mahendra

    I dont have an account on such website. I will explain u the problem in detail.
    When I create a calculate key figure in SAP BEx query designer I assigned a technical name to it, a meaningful one. In my case one such example is Actual_revenue is the name that i have assigned and the description is Actual revenue. When I create a crystal report from it and in that report if i create a formula.
    I get this {ZIC_COPA_Z_SALES.[Measures]-[25V1KYL4VE92X0T4OMHVYM90V]}
    If u see it its a wier 25 digit name.
    Instead of this I want to see
    {ZIC_COPA_Z_SALES.[Measures]-[ACTUAL_REVENUE]} which is what I have given in the query. I am using the SAP BW MDX driver to connect to Bex query.

  • Oracle Report Server wierd problem

    Hi All,
    I am facing very wierd problem with oracle report server.
    I am using Oracle Report Server 10g R1. The problem I am facing is as under:
    There is custom parameter form where user enters report filter criteria and press a button to create the report.
    The problem is that report is giving output some times and sometimes it gives no output at all. Both the times, the parameters passed by user are same. The report executions are done for both runs one after other. We have tried to look in report server trace file but could not find anything. When report server fails to give any data in the report, at the same time, we have tried to execute the report query on SQL prompt and it did return data.
    Can any one give any hint where the problem could be ?
    Thanks,
    Ramchandra Jetwani

    Hi,
    When i used to get only one page the options like facing, continuous facing are disabled. And displays only single page.
    These options are enabled only when there are multiple pages in pdf.
    One more thing i found that it happens when I first view the report as pdf it displays
    all the pages, then i change the display format to csv and again when i change
    the format to pdf the problem starts.
    And when I will restart the report server service, it works fine again until i wont view it in CSV format.
    Message was edited by:
    Yogesh

  • Run-Time Errors cause wierdness

    I have a remote object call that sends a query string to a
    database. I am trying to catch errors coming from the database
    because of bad sql statements. In my code there is an IF statements
    that checks if the first row returned is an object by trying to
    convert it to a string. If it is not equal to "[object Object]"
    then I know its an error message generated from the database. My
    problem is as soon as I uncomment the IF statement and test my app
    everything begins acting wierd as soon as my app hits that logic.
    Items highlight, tree controls show junk, etc. If I comment out the
    IF everything works fine but I get a alert for rows returned and
    one with the error message. I tried enclosing everything in a try
    catch but there seems to be no run-time error occuring. Has anybody
    else experience wierd things when errors occur?
    private function queryResults(event:ResultEvent):void
    var call:Object = event.token;
    var isError:Boolean = false;
    if( call.state == "FillGrid" )
    results = event.result as ArrayCollection;
    if( results.length == 1 )
    var errMsg:String = results.getItemAt(0).toString();
    //if( errMsg != "[object Object]" )
    Alert.show(errMsg,"Error");
    //isError = true;
    if( !isError)
    results.filterFunction = searchData;
    Alert.show( results.length.toString() + " Rows Returned!
    ","Results");
    SortColumns();
    if( results.length > 0 )
    calculateGrandTotals(results);

    I have adjusted some of the logic in my code and now it works
    fine. I would still like to know what was causing the wierd stuff.
    private function queryResults(event:ResultEvent):void
    var call:Object = event.token;
    var isError:Boolean = false;
    var msg:String = "";
    var msgHeader:String = "Results";
    if( call.state == "FillGrid" )
    var tmpResults:ArrayCollection = event.result as
    ArrayCollection;
    msg = tmpResults.length.toString() + " Rows Returned! ";
    if( tmpResults.length == 1 )
    var errMsg:String = tmpResults.getItemAt(0).toString();
    if( errMsg != "[object Object]" )
    msg = errMsg;
    msgHeader = "Error";
    isError = true;
    Alert.show( msg,msgHeader);
    if( isError == false )
    results = tmpResults;
    results.filterFunction = searchData;
    SortColumns();
    if( results.length > 0 )
    calculateGrandTotals(results);
    }

  • Date calculation In query

    I am doing a date difference calculation on two date characteristics, i am doing this at the query level. For each date characteristics i have created a formula variable. I have then created a CKF and i have used these formula variable in that CKF to get the date difference. I am getting the date difference correctly if there are dates in both the Date 1 and Date 2 characteristics, But if either one of the date field is blank i am getting wierd value.
    Date1-------   Date2 -
         Difference
    9/20/2008----   9/15/2008----      5
    #Blank--   9/15/2008--      -733,301
    #Blank--   9/12/2008--      -733,298
    I know this problem can be sorted by writing a ABAP routine in the update rule, but i dont want that solution as i want these CKF to be created by the users.
    Points will be awarded.

    Hi RAO,
    I used your logic and it is working for the blank values but it is giving me a wrong result for the condition in which i have both the dates.
    Condition 1
    9/25/2008 - 9/12/2008 = -13
    It should be 13.
    Condition 2
    Blank - 9/12/2008 = 0
    I want the result for this to be blank.

  • Chart is not showing in Web Query

    Hi,
    I tried to display the query in web. The table was showing fine with all the information.
    However, when I clicked the graph tab for showing the information in chart, the chart is not showing and I got an error message saying 'Chart "GR2Chart": Data Provider does not contain any data'
    Do you think I need to create the chart first using Web Application Designer?
    Thanks a lot for your help.

    Hi all,
    Thanks a lot for the answers. Unfortunately, the problem can't be solved yet.
    I have asked the BASIS to check IGS Service, and it has been installed and has been restarted too but it didn't help.
    Regarding the web application designer, we don't need to create the web layout on web application designer right? You can publish the query automatically from web publish button on query designer. Only workbooks that we need to create the web layout on web application designer.
    It's just wierd that the table is showing the data but on the chart, it's saying there is no data.
    Thanks for your help by the way.

  • EstimatedRowCount on a query table

    Hi,
    I have a search page and am supposed to show the total number of rows of the result on the top or bottom of the table.
    My table is surrounded with a panelcollection, and in the tool bar of the panel collection, I placed an output text and value is given as #{bindings.VO1.estimatedRowCount} (tried bindings.VO1Iterator.estimatedRowCount as well).
    Initially its working fine. but when I navigate to a different page and again come back to the search page, then it is not showing correct row count. (I guess it is showing the total row count of my vo query without applying any view criteria i.e even though my result table has only 54 records, it show 1108 as row count.)
    But when I click on any row in the table then again it is changing to correct number (54).
    This behaviour seems wierd.
    Plz let me know what is the correct way of showing total number of rows in search result as a header or footer of the table.

    Hi Jobinesh
    1. I am using Rollback because the second page is a transaction page and any uncommitted data should be removed.
    2. If its problem with rollback, table data is coming correctly only..only the count is shown wrong. And also, after I just select on any record in the table, its again showing correct value.
    3. Anyway to rule it out as you said, I removed the rollback and tried as well. but no change in behaviour.
    4. Is there any other way of achieving the same instead of using these unreliable rowCount methods.
    I am thinking in terms of creating some client methods in AMImpl or VOImpl and use them to show the count.
    But again it should be invoked whenever search / reset is executed or page is rendered.
    Please let me know ur ideas.

  • Wierd behaviour in 10.2.0.2

    Hi Guys,
    I have this wierd behaviour.
    I have the parameter *.sessions=885 in my spfile.
    However few days back when i do a query in my db "show parameter sessions", the output is 1105.
    can advise?
    thanks

    SESSIONS doesn't have to be explicitly set, most DBAs would only set PROCESSES and let Oracle auto-compute SESSIONS.
    Since SESSIONS is not modifiable in memory, it is likely that it was modified when the instance was running with
    ALTER SYSTEM SET SESSIONS=885 SCOPE=SPFILE;which would have updated the SPFILE but not changed the value for the instance currently running.
    Go through your alert.log to see if any ALTER SYSTEM has been issued since the database instance was started up.
    Hemant K Chitale

Maybe you are looking for

  • No MIGO for PO

    Hi Gurus, I have created a PO and released it.. now when i am doing MIGO.... the systems says the PO has no items... plz guide me whats the reason for this... cheers

  • Verizon has failed me and I will no longer be a customer.

    I wanted to order a prepaid phone. So I did. I couldn't place an order with a separate shipping address than billing address. This is bad for me, because my credit card is linked to my home address, buty I live at university right now. I chatted onli

  • Acrobat Reader X and PDDocSave

    I am developing a plugin for Acrobat X and Reader X. Both plugins use the same code to perform a Save As operation. I use the active pdf on screen and save it as a new pdf with a different name using PDDocSave. This works fine for Acrobat, but I get

  • Appearing and Missing Text

    Hello. I bought the following template from template monster: I then outsourced it to a professional to set it up according to my wishes: I had everything replaced and added some of my own ideas like sound and video. Please visit the site here: http:

  • WiFi connectivity to LG LCD TV (model 32LD550)

    I have recently purchased a web enabled LCD Television that I am trying to hook up to my airport extreme. I have purchased the correct "dongle" from LG to allow it to sync up to my wireless network, but am having a hard time gaining access. I find my