Simple Query : Unable to execute

Hi ALL,
I need wnat to extract records from a table where its ID records doesnt match with other Tbale ID values..
TABLEA
ID,NAME
1,A
2,B
TABLEB
ID,AGE
1,60
Now in SQL I can write query as
select TABLEA.ID from TABLEA,TABLEB where TABLEA.ID<>TABLEB.ID
and I can get out as
ID
2
How can I get this in DS??? I am struggleing.. may be its simple ....can any one throw some light?
Thanks
Rajeev

Sorry, I misread your issue and thought you wanted the records where the IDs DID match.
Ok, I know of two options, both quite simple, and both require two steps (two queries):
Option 1) Outer join Tables A and B in a query, with Table A as outer table and B as inner, with join condition A.ID=B.ID.  Then map across the fields you want for your target plus the ID from table B, but rename it on the output schema as 'ID_B'.  Now because this is an outer join the result will be all records from table A with the ID_B value being populated if there was a matching ID in Table B, and if not then it will be NULL. So then link this query output to a second query and just use the filter WHERE ID_B IS NULL (and you don't need to map the ID_B column to the output as you don't need it anymore).  So the second query's output is all the records from Table A that did not have a matching ID in Table B.
If your volume of data is high then I only recommend this option if both tables are in the same datastore (i.e. if the outer join can be pushed down to the database).
Option 2) In the first query link only Table A as the source, then map across all the columns from table A and then create a new function output column called 'ID_B' with a lookup or lookup_ext function which simply performs a lookup of the Table A ID in table B, returning the ID from table B if the lookup finds a match, otherwise NULL.  Then similarly in a second query you filter the records where ID_B value IS NULL (i.e. the lookup DID NOT find a match).
This option is probably going to perform better for high data volumes because Table B can be cached if it can fit into available memory, as you probably know you can choose from different caching options in the lookup function. The default option should be fine unless Table B is huge and your memory is low - check the reference guide.

