SQL statement difference?

I have just upgraded an Access database to MSSQL and all of
the data was
transferred successfully to the correct tables etc.
So far so good..
However, the pages that run from the Access db have sql
statements to only
show various fields for certain advertisements. This works
fine, see here -
http://www.fuerteventura.com/Furnishing/index.asp
The pages that run from the MSSQL db have the same sql
statements but for
some reason don't show all of the data??
See here -
http://www.fuerteventura.com/Furnishing/index2.asp
I have tried just creating a simple page to display all data
and this works
fine, so I'm guessing there's something I need to change in
the SQL
statements
for the MSSQL database pages. As this is my very first bash
at a mssql db
I'm pretty much in the dark.
Can anyone help?
Here's 2 jpgs of each sql statement -
Access -
http://www.fuerteventura.com/access.jpg
mssql -
http://www.fuerteventura.com/mssql.jpg
Thanks for any help
Gary Woodward

Great!
Thanks vey much!
Works fine now. Thank God for this forum..
Gary
"Lionstone" <[email protected]> wrote in
message
news:[email protected]...
> Make sure there are no other BLOB-type fields (text,
ntext, image,
> varbinary) in your table.
> All of these go to the end of the SELECT list, and if
there is more than
> one, arrange them in the order they're defined.
>
> If you still have problems, post DDL from the table (in
Query Analyzer,
> right click on the table and choose "script to new
window as Create") and
> the query you use.
>
>
> "woodywyatt" <[email protected]> wrote
in message
> news:[email protected]...
>> Hi
>> The tables have been changed from "text" to
"varchar" in the conversion
>> I tried the listing idea anyway, but got the same
results.
>> Confused..
>>
>>
>> "Lionstone" <[email protected]>
wrote in message
>> news:[email protected]...
>>> If you incorrectly chose "text" instead of
"varchar" for your text data,
>>> then you must abandon SELECT * and list every
field you want to select,
>>> making sure to place all "text" type fields at
the end of the list in
>>> the order they're defined in your table.
>>>
>>>
>>> "woodywyatt"
<[email protected]> wrote in message
>>> news:[email protected]...
>>>>I have just upgraded an Access database to
MSSQL and all of the data was
>>>>transferred successfully to the correct
tables etc.
>>>> So far so good..
>>>> However, the pages that run from the Access
db have sql statements to
>>>> only show various fields for certain
advertisements. This works fine,
>>>> see here -
>>>>
http://www.fuerteventura.com/Furnishing/index.asp
>>>> The pages that run from the MSSQL db have
the same sql statements but
>>>> for some reason don't show all of the data??
>>>> See here -
http://www.fuerteventura.com/Furnishing/index2.asp
>>>>
>>>> I have tried just creating a simple page to
display all data and this
>>>> works fine, so I'm guessing there's
something I need to change in the
>>>> SQL statements
>>>> for the MSSQL database pages. As this is my
very first bash at a mssql
>>>> db I'm pretty much in the dark.
>>>> Can anyone help?
>>>> Here's 2 jpgs of each sql statement -
>>>> Access -
http://www.fuerteventura.com/access.jpg
>>>> mssql -
http://www.fuerteventura.com/mssql.jpg
>>>>
>>>> Thanks for any help
>>>> Gary Woodward
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Similar Messages

  • Getting difference from values of two different SQL Statements

    Hello,
    I have two SQL Queries like the following:
    1. Statement:
    SELECT name, SUM(a1), SUM(b1),SUM(c1),SUM(d1)
    FROM table 1, table 2
    WHERE ...
    GROUP BY name
    2. Statement:
    SELECT name, SUM(a2), SUM(b2),SUM(c2),SUM(d2)
    FROM table 3, table 4
    WHERE ...
    GROUP BY name
    I need now a combination of these SQL Statements in one Statement where the result should be the following records
    name, a1-a2 as a, b1-b2 as b, c1-c2 as c, d1-d2 as d
    Name is a VARCHAR and in both queries the values of the field name are the same
    all other fields are integer.
    I hope someone can help me.
    Regards

    You can use this
    with t1 as (
              SELECT name, SUM(a1) as a1, SUM(b1) as b1,SUM(c1) as c1,SUM(d1) as d1
              FROM table 1, table 2
              WHERE ...
              GROUP BY name
         ), t2 as (
              SELECT name, SUM(a2) as a2, SUM(b2) as b2,SUM(c2) as c2,SUM(d2) as d2
              FROM table 3, table 4
              WHERE ...
              GROUP BY name     
         ), tt as (
              select name
              from t1
              union
              select name
              from t2
    select *
    from tt
         natural left outer join t1
         natural left outer join t2
    where a1 <> a2
         or b1 <> b2
         or c1 <> c2
         or d1 <> d2Bye Alessandro

  • SQLException: Closed Connection, SQL state [null]; error code [17002]

    Hello All,
    I am supporting a Java 5 project on Tomcat. We've used Spring and Stored Procedure in the project.
    Recently we deployed our application in a GoLive environment and have started seeing Timeout errors in log files. After around two days we also have to restart Tomcat as users are no more able to login to access the application.
    Same application runs fine without any timeout issues on another environment.
    The only difference between two environments is that the Go-Live env has a firewall between Tomcat and Database and the other environment hosts both Tomcat and Database on same machine (i.e. no firewall).
    For GoLive env the only port open on firewall for JDBC connection is 1521 and is used in the connection string url for obtaining the connections.
    When there is a Timeout error, the N/w admin guy observed that the JDBC connection was not attempted on 1521 port, but on some random port which is not open on firewall, due to which the Database server logs also do not show entry for this connection attempt as it gets blocked by the firewall.
    I am not sure why a randam port should be used to connect when a specific port is mentioned in the connection url? Also what can be making this port switching?
    Application uses Apache DBCP with Spring to obtain connections.
    Has anyone experienced similar errors?
    Any suggestions/help on this issue is greatly appreciated!
    Many Thanks,
    CD
    ===============================
    Error Log Extract:
    Error while extracting database product name - falling back to empty error codes
    org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Closed Connection
    java.sql.SQLException: Closed Connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.driver.PhysicalConnection.getMetaData(PhysicalConnection.java:1605)
    at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:247)
    at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:247)
    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getMetaData(PoolingDataSource.java:231)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:172)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:207)
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:187)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:126)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.java:92)
    at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:96)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:294)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:348)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:352)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:356)
    at com.o2.morse.dao.impl.sql.UserDaoImpl.batchLoad(UserDaoImpl.java:371)
    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:585)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
    at $Proxy3.batchLoad(Unknown Source)
    at com.o2.morse.domain.User.doHousekeeping(User.java:667)
    at com.o2.morse.domain.User$$FastClassByCGLIB$$372ff70b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.domain.User$$EnhancerByCGLIB$$d5ac966a.doHousekeeping(<generated>)
    at com.o2.morse.scheduler.EndOfDay.run(EndOfDay.java:63)
    at com.o2.morse.scheduler.EndOfDay$$FastClassByCGLIB$$3b2d4927.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.scheduler.EndOfDay$$EnhancerByCGLIB$$488a9f86.run(<generated>)
    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:585)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Could not close JDBC Connection
    java.sql.SQLException: Already closed.
    at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:77)
    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:180)
    at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:286)
    at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:247)
    at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCleanupAfterCompletion(DataSourceTransactionManager.java:297)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:754)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:615)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:560)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.doCloseTransactionAfterThrowing(TransactionAspectSupport.java:284)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
    at $Proxy3.batchLoad(Unknown Source)
    at com.o2.morse.domain.User.doHousekeeping(User.java:667)
    at com.o2.morse.domain.User$$FastClassByCGLIB$$372ff70b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.domain.User$$EnhancerByCGLIB$$d5ac966a.doHousekeeping(<generated>)
    at com.o2.morse.scheduler.EndOfDay.run(EndOfDay.java:63)
    at com.o2.morse.scheduler.EndOfDay$$FastClassByCGLIB$$3b2d4927.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.scheduler.EndOfDay$$EnhancerByCGLIB$$488a9f86.run(<generated>)
    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:585)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Application exception overridden by rollback exception
    org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [SELECT ID_USER_DETAILS, USERNAME, CREATED_ON, LAST_LOGIN FROM USER_DETAILS  WHERE STATUS = 157 AND SUPERUSER <> 'Y']; SQL state [null]; error code [17002] ; Io exception: Connection timed out; nested exception is java.sql.SQLException: Io exception: Connection timed out
    java.sql.SQLException: Io exception: Connection timed out
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
    at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:820)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
    at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:845)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1313)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
    at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:333)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:282)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:348)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:352)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:356)
    at com.o2.morse.dao.impl.sql.UserDaoImpl.batchLoad(UserDaoImpl.java:371)
    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:585)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
    at $Proxy3.batchLoad(Unknown Source)
    at com.o2.morse.domain.User.doHousekeeping(User.java:667)
    at com.o2.morse.domain.User$$FastClassByCGLIB$$372ff70b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.domain.User$$EnhancerByCGLIB$$d5ac966a.doHousekeeping(<generated>)
    at com.o2.morse.scheduler.EndOfDay.run(EndOfDay.java:63)
    at com.o2.morse.scheduler.EndOfDay$$FastClassByCGLIB$$3b2d4927.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.scheduler.EndOfDay$$EnhancerByCGLIB$$488a9f86.run(<generated>)
    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:585)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Batch Job Failed: org.springframework.transaction.TransactionSystemException: Could not roll back JDBC transaction; nested exception is java.sql.SQLException: Closed Connection

    I am using latest Jrockit 16)5, ojdbc6_g.jar,spring.jar Weblogic 10.3 and Oracle 10G 10.2.4 .. whatever but always get "Closed Connection"
    java.lang.Throwable: Closed Connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:750)
    at oracle.jdbc.OracleConnectionWrapper.createStatement(OracleConnectionWrapper.java:183)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7053)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

  • Using a number variable in an SQL statement

    Hi,
    I am trying to use a variable in an sql statement and I have run into problems when the variable is a number. The following line of code works if the variable is a string but not if it is a number.
    "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WHERE UnitID =  '" + Locals.LocalUnitID + "' ORDER BY START_DATE_TIME DESC"
    Is there a difference in the use of the single and double quotes and the + sign for number variables?
    Thanks
    Stuart
    Solved!
    Go to Solution.

    Hi Stuart,
    I am assuming that the UnitID is stored as a numeric in the database? If so, the proper SQL syntax for comparing with numerics should not use a single quote (or any quotes for that matter). The quotes are used only for strings.
    So you would want to use:
    "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WHERE UnitID =  " + Locals.LocalUnitID + " ORDER BY START_DATE_TIME DESC"
    This is really more of an SQL question universal to all languages, not just TestStand.
    Here is an excellent resource that you can consult:
    http://www.w3schools.com/sql/sql_where.asp
    Jervin Justin
    NI TestStand Product Manager

  • Oracle Date in SQL Statement.

    Hello,
        We are having performance issues with some reports using conditions on date fields in the Record Selection Formula. Our application does not use the time portion of the date fields very often. When Crystal Reports builds the SQL statement to Oracle it uses a range condition to include all the possible time values. This practice makes a big difference compared to a direct condition
         Example:   SELECT "TABLE_A"."ID"
                           FROM   "TABLE_A"
                           WHERE  ("TABLE_A"."DT">= TO_DATE('2011-03-31 00:00:00','YYYY-MM-DD HH24:MI:SS') AND
                                          "TABLE_A"."DT"< TO_DATE('2011-04-01 00:00:00','YYYY-MM-DD HH24:MI:SS'))
         Is there a way to tell Crystal not to perform range validation on dates?
         We would like to have a SQL Statment that looks like:
                           SELECT "TABLE_A"."ID"
                           FROM   "TABLE_A"
                           WHERE  ("TABLE_A"."DT" = TO_DATE('2011-03-31'))
        We are on Oracle 11 with Crystal Report for VS2010 Sp1.
    Thank you.
    Charles

    Have a look at the kbase below. I think this is a throwback to the fact that we can't handle the milliseconds in the DateTime. So, in order to ensure we get the correct data we search on a range plus one second of what you asked for.
    [1217417 - SQL query shows '&lt;' for a DateTime field filter although '&lt;=' was selected |http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313337333433313337%7D.do]

  • Using cursor function in sql statement

    hi all
    can anyone plss explain why and when we will use cursor function in a sql statement like this and what is the difference while executing this sql statement with cursor function in comparison of a simple sql statement----
    select
    department_name,
    cursor (
    select last_name
    from employees e
    where e.department_id = d.department_id
    order by last_name
    ) the_employees
    from departments d
    thnx in advance

    RTFM
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1452
    Cheers
    Sarma.

  • Use variable in SQL statement

    HI guys:
    I need code three SQL statements.the returned field and selected table are all same,there is only a difference in their "where" statement.
      Sample code:
        select marcmatnr marcwerks
        into table it_data
        from MARC inner join MBEW on marcmatnr = mbewmatnr
        where marcmatnr like 'A%' and mbewzplp1 = '001'.
        second one........................ mbew~zplp2 = '001'
        third one......................... mbew~zplp3 = '001'
      Could I write a FORM gather them with transporting a parameter ZPLPX to determine which condiniton will be execute?
    thank you very much.

    Hi tianli,
    1. source text
       This concept of dynamic where
       condition is called source text.
    2. use like this.
       This is important in the code  --->  WHERE (mywhere).
    REPORT abc LINE-SIZE 80.
    DATA : it_data LIKE TABLE OF mara WITH HEADER LINE.
    QUOTES ARE IMPORTANT
    PERFORM mysql USING 'mbew~zplp2 = ''001'''.
    FORM mysql USING mywhere.
      SELECT marcmatnr marcwerks
      INTO TABLE it_data
      FROM marc INNER JOIN mbew ON marcmatnr = mbewmatnr
      WHERE (mywhere).
    ENDFORM.                    "mysql
    regards,
    amit m.

  • Hardcode value in sql statement

    Hi,
    This may be a simple thing which I'm missing.
    I'm trying to hardcode numeric value in my SQL statement
    '1.0000' AS NUMBER (10,4) - It returns value as 1 instead of 1.0000
    '1.1255' AS NUMBER(10,4) - returns 1.1255
    I need my o/p to be as 1.0000 not as 1.Is there anyway I can get the result as I'm looking for
    Thanks in advance

    Hi,
    847750 wrote:
    Hi,
    This may be a simple thing which I'm missing.
    I'm trying to hardcode numeric value in my SQL statement
    '1.0000' AS NUMBER (10,4) - It returns value as 1 instead of 1.0000
    '1.1255' AS NUMBER(10,4) - returns 1.1255
    I need my o/p to be as 1.0000 not as 1.Is there anyway I can get the result as I'm looking for
    Thanks in advance
    It's hard to tell what you really want to do from such a tiny code fragment.
    Whenever you have a question, post a complete test script that people can run to re-create the problem and test their ideas.
    The value 1 is exactly the same as the value 1.0000; there is no difference between those numbers.
    If you want to display a number in a certain format (e.g. '1.0000' instead of '1'), the front end is probably the best place to do that.
    If you're using SQL*Plus as the front end, you can set the display for the column called increase_pct like this:
    COLUMN  increase_pct  FORMAT 990.0000
    This will make it display the numbers in that column with at least 1 digit to the left of the decimal point, and exactly 4 digits to the right of the decimal point.
    Other front end tools have similar features.
    If you need to do the equivalent in SQL, use the TO_CHAR function, like this
    SELECT  ename
    ,       TO_CHAR (sal, '99999.00')   AS salary
    FROM    scott.emp
    If you really are hard-coding literals, you can hard code a string, such as '1.0000'.  Don't CAST it to a NUMBER..

  • Converting SQL statements from MS server 2000 to Oracle 10g

    We are moving over from MS server 2000 to Oracle 10g as our database for Peoplesoft system.
    There are several embedded SQL statements that I need to investigate to see what needs converting.
    So far I can see a need to convert the following:
    Dates.     GetDate() to ?
    Outer joins. *= to LEFT OUTER JOIN
    Has anyone else done a similar exercise and what other functions do I need to convert?
    Thanks.

    Hello
    A quick google search (http://www.google.co.uk/search?hl=en&q=ms+sql+server+oracle+differences&spell=1)
    came up with this:
    http://dba-oracle.com/oracle_news/2005_12_16_sql_syntax_differences.htm
    There's a quite a few more sites listed.
    HTH
    David

  • How to call SQL statements in InDesign CS6?

    Hi,
         My plug-in needs to interact with the database, and update the database content, how should I do, can I call SQL statements in InDesign CS6?
         Thanku very much.

    The same way you'd call them from any C++ program. You don't mention which platform, and that probably makes a difference.
    I'm accessing an SQL database in InDesign CS6 on Windows. I'm using the ODBC interface to SQL database that Windows provides, via the nanodbc wrapper. So I'm linking to odbc32.lib and odbccp32.lib, and including the nanodbc.cpp and nanodbc.h files. (See http://lexicalunit.github.io/nanodbc/ )
    Paul.

  • Tkprof : 0  user  SQL statement in trace file

    Hello!
    Please explain , what is difference of tkprof-converting of user session trace file and an internal/background process ?
    Get I message "0 user SQL statement in trace file" cause this difference?
    In my target session I issued :
    begin
    sys.dbms_system.set_ev(...., .., 10046, 12, '');
    end;
    begin
    sys.dbms_system.set_ev(..., .., 10053, 1, '');
    end;
    /Thanks and regards,
    Pavel

    Did you try to tkprof a 10053 trace ?
    That is not going to show anything. 10053 traces are meant to be read as they are. tkprof is there to deal with 10046 traces.

  • Sql statements in v$sqlarea

    Hi
    When I get the sqls from v$sqlarea, does these sqls already executed, or currently runnıng?

    I suggest you check the Oracle Document,
    While showing similar content, you might also note there are difference between V$SQLAREA and V$SQL view
    V$SQL
    V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.
    V$SQLAREA
    V$SQLAREA lists statistics on shared SQL area and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution.

  • OO4O & VC++ Access Violation with large sql statement

    Using Oracle C++ Class Library OO4O for Oracle9i Version 9.0.1.4.3 for
    Windows 98/NT/2000/XP.
    Open a dynaset with a large sql statemant more then 1000 chars you get
    a Access Violation, like below.
    szSQL = "select..."
    ores = oDyn.Open( odb, szSQL, ODYNASET_READONLY || ODYNASET_NOCACHE);
    The same sql query works without any problem in SQL Plus. A simple SQL statement works fine using OO4O.
    Any ideas?

    I am using Jboss 2.44 with tomcat3.2.3, and I get deployment problems when using jdk1.5, I also tried JBoss 4 but I also have lots of problems with that.
    I have this huge system developed long time ago. I have problems with printing in jdk1.3 so upgrade to 1.4 or higher will fix the printing. Upgrading to jdk1.5 and JBoss 4 will need lots of rewrite which is not an option.
    So to me it seems easier if I keep using jboss2.44 and tomcat 3.2.3 but just upgrade to JDK 1.4. All off this is just because jdk1.3.1 has printing bugs.
    Bushwack, I am ding exactly like you are, the only difference is, ResultSet.CONCUR_UPDATABLE and I used , ResultSet.CONCUR_READONLY. But I tried and still the same error.
    I will try using a new JDBC driver, hope it works, I am just struggling to find a free one

  • OO4O & VC++ Access Violation with large sql statement  - REPOST

    This is a repost - my email address was incorrect on the previous message
    OO4O & VC++ Access Violation with large sql statement
    Using Oracle C++ Class Library OO4O for Oracle9i Version 9.0.1.4.3 for
    Windows 98/NT/2000/XP.
    Open a dynaset with a large sql statemant more then 1000 chars you get
    a Access Violation, like below.
    szSQL = "select..."
    ores = oDyn.Open( odb, szSQL, ODYNASET_READONLY || ODYNASET_NOCACHE);
    The same sql query works without any problem in SQL Plus. A simple SQL statement works fine using OO4O.
    Any ideas?
    [email protected]

    I am using Jboss 2.44 with tomcat3.2.3, and I get deployment problems when using jdk1.5, I also tried JBoss 4 but I also have lots of problems with that.
    I have this huge system developed long time ago. I have problems with printing in jdk1.3 so upgrade to 1.4 or higher will fix the printing. Upgrading to jdk1.5 and JBoss 4 will need lots of rewrite which is not an option.
    So to me it seems easier if I keep using jboss2.44 and tomcat 3.2.3 but just upgrade to JDK 1.4. All off this is just because jdk1.3.1 has printing bugs.
    Bushwack, I am ding exactly like you are, the only difference is, ResultSet.CONCUR_UPDATABLE and I used , ResultSet.CONCUR_READONLY. But I tried and still the same error.
    I will try using a new JDBC driver, hope it works, I am just struggling to find a free one

  • Maximum SQL statement on ODBC 8176 or higher ?

    Hello.
    I am developing a DB reporting program using ODBC.
    My customer complained that the program shut down when query the SQL statement.
    But, my computer didn't shut down when I queried the same SQL statement.
    The difference is my customer used 8177 ODBC driver, but my computer installed 8176 driver, so I changed ODBC driver 8176 to 8177 and the problem appeared too.
    I debugged and I found that the program shut down at SQLPrepare API.
    The size of the SQL statement is 8238 bytes.
    I tested and I found that the program shut down when the SQL statement size was around 5900bytes or larger.
    I think, this is the Oracle ODBC drivers bug, does anybody meet the same problem?
    I noticed to my customer this situation and he tried to downgrade ODBC driver 8177 to 8176 but he failed.
    How can I solve this problem? I tried that the same SQL statement with OCI but it was no problem.

    I've never encountered a situation where the ODBC driver improperly handled a statement that the Oracle database could, and I've seen cases where the ODBC driver was given statements longer than Oracle's maximum.
    My recollection is that Oracle itself doesn't support SQL statements longer than 8k (though I think it depends on the version of the database-- it may have been 4k in the past). If you want to generate SQL statements this long (and I'm not sure you do-- perhaps there are views, etc that you need to create to simplify your queries) you really ought to by using the DBMS_SQL package. You populate a table with 256 byte chunks of data and then call this package, so you can have infinitely long SQL statements.
    Justin