Similar Messages

  • SharePoint 2010 Unable to execute query: Error 0x80131530

    I am seeing the below error message in the ULS logs while accessing some set of items in the list and the item will not get
    opened after long tim. 
    "Unable to execute query: Error 0x80131530
    Unknown SPRequest error occurred. More information: 0x80131530
    System.Web.HttpException: Request timed out."
    This list has 202 items in total with 45 columns in total (includes
    5 lookup columns, 3 append history columns). 
    Items which has more than 20 versions is not loading.
    In the same site, there is another list of the same template with 2009 items and some items with more
    than 80 versions works fine.
    Please let me know if you have any suggestion to fix this.

    Yes there are 2 simple SPD workflows. One of the workflow operation is to send email and other one is to create an item in another based on condition.
    The other list which works fine also has similar SPD workflows. 

  • HELP on simple query

    I am trying to run kodo under Tomcat. In order for the user to login I do a simple query:
    PersistenceManager pm = pmf.getPersistenceManager ();
    KodoQuery q = (KodoQuery) pm.newQuery (UserInfo.class, "username == u_name && password == p_word");
    q.setUnique(true);
    q.declareParameters("String u_name, String p_word");
    UserInfo u = (UserInfo) q.execute(u_name, p_word);
    pm.close ();
    if (u == null)
    return (0);
    else
    return (1);
    I get the following exception:
    Unable to execute a query on type "class com.login.UserInfo". This class or interface is not persistent, and does not have any persistent implementors.
    I can run a JDOQL query using the same class from the kodoworkbench and it works fine. What am I missing?

    I am trying to run kodo under Tomcat. In order for the user to login I do a simple query:
    PersistenceManager pm = pmf.getPersistenceManager ();
    KodoQuery q = (KodoQuery) pm.newQuery (UserInfo.class, "username == u_name && password == p_word");
    q.setUnique(true);
    q.declareParameters("String u_name, String p_word");
    UserInfo u = (UserInfo) q.execute(u_name, p_word);
    pm.close ();
    if (u == null)
    return (0);
    else
    return (1);
    I get the following exception:
    Unable to execute a query on type "class com.login.UserInfo". This class or interface is not persistent, and does not have any persistent implementors.
    I can run a JDOQL query using the same class from the kodoworkbench and it works fine. What am I missing?

  • Error while checking in a document: Unable to execute service

    Hi,
    I am using oracle UCM 11g. When i am checking in a document, i am getting error as "Unable to execute service CHECKIN_NEW_SUB and function validateCheckinData."
    In stacktrace found this is caused by:
    "Unable to find query or idc data source with 'DdeletedRows'. "
    How to resolve this?
    Thanks in advance

    Please refer to this thread ...may be u get ur answer out of it...........................
    Error while checking in and storing: C:\ ..... (Message no. 26253)
    regards,
    Tushar Dave

  • Error in the simple Query

    Dear Experts,
    Not able to Execute this simple query :
    Select T1.JobID , T1.BudgetValue,T1.ActualValue FROM [dbo].[Enprise_JobCost_ActualBudgetView] T1 WHERE T1.TransType = '[%0]'
    Regards

    Hello,
    View - A View in simple terms is a subset of a 'virtual table. It can be used to retrieve data from the tables, Insert, Update or Delete from the tables. The Results of using View are not permanently  stored in the database.
    Stored Procedure -  A stored procedure is a group of SQL statements which can be stored into the database and can be shared over the netwrok with different users.
    http://www.geekinterview.com/question_details/65914
    Better make a UDT for your requirement.
    Thanks
    Manvendra Singh Niranjan

  • Class Cast Exception on Simple query

    Hi,
    I am getting the following exception on a very simple code
    When I execute the query on sql tool it gives me one result.
    PersonEntity obj = (PersonEntity)em.createNativeQuery("Select * from person where person_id = ''90").
    getSingleResult();
    java.lang.ClassCastException: org.eclipse.persistence.internal.helper.NonSynchronizedVector cannot be cast to com.entitites.Person
    Also I have the following two warnings in my logs
    WARNING: Found unrecognized persistence provider "org.eclipse.persistence.jpa.PersistenceProvider" in place of OpenJPA provider. This provider's properties will not be used.
    WARNING: Found unrecognized persistence provider "org.eclipse.persistence.jpa.PersistenceProvider" in place of OpenJPA provider. This provider's properties will not be used.
    Any ides?
    A.B

    Hello,
    createNativeQuery is a native SQL query which will return the raw data from the database, not the Entity. You can use createNativeQuery("Select * from person where person_id = ''90", PersonEntity.class) to return managed PersonEntity objects, or just use JPQL queries such as createQuery("Select p from PersonEntity p where p.persion_id = 90");
    As for the warnings; I have been told its caused by OpenJPA being used internally by Weblogic and that there is a bug filed for it, but I don't have the number for it. I believe they can be ignored if the entityManager you are getting in your application is from EclipseLink (em.getDelegate() should return an EclipseLink EntityManagerImpl).
    Best Regards,
    Chris

  • Simple query optimization

    Hi,
    I'm using Oracle 10g r2.
    I have this simple query that seems to take too much time to execute :
    DECLARE
         nb_mesures INTEGER;
         min_day DATE;
         max_day DATE;
    BEGIN
         SELECT
              COUNT(meas_id),
              MIN(meas_day),
              MAX(meas_day)
         INTO
              nb_mesures,
              min_day,
              max_day
         FROM
              geodetic_measurements gm
              INNER JOIN
              operation_measurements om
              ON gm.meas_id = om.ogm_meas_id
         WHERE ogm_op_id = 0;
         htp.p(nb_mesures||' measurements from '||min_day||' to '||max_day);
    END;- Tables (about 11.000 records for the "Operations" table, and 800.000 for the 2 others) :
    "Operation_measurements" is the table who makes the link between the 2 others (get the 2 keys).
    SQL> DESCRIBE OPERATIONS
    Nom                  NULL     Type
    OP_ID                NOT NULL NUMBER(7)
    OP_PARENT_OP_ID               NUMBER(7)
    OP_RESPONSIBLE       NOT NULL VARCHAR2(10)
    OP_DESCRIPT                   VARCHAR2(80)
    OP_VEDA_NAME         NOT NULL VARCHAR2(10)
    OP_BEGIN             NOT NULL DATE
    OP_END                        DATE
    OP_INSERT_DATE                DATE
    OP_LAST_UPDATE                DATE
    OP_INSERT_BY                  VARCHAR2(50)
    OP_UPDATE_BY                  VARCHAR2(50)
    SQL> DESCRIBE OPERATION_MEASUREMENTS
    Nom                  NULL     Type
    OGM_MEAS_ID          NOT NULL NUMBER(7)
    OGM_OP_ID            NOT NULL NUMBER(6)
    OGM_INSERT_DATE               DATE
    OGM_LAST_UPDATE               DATE
    OGM_INSERT_BY                 VARCHAR2(50)
    OGM_UPDATE_BY                 VARCHAR2(50)
    SQL> DESCRIBE GEODETIC_MEASUREMENTS
    Nom                  NULL     Type
    MEAS_ID              NOT NULL NUMBER(7)
    MEAS_TYPE            NOT NULL VARCHAR2(2)
    MEAS_TEAM            NOT NULL VARCHAR2(10)
    MEAS_DAY             NOT NULL DATE
    MEAS_OBJ_ID          NOT NULL NUMBER(6)
    MEAS_STATUS                   VARCHAR2(1)
    MEAS_COMMENT                  VARCHAR2(150)
    MEAS_DIRECTION                VARCHAR2(1)
    MEAS_DIST_MODE                VARCHAR2(2)
    MEAS_SPAT_ID         NOT NULL NUMBER(7)
    MEAS_INST_ID                  NUMBER(7)
    MEAS_DECALAGE                 NUMBER(8,5)
    MEAS_INST_HEIGHT              NUMBER(8,5)
    MEAS_READING         NOT NULL NUMBER(11,5)
    MEAS_CORRECT_READING          NUMBER(11,5)
    MEAS_HUMID_TEMP               NUMBER(4,1)
    MEAS_DRY_TEMP                 NUMBER(4,1)
    MEAS_PRESSURE                 NUMBER(4)
    MEAS_HUMIDITY                 NUMBER(2)
    MEAS_CONSTANT                 NUMBER(8,5)
    MEAS_ROLE                     VARCHAR2(1)
    MEAS_INSERT_DATE              DATE
    MEAS_LAST_UPDATE              DATE
    MEAS_INSERT_BY                VARCHAR2(50)
    MEAS_UPDATE_BY                VARCHAR2(50)
    MEAS_TILT_MODE                VARCHAR2(4000) - Explain plan (I'm not familiar with explain plans...) :
    | Id  | Operation                     | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT              |                        |     1 |    19 |   256  (10)| 00:00:02 |
    |   1 |  SORT AGGREGATE               |                        |     1 |    19 |            |          |
    |   2 |   NESTED LOOPS                |                        |    75 |  1425 |   256  (10)| 00:00:02 |
    |*  3 |    TABLE ACCESS FULL          | OPERATION_MEASUREMENTS |    75 |   600 |    90  (27)| 00:00:01 |
    |   4 |    TABLE ACCESS BY INDEX ROWID| GEODETIC_MEASUREMENTS  |     1 |    11 |     3   (0)| 00:00:01 |
    |*  5 |     INDEX UNIQUE SCAN         | MEAS_PK_2              |     1 |       |     2  (50)| 00:00:01 |
    --------------------------------------------------------------------------------------------------------How can I optimize this query ?
    Thanks.
    Yann.

    Looks like you are missing an FK-index on the middle table, for the FK going to OPERATIONS.
    Currently this:
    WHERE ogm_op_id = 0;Is computed via a full table scan followed by a filter operation. Assuming OP_ID is rather selective, an index on OGM_OP_ID could do the trick here.

  • Simple query takes time to run

    Hi,
    I have a simple query whcih takes about 20 mins to run.. here is the TKPROF forit:
      SELECT
        SY2.QBAC0,
        sum(decode(SALES_ORDER.SDCRCD,'USD', SALES_ORDER.SDAEXP,'CAD', SALES_ORDER.SDAEXP /1.0452))
      FROM
        JDE.F5542SY2  SY2,
        JDE.F42119  SALES_ORDER,
        JDE.F0116  SHIP_TO,
        JDE.F5542SY1  SY1,
       JDE.F4101  PRODUCT_INFO
    WHERE
        ( SHIP_TO.ALAN8=SALES_ORDER.SDSHAN  )
        AND  ( SY1.QANRAC=SY2.QBNRAC and SY1.QAOTCD=SY2.QBOTCD  )
        AND  ( PRODUCT_INFO.IMITM=SALES_ORDER.SDITM  )
        AND  ( SY2.QBSHAN=SALES_ORDER.SDSHAN  )
        AND  ( SALES_ORDER.SDLNTY NOT IN ('H ','HC','I ')  )
        AND  ( PRODUCT_INFO.IMSRP1 Not In ('   ','000','689')  )
        AND  ( SALES_ORDER.SDDCTO IN  ('CO','CR','SA','SF','SG','SP','SM','SO','SL','SR')  )
        AND  (
        ( SY1.QACTR=SHIP_TO.ALCTR  )
        AND  ( PRODUCT_INFO.IMSRP1=SY1.QASRP1  )
      GROUP BY
      SY2.QBAC0
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.07       0.07          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       10     92.40     929.16     798689     838484          0         131
    total       12     92.48     929.24     798689     838484          0         131
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 62 
    Rows     Row Source Operation
        131  SORT GROUP BY
    3535506   HASH JOIN 
    4026100    HASH JOIN 
        922     TABLE ACCESS FULL OBJ#(187309)
    3454198     HASH JOIN 
      80065      INDEX FAST FULL SCAN OBJ#(30492) (object id 30492)
    3489670      HASH JOIN 
      65192       INDEX FAST FULL SCAN OBJ#(30457) (object id 30457)
    3489936       PARTITION RANGE ALL PARTITION: 1 9
    3489936        TABLE ACCESS FULL OBJ#(30530) PARTITION: 1 9
      97152    TABLE ACCESS FULL OBJ#(187308)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.07       0.07          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           0
    Fetch       10     92.40     929.16     798689     838484          0         131
    total       13     92.48     929.24     798689     838484          0         131
    Misses in library cache during parse: 1kindly suggest how to resolve this...
    OS is windows and its 9i DB...
    Thanks

    > ... you want to get rid of the IN statements.
    They prevent Oracle from usering the index.
    SQL> create table mytable (id,num,description)
      2  as
      3   select level
      4        , case level
      5          when 0 then 0
      6          when 1 then 1
      7          else 2
      8          end
      9        , 'description ' || to_char(level)
    10     from dual
    11  connect by level <= 10000
    12  /
    Table created.
    SQL> create index i1 on mytable(num)
      2  /
    Index created.
    SQL> exec dbms_stats.gather_table_stats(user,'mytable')
    PL/SQL procedure successfully completed.
    SQL> set autotrace on explain
    SQL> select id
      2       , num
      3       , description
      4    from mytable
      5   where num in (0,1)
      6  /
                                        ID                                    NUM DESCRIPTION
                                         1                                      1 description 1
    1 row selected.
    Execution Plan
    Plan hash value: 2172953059
    | Id  | Operation                    | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |         |  5001 |   112K|     2   (0)| 00:00:01 |
    |   1 |  INLIST ITERATOR             |         |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| MYTABLE |  5001 |   112K|     2   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN | I1      |  5001 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("NUM"=0 OR "NUM"=1)Regards,
    Rob.

  • Unable to execute service SS_GET_PAGE and function getRssFeedForUrl.in ucm

    When i update rss feed information i am unable to update the rss logo getting the below error
    Unable to execute service SS_GET_PAGE and function getRssFeedForUrl.
    $ucmapp41: !csUserEventMessage,anonymous,portalcmd1.bb.wan:8055!csFileServiceUserAgent,Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.2; MS-RTC LM 8; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),GET!csServiceDataException,SS_GET_PAGE,getRssFeedForUrl!$!csSystemError,www.google.com!syExceptionType2,intradoc.data.DataException,www.google.com!syExceptionType2,java.net.UnknownHostException,www.google.com
    intradoc.common.ServiceException: !csServiceDataException,SS_GET_PAGE,getRssFeedForUrl!$!csSystemError,www.google.com
         at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:1760)
         at intradoc.server.Service.buildServiceException(Service.java:1997)
         at intradoc.server.Service.createServiceExceptionEx(Service.java:1991)
         at intradoc.server.Service.createServiceException(Service.java:1986)
         at intradoc.server.ServiceRequestImplementor.handleActionException(ServiceRequestImplementor.java:1460)
         at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1427)
         at intradoc.server.Service.doAction(Service.java:452)
         at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1201)
         at intradoc.server.Service.doActions(Service.java:447)
         at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1071)
         at intradoc.server.Service.executeSubServiceCode(Service.java:3568)
         at intradoc.server.ServiceRequestImplementor.executeServiceEx(ServiceRequestImplementor.java:942)
         at intradoc.server.Service.executeServiceEx(Service.java:3563)
         at intradoc.server.ServiceRequestImplementor.executeSafeServiceInNewContext(ServiceRequestImplementor.java:973)
         at intradoc.server.Service.executeSafeServiceInNewContext(Service.java:3558)
         at intradoc.server.script.ServiceScriptExtensions.evaluateFunction(ServiceScriptExtensions.java:259)
         at intradoc.common.DynamicHtmlMerger.computeFunction(DynamicHtmlMerger.java:1209)
         at intradoc.common.DynamicHtmlMerger.evaluateGrammarElement(DynamicHtmlMerger.java:825)
         at intradoc.common.DynamicHtmlMerger.substituteVariable(DynamicHtmlMerger.java:597)
         at intradoc.common.DynamicHtml.substituteVariable(DynamicHtml.java:1244)
         at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:986)
         at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1006)
         at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1050)
         at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1086)
         at intradoc.common.DynamicHtml.outputHtml(DynamicHtml.java:906)
         at intradoc.common.DynamicHtmlMerger.executeDynamicHtmlToWriter(DynamicHtmlMerger.java:1818)
         at intradoc.common.DynamicHtmlMerger.evaluateScriptToWriter(DynamicHtmlMerger.java:1645)
         at intradoc.common.DynamicHtmlMerger.evaluateScriptNoErrorHandling(DynamicHtmlMerger.java:1615)
         at intradoc.common.DynamicHtmlMerger.evaluateScriptEx(DynamicHtmlMerger.java:1573)
         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:592)
         at sitestudio.SSClassHelper.invokeRaw(Unknown Source)
         at sitestudio.SSClassHelper.invoke(Unknown Source)
         at sitestudio.SSScriptExtensions.evaluateIncludeXmlEx(Unknown Source)
         at sitestudio.SSWCMScriptExtensions.evaluateTemplate(Unknown Source)
         at sitestudio.SSWCMScriptExtensions.getPlaceholderContent(Unknown Source)
         at sitestudio.SSWCMScriptExtensions.evaluateFunction(Unknown Source)
         at intradoc.common.DynamicHtmlMerger.computeFunction(DynamicHtmlMerger.java:1209)
         at intradoc.common.DynamicHtmlMerger.evaluateGrammarElement(DynamicHtmlMerger.java:825)
         at intradoc.common.DynamicHtmlMerger.substituteVariable(DynamicHtmlMerger.java:597)
         at intradoc.common.DynamicHtml.substituteVariable(DynamicHtml.java:1244)
         at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:986)
         at intradoc.common.DynamicHtml.outputHtml(DynamicHtml.java:906)
         at intradoc.common.DynamicHtmlMerger.outputDynamicHtmlPage(DynamicHtmlMerger.java:1769)
         at intradoc.server.Service.buildResponsePage(Service.java:1199)
         at intradoc.server.Service.doResponse(Service.java:1868)
         at intradoc.server.FileService.doResponse(FileService.java:1412)
         at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:664)
         at intradoc.server.Service.doRequest(Service.java:1707)
         at intradoc.server.ServiceManager.processCommand(ServiceManager.java:359)
         at intradoc.server.IdcServerThread.run(IdcServerThread.java:197)
    Caused by: intradoc.data.DataException: www.google.com
         at rssfeeds.RssHelper.getXmlHttpContentsAsString(Unknown Source)
         at rssfeeds.RssServiceHandler.getRssFeedForUrl(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:592)
         at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
         at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:293)
         at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
         at intradoc.server.Service.doCodeEx(Service.java:490)
         at intradoc.server.Service.doCode(Service.java:472)
         at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
         ... 47 more
    Caused by: java.net.UnknownHostException: www.google.com
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
         at java.net.Socket.connect(Socket.java:524)
         at java.net.Socket.connect(Socket.java:474)
         at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
         at sun.net.www.http.HttpClient.&#60;init&#62;(HttpClient.java:231)
         at sun.net.www.http.HttpClient.New(HttpClient.java:304)
         at sun.net.www.http.HttpClient.New(HttpClient.java:321)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:839)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:791)
         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:716)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:960)
         ... 59 more
    Any help is required
    Thanks
    Sravani

    Hi Ryan,
    Thanks for your reply.
    Yes, I checked in the configuration manager and the DB (Logged into the DB and ran a query on Users) as well.
    I can see the column name dPassword.
    Thanks

  • Trouble with a simple Query

    Hello, I'll start by saying that I am a noob. Anyways, I am trying to do what I thought would be a simple query to get records that are greater than or equal to the current date: this is my query...
    <cfquery name="getUpcoming" datasource="events">
    SELECT title, eventDate FROM event WHERE eventDate >= #Now()# ORDER BY eventDate ASC
    </cfquery>
    It works, sort of, I do get records that are greater than the current date, but any records that are equal to do not show up.
    I am assuming that it is looking at time as well, or I am doing it completely wrong. I don't know? Any help would be greatly appreciated.

    I didn't use the cfqueryparam as suggested, is there something dangerous about doing it this way?
    Nothing dangerous, no.  Just "less than ideal" (in a sloppy / lazy sort of way).  As I suggested, one should not hard-code dynamic values into the SQL string, one should pass them as parameters.  it's just "the way it should be done".
    When the DB receives your SQL string (with the dynamic values hard-coded), the DB engine needs to compile the SQL to make an execution plan before executing the query.  Any change to the SQL string requires recompilation.  However if you pass your parameter as parameters, then the SQL does not need to be recompiled.
    It's the same sort of thing as not using global variables unless one has to, despite the fact they're "easier", or duplicating code instead of refactoring code.  One should try to write decent code.
    Adam

  • Query to be executed at Syn JDBC Receiver

    Dear Freinds,
    I am facing with this issue, i am passing a Native SQL Query as string from Syn Proxy to Syn JDBC with a key field as place holder.
    As per my understanding place holder field should have the same as the once used in Native SQL Query. In the query its prefixed & suffixed with $. Correct ?
    Also in the action field i have put SQL_QUERY correct ?
    I am passing a Select Query (join query). In the query i have same conversion functions for date manipulations which comes within ' ' (single quotes). This quotes changes to &apos;
    What could be the problem. In the Communication channel under Processing tab in SQL Syntax parameters (Escape symbol for apostrophe) what should be given ?
    Based on the execution of the Select query some fields are fetcehd from Oracle table. This will be response message from JDBC to Proxy.
    But i am getting error as '' Invalid SQL stmt" . What could be the problem. How to rectify.
    Please give me soultion for the above questions.
    Thanks & Regards
    K.Ramesh

    Dear Friends,
    I have done the same thing. We r using PI 7.1.
    I have Sync Proxy ->  Syn JDBC . I tried to execute a simple query at the JDBC adapter by sending it through *access*  field in the XML structure.
    This is the input
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:CoilNoReceive xmlns:ns0="urn:essar-com:production:shearslitpoconfirm">
    - <stmt>
    - <TABLENAME action="SQL_QUERY">
      <access>SELECT coil_no,PARTS_ACT FROM P_INV where fac_index <> 6 and fac_index <>7 and rownum<5</access>
      </TABLENAME>
      </stmt>
      </ns0:CoilNoReceive>
    I am getting this error msg..
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIAdapterFramework</SAP:Category>
      <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error 'java.sql.SQLException: ORA-00900: invalid SQL statement ' executing service raw2sql with SQL statement '<?xml version="1.0" encoding="UTF-8"?> <ns0:CoilNoReceive xmlns:ns0="urn:essar-com:production:shearslitpoconfirm"><stmt><TABLENAME action="SQL_QUERY"><access>SELECT coil_no,PARTS_ACT FROM P_INV where fac_index <> 6 and fac_index<>7 and rownum<5</access></TABLENAME></stmt></ns0:CoilNoReceive>'</SAP:AdditionalText>
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    What could be the problem. Reply ASAP.
    Thanks
    K. Ramesh

  • Simple query -- tuning

    Hi gurus,
    I have a very simple query
    Select * from emp
    where deptno = 10
    if this query has been executed on 10,000 records .. time taken is little bit slow .. but whereas it has been executed on 10,00,000 records .. its taking lot hell of time..
    the client is complaining about the time tacking .. I really do wonder, how can I tune this query .. Please help
    Regards

    Hi guys,
    I really appreciate from the bottom of my heart, for putting and taking lot of pains, in answering my question .. Well, that question has been asked in an interview .. I dont know whether its a real problem faced by him or his client ..
    He has asked, me, I have given the query "select * from emp where deptno = 10" .. and there is already an index associated with the query that too on deptno .. when it has been tested on a very huge database consisting of 10,00,000 my client has asked me to tune the query .. how can i achieve that ..
    Like some of you people, i have tried, in giving different answers, but he wasnt satisified .. so thought of asking or sharing with you, so that, I can get some different answer ..
    One of the gurus has been asking me .. whether are they same tables of EMP and DEPT which we normally use (dummy tables )... Yes , they are the same tables ..
    Now any suggestions please
    Regards

  • Unable to execute update commands after improper shutdown

    Hi!
    It sounds a little strange.
    I am unable to execute update commands from my application. My machine was shutdown improperly. Then I loaded the datastores again. I was able to execute select commands but unable to execute update commands. It was working fine before shutdown.
    Regards
    /Ahmad

    Hi Chris!
    SQLExecute method of ODBC is returning -1.
    I have checked the syntax of the query its also correct. I am also very confused on it why is this happening. If I execute the update command from ttisql it works ok.
    The code is the same that we discussed in our previous conversation.
    The steps I did after improper shutdown:
    1. Started TimeTen daemon >ttdaemonadmin -start
    2. Loaded the Data store >ttAdmin -ramLoad spiderM
    3. Executed the code
    The output of ttstatus is as follows:
    TimesTen status report as of Fri Jun 29 21:45:41 2007
    Daemon pid 8273 port 17001 instance tt70
    TimesTen server pid 8284 started on port 17003
    TimesTen webserver pid 8280 started on port 17005
    Data store /tmp/spiderM
    There are 6 connections to the data store
    Data store is in shared mode
    Shared Memory KEY 0x08004f3c ID 557070
    Type PID Context Connection Name ConnID
    Subdaemon 8278 0x0000000000570520 Worker 2042
    Subdaemon 8278 0x00000000005dc4d0 Flusher 2043
    Subdaemon 8278 0x000000000060d5d0 Checkpoint 2044
    Subdaemon 8278 0x000000000063e5a0 Aging 2045
    Subdaemon 8278 0x000000000066f570 HistGC 2046
    Subdaemon 8278 0x00000000006a0430 Monitor 2047
    RAM residence policy: Manual
    Data store is manually loaded into RAM
    Replication policy : Manual
    Cache agent policy : Manual
    Data store /usr/users/spider/TimesTen/tt70/info/TT_tt70
    There are no connections to the data store
    Replication policy : Manual
    Cache agent policy : Manual
    Access control enabled.
    End of report
    Regards
    /Ahmad

  • Unable to execute a remote proc

    Hi I am unable to execute a remote procedure from forms6i, and that procedure runs coolly form sql plus console. I just dont get any exception or error. Thats really pathetic for me now.
    I need help.
    thanx Rajeev

    Hi ,
    Remote procedure means the procedure in database. My database is in solaris, d2k on win2k and other database on win2k. I am executing a remote procedure on solaris Oracle db to poll data from win2k db using forms, i.e. on button click. The form user and the solaris db users are same. I am using dblink here.
    Hope this helps in clarifying my query further.
    thanx

  • Que about Simple Query Dump.....

    Hiiii ABAPers....
    Here with i am come again with a que and my que is :
    " While debugging a simple query with where clause i am getting dump...but when i set up a break point after 2 or 3 sentenses it is executed fine without any dump "
    It has shocked me.... and i m thinking about it by my hand on my head that hows it possible.....
    Anyone can help me to put my hand down from the head???
    Warm regards,
    Nirav Parekh....

    HI Nirav
    I think you are placing break point in <b>select & end-select</b>
    In between select and end-select , if you place any break point ,then there commit statement will trigger,
    thats may be the reason ,
      so mostly the Programmers are advised to not place any Break points in between Select & end-select.
    In your case just place the breakpoint after End-select
    or before select
    Regards Rk
    Message was edited by:
            Rk Pasupuleti

Maybe you are looking for

  • Invoice List Output

    Hello Friends, I am having issue with Invoice list output, when I  print my invoice it prints the shipping  quantity of material only as only ONE even when there is a multiple quantity, I want my invoice list output to print exact amount of quantity.

  • Problem installing Adobe Flash Player

    The problem I am facing is that I cannot install the newer version of adobe flash player. My current Adobe Flash Player - Version is: 12.0.0.70 and I am working on Windows 7-64bit. After I download the install file from the official site (http://get.

  • How to create a page break in application designer

    Hi Folks, I need to create a simple page break in a PeopleSoft online page for the purpose controlling how the page prints. To achieve this, I'm using an HTML area in app designer with the following page break code: <p style="page-break-after:always;

  • Using a function in multiple scenes

    I have a .fla project being created under CS4, using ActionScript 3.0, that consists of multiple scenes. In the code attached to the first scene, I define some functions that are used as methods on buttons: function MouseDown(TheKey:Object):void TheK

  • How to make sure Bridge Mode is OFF on my new TC

    When I go into Airport Utility for my New TC, Network, Router Mode the choice is OFF(Bridge Mode). Does this mean the Bridge Mode is off?