Maybe you are looking for

  • Find my phone not working with iOS 6.4.1 on iPhone 5 help ?

    I have just updated my iPhone 5 to ios6.1.4 and find my iPhone isn't working . It only works when I'm at home connected to wifi. I have a good 3G signal and it worked perfectly until the iOS update. Can I uninstall this update ?

  • Free Youview box for new BT infinity customers

    Does anyone know how to get the free youview box for new BT infinity customers?   Ordered new service on 12th Dec and called in later to check how/when I'll get the Youview box.  The CSR told me that I had to call after the broadband was installed to

  • How to restore a backup from time machine in 10.6.8

    I am running 10.6.8 on my MacPro (early 2008). I have 4 internal hard drives. The main boot drive has 10.6.8 and the secondary drive with a system has Lion. I cannot completely upgrade to Lion on my main drive until all my software is compatible. My

  • Final Cut Pro X Export Help...

    I have Final Cut Pro X 10.0.5 installed and I'm editing a video I made a while back; the RAW version I made was 700MB+ and the edited/exported version came out to 136MB (That I'm working on now) wants to be exorted as 441.4MB. I want to know how to g

  • AR Form is not opening........

    I instaled Mult-org set Up but while setting up of Receivables we find an error for opening a thre form of Payments term and all the other form of Receipts the error is showing that "FRM-40735:PRE-Form trigger-raised unhandled exception NO_DATA_FOUND