Query of queries to test for date null or empty

I have problems with this request (in a function). The last condition in where clause must verify if a blank date or no, then check against the current date (which is fine), im aware that the syntax is wrong, but asked if someone could fix it for me to make it work.

< name cfquery = "filterQuery" dbtype = "query" maxrows = "#arguments.top #" >
Select * from getAllSaved
where
workFlowStatusId = < cfqueryparam cfsqltype = "CF_SQL_INTEGER" value = "" #application.const.WORKFLOW_LIVE # "/ >"
and
dateArchive > < cfqueryparam cfsqltype = 'CF_SQL_DATE' value = "#now ()" # "/ >"
and
dateLive < = < cfqueryparam cfsqltype = 'CF_SQL_DATE' value = "#now ()" # "/ >"
and
(dateExpiry is null or dateExpiry = ") or dateExpiry > < cfqueryparam cfsqltype = 'CF_SQL_DATE' value =" #now () "#" / > "
< / cfquery >

I feel stupid, although I would put a Fiver on having tried!

Thank you

Tags: ColdFusion

Similar Questions

  • Test for a Null array

    How can I test to see if a variable that contains an array is null and terminate my report if it is null?

    For example:

    $vms = get - vm

    If $vms is null, terminate the report

    Hello, TheVMinator-

    Two ways for that: either test for $null using the comparison operator, "-eq":

    $vms = Get-VMif ($null -eq $vms) {<# stuff here to terminate #>}else {<# otherwise, do stuff here on VMs#>}
    

    Otherwise, just check that the variable contains anything at all, like:

    ## or, check for non-null, non-false valueif ($vms) {<# do stuff #>}else {<# terminate here #>}
    

    Enjoy.

  • test for the null value to IN request (null, 'a ', ' b', 'c')

    Hello

    Oracle 10.2.0.4

    I think the following query is incorrect, in my opinion. (there is an index on the collar, but NULL values are ignored?

    SELECT COUNT (*) < table > where col in (null, 'a ', ' b', 'c')

    It works (no errors) and forth fast enough.

    However, I think the correct query would

    SELECT COUNT (*) < table > where IS NULL or neck neck ('a', 'b', 'c')

    It takes a lot of time. As I see it, he performs a table scan for part of the value NULL and use the index for the rest, as the index cannot be used for NULL values.

    I would appreicate an explanation on this matter, particularly why Oracle accepts the first query "where col in (null, 'a ', ' b', 'c')" without any problem.

    Thank you

    A null value is not equal to what whatsoever, not even another null value. This is consistent with the definition of the ANSI. For your first request is not what you think it does, even if it is not syntactically incorrect.

    The second query is correct. If you want to use an index, you must create a bitmap index (which requires Enterprise Edition licenses), because they do not include the values NULL, unlike B * tree index.

  • How to test for the node XML empty?

    If (selectedImage.detail! = "")

    works with
    < picture detail = "" >
    < / image >

    but not

    < image >
    < detail > < / details >
    < / image >


    Hope that makes sense for a person, can't think really how to explain it better, I'm sure it's a fairly simple thing

    Quote:
    Posted by: ntsiii
    I did not understand. You try to search the nodes in detail where the text node is empty?
    Tracy

    Yes - for that I can't ignore explicitly their.

    Seems that all I had to do was if(!selectedImage.detail)

    Thanks for the reply - despite my not knowing how to phrase the question.

  • Query of queries on 2 data sources

    I'm doing a query of queries on 2 different data sources. I run a gaming site and have a 2 programs that are used for tracking. One is written in php, by someone else, following members point State. The other, I wrote it in CF, allows members to set priorities in Treasury. Both are independent on my server. What I'm trying to do is set up so that the program I wrote to FC shows the number of points, each Member has. I know how interrogate separate tables, but how do I combine them? In addition, how can I set up so that it only shows members that match. that is, I want to assure you that if John Smith has 100 points, the query will show John Smith 100 points on my table. Here is what the query looks like I did. As you can see, I'm confused about and WHERE statements. I played with him last night and could not make it work. Thank you.

    You can try the same correction/idea of what I posted in thread http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=1&catid=7

    Copied/Pasted from this thread:

    You can read through the first query and add content to a query to temp attributing some kind of field and then read through the second query and add same temp with a kind of field to the query. Then do a query of this temp query.

  • Impossible to test for null in JavaScript

    I want to check if the user has specified a value in a LOV. The element is a Select list that has been set as display Null = Yes, Null value = '- Select Organization -' and Null return value = null %. So by default the value is null %, which I assume what APEX actually cures as NULL, because when I go back to the attribute item, that nothing is displayed as the value. When I use FireBug to inspect the DOM when running, it shows that the value is "null %." The values in the page are processed when you click on a button that is set to have a URL target javascript:showReport();

    My JavaScript showReport() function contains:
      if ($v('P27_ORG_CODE_2') != '' || $v('P27_ORG_CODE_2') != "%null%")
      {
       l_param += '&p_org_code_b=' + $v('P27_ORG_CODE_2');
      }
    I found this variable l_param ends to top joins with & p_org_code_b = null % even if I test for the null %. It should not even at this point! How to test the value of string/NULL/%null% empty?

    Any help is appreciated.

    If this issue is closed, could you mark it as answered and awarded points accordingly, if others know we respond...

    Thank you

    Tony Miller
    Webster, TX

  • Query of queries

    I am having trouble with the query of queries in CF5. I have included my select statement in the attached code.

    I want to be able to do now is to select totals of the original with a query of queries request. For example, I need to know my total return compared to my new visitors total visitors (for the love of the query, a new visitor is a person whose FirstVisitDate statement date range the user specified [attributes.start to attributes.end] and a return visitor is someone whose FirstVisitDate does nto fall within the specified range.)

    I tried something like:
    < cfquery dbtype = "query" name = "GetNewHits" >
    Select Count (Visitor)
    Of QueryVisitors
    Where FirstVisit
    Between #attributes.start #.
    and #attributes.end #.
    < / cfquery >

    The above query (when he returned to all results) returns all records in the original request (for me, it seems that the FirstVisit field doesn't recognize as a date field). Can anyone offer any suggestions? Thank you

    -Daniel Casper

    I wish I had the choice to upgrade, but the company is not apparent from a local server and our Web host is 2 releases from behind. I think I found a way to implement without however using Q of Q.

    I put an increment conditional when the results are displayed, which checks the date against my range of user and then increments a variable newhit if it corresponds to the range, or increments a variable returnhit if it is not. Until now it works fine. If someone needs it, the increment of conditional is:



    Thank you all for your suggestions.

  • Testing for Null Var

    Hi all

    I have the code AS2 that proved for a 'null '.  A 'Lang' var was created. If the SWF file has been run to: Director, it would fill the "Lang" variable with the value of the Director. If she did not, I tested for it in an If statement.

    If (Lang == null) {}

    Lang = "en"; default language for test

    }

    In AS3, it seems that the command is identical to AS2.

    I even tried it.

    If ((Lang==null) |) (Lang == "")) {

    Lang = "en"; default language for test

    }

    What Miss me?

    Thank you

    Jim

    Lang is nothing and Lang == undefined can be combined into a single statement. Lang. If conditional may look like this:

    If (!.) Lang | Lang == ' ') {}

    Lang = "en"; default language for test

    }

    Or simply:

    Lang =! Lang | Lang == ""? "fr": Lang; "

  • Computed - columns column date test report to null

    Hi all

    We use the interactive reports on many Pages and our customers use a lot.

    In the dialog box 'calculation', we want to take a column and to test the value 'null', but it gives an error message.

    Example:

    E = hiredate

    in the expression of calculation, we tried "E is null" and gives the Error Message ' invalid calculation expression. is '

    How can I test a column to null value?


    Wolfgang

    A calculation to determine an output value. My guess is that you want to indicate somehow that this column E is zero?

    In your calculation, use something like

    DECODE(E,NULL,'It is null','It is not null')
    

    Or you can of course use any other such constructions of the DEAL, NVL, NVL2...

  • Query of queries: error when you try to fake Left Outer Join

    Hello

    I'm trying to reproduce a left outer join, combining two query of queries using a method I find here

    However, I get an error message...

    Here is the code I use...

    < cfquery dbtype = "query" name = "qry" >
    SELECT *.
    OF returnQry, returnQry2
    WHERE returnQry.mediumImage = returnQry2.mediumImage
    ORDER BY returnQry.name
    < / cfquery >

    < name cfquery = "returnQry3", dbtype = "#application.mx #" >
    SELECT *.
    OF trackmeanings t
    < / cfquery >

    < cfquery dbtype = "query" name = "endQry" >
    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE qry.name = returnQry3.sNameTrack

    UNION

    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE #qry.name # NOT IN (#QuotedValueList (returnQry3.sNameTrack) #)
    GROUP BY name, nameRcd, mediumImage
    < / cfquery >

    When I try to use the query output in a page, I get the error message "incorrect conditional expression, waiting for an a [as |]» null | between | in | "comparison condition.

    Anyone have any ideas?

    Thank you very much

    The items in the list should be cited.  Since you are using quotedvaluelist, it's weird that they aren't.  However, if you use cfqueryparam, list = Yes, you should have better luck.  Among other things, it will protect you against the apostrophe in names.

  • Error running query of queries

    Hello

    I am in the process of updating my site in CF5 to CF9 and I get a "query of query error" on the following code each time I have add the first point to my shopping cart. If I add a second element, the error disappears. Here are two pieces of keys to the code where I pull the item from the database information and then use the query requests to merge the query with the amount of shopping cart.

    <!-get-> Product Details

    < CFQUERY NAME='GetDetails'

    DATASOURCE = ' #request.ds # '

    Username = ' #request.dsuser # '

    PASSWORD = ' #request.dspass # ' >

    SELECT
    ItemNo,

    Agenda,

    Grades,

    Price,

    ImageSmall

    DE Products
    ItemNo IN (#QuotedValueList(GetCart.ItemNo) #)
    < / CFQUERY >

    <!-add the column "OrderQty"->

    < CFQUERY NAME="GetList" DBTYPE="query">

    SELECT
    GetDetails.ItemNo YOU ItemNo,

    GetDetails.Item point, AS

    GetDetails.Grades AS Grades,

    AS price, GetDetails.Price

    GetDetails.ImageSmall AS ImageSmall,

    GetCart.Quantity AS OrderQty

    DE GetDetails, GetCart
    GetDetails.ItemNo = GetCart.ItemNo
    < / CFQUERY >

    This is the error I get. The line number refers to the Q of Q above.

    Error running query of queries.

    Comparison = runtime exception.
    Comparison of Type incompatible Exception: on the left side and right side of the comparison operator "=" have incompatible types.
    Type of expression left side = "VARCHAR".
    Expression type side right hand = "DATE".

    I tried a lot of things affect a 'string' type to the right, but nothing seems to work.

    I would be very happy any help that I can get as I've spent countless hours trying to figure this.

    Thank you
    Steve

    Looks like the GetCart query is generated with functions to query coldfusion as opposed to a database query.  It also seems that the QueryNew function has the names of the fields, but not the types of data.  This means some trys to ColdFusion for the type of basic data on the first rows of data.

    Or it could be something else.

  • Can't find answer to a query of queries error

    Not only I saw this forum, but also google this problem, but the unfortunnately I have no chance to find the answer.

    I wrote this simple query:

    < cfquery name="test" dbtype="query">

    Select The SSN, date of birth de myquery where SSN <> '' OR Date of birth <>"

    < / cfquery >

    and I got this error:

    Error running query of queries.

    Exception of comparison when running <>.
    Unsupported Type comparison Exception: the <>operator does not support comparison between the following types:
    Type of expression left side = 'DOUBLE '.
    Expression type side right hand = "STRING".

    I tried the following and has not worked either, still got the same error.

    < cfquery name ="test" dbtype ="query">

    Select The SSN, date of birth de myquery

    NSS <> < cfqueryparam cfsqltype ="CF_SQL_VARCHAR" Value =""/ >

    OR Date of birth <> < cfqueryparam cfsqltype ="CF_SQL_VARCHAR" Value =""/ > < / cfquery >

    Ever met someone the same problem and know how to solve it?

    Select SSN, date of birth of myquery where cast (SSN to the varchar type) <> " OR cast (date of birth as varchar) <> "

  • Test for the day of the week, using javascript?

    Is it possible to test for what day of the week has been selected in a Date field using javascript?

    I have a script that checks if an option button 'Day' is checked and if so throws an error if the input time is not between 06:00 and 15:30. I need to change the hours between 06:00 and 14:30, but only if the day of the week is a Friday (selected in the field 'Date').

    Any ideas would be really appreciated.

    If

    (TimeReceived.isNull == true()

    {

    xfa.host.messageBox ("Please enter a time received");

    TimeReceived.rawValue

    = null;

    xfa.host.setFocus ("TimeReceived");

    }

    else If ((TimeofCall.Day.rawValue ==0))

    {

              if (TimeReceived.rawValue.search(":") > 0)

                        val1 = TimeReceived.rawValue.replace (":", "");

    on the other

                        val1 = TimeReceived.rawValue;

              if (val1 < 600 || val1 > 1530)

    {

    xfa.host.messageBox ("If 'Airtime' has selected day, the"received time"must be included in the normal working hours (06:00 to 15:30).") Make sure that you use military time, please re-enter. ») ;

    TimeReceived.rawValue

    = null;

    xfa.host.setFocus ("TimeReceived");
    }
    }

    FormCalc has a date function to obtain the day of the week.

    Form1.Page1.Subform1.DayOfWeek::calculate - (FormCalc, client)

    date_ var = Date2Num(date.formattedValue,"MM/DD/YYYY")
    $ = Num2Date (date_, "EEE")

    The "EEE" model returns MON, Mar, sea, etcetera. You must synchronize the date pattern on the DateTimeField ('date' in my case) with the script.

    "dayOfTheWeek" could be a hidden field and you can reference the 'dayOfTheWeek.rawValue' of your JavaScript.

    Steve

  • Query question queries

    You can query a query created using queryNew()?

    When I try the following code, I get an error:

    "Query of queries syntax error.
    Meeting "qData. user. "Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition."

    Code:

    < cfset qData = queryNew ("tool, user, community, fm01, fm02, fm03, fm04, fm05, fm06, fm07, fm08, fm09, fm10, fm11, fm12, fy") >
    < cfset temp = #queryAddRow (qData) # >
    < cfset temp = #querysetCell (qData, "tool", "empty") # >
    < cfset temp = #querysetCell (qData, "user", "Bob") # >

    < cfquery dbtype = "query" name = "chkQdata" >
    SELECT *.
    OF qData
    WHERE qData.user = 'Bob '.
    < / cfquery >

    I just tried the code you provided, adding two cfdump Tags (the first to empty the qData query and the second to empty the chkQdata query). Everything worked well exactly as you had it on Railo 3.1. It did not work (threw the error you got) on CF 8.0.1.

    If I deleted the WHERE clause of the query of chkQdata, it runs (no error) in CF 8.0.1.

    For that it works as you want in CF8, change the user column. This seems to be a keyword for CF8. While I didn't check exactly, if I change your original request to be 'empty' = tool, it runs. In addition, rename the column user usr generates the script runs correctly.

    Here is the code that I had to work in CF8 and Railo 3.1:

    SELECT *.

    OF qData

    WHERE the usr = "Bob."

  • How to optimize the select query executed in a cursor for loop?

    Hi friends,

    I run the code below and clocked at the same time for each line of code using DBMS_PROFILER.
    CREATE OR REPLACE PROCEDURE TEST
    AS
       p_file_id              NUMBER                                   := 151;
       v_shipper_ind          ah_item.shipper_ind%TYPE;
       v_sales_reserve_ind    ah_item.special_sales_reserve_ind%TYPE;
       v_location_indicator   ah_item.exe_location_ind%TYPE;
    
       CURSOR activity_c
       IS
          SELECT *
            FROM ah_activity_internal
           WHERE status_id = 30
             AND file_id = p_file_id;
    BEGIN
       DBMS_PROFILER.start_profiler ('TEST');
    
       FOR rec IN activity_c
       LOOP
          SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
                     INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
                     FROM ah_item --464000 rows in this table
                    WHERE item_id_edw IN (
                             SELECT item_id_edw
                               FROM ah_item_xref --700000 rows in this table
                              WHERE item_code_cust = rec.item_code_cust
                                AND facility_num IN (
                                       SELECT facility_code
                                         FROM ah_chain_div_facility --17 rows in this table
                                        WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
                                          AND div_id = (SELECT div_id
                                                          FROM ah_div --8 rows in this table 
                                                         WHERE division = rec.division)));
       END LOOP;
    
       DBMS_PROFILER.stop_profiler;
    EXCEPTION
       WHEN NO_DATA_FOUND
       THEN
          NULL;
       WHEN TOO_MANY_ROWS
       THEN
          NULL;
    END TEST;
    The SELECT inside the LOOP FOR cursor query took 773 seconds.
    I tried to use COLLECT in BULK instead of a cursor for loop, but it did not help.
    When I took the select query separately and executed with a value of the sample, and then he gave the results in a Flash of a second.

    All tables have primary key index.
    Any ideas what can be done to make this code more efficient?

    Thank you
    Raj.
    DECLARE
      v_chain_id ah_chain_div_facility.chain_id%TYPE := ah_internal_data_pkg.get_chain_id (p_file_id);
    
      CURSOR cur_loop IS
      SELECT * -- better off explicitly specifying columns
      FROM ah_activity_internal aai,
      (SELECT DISTINCT aix.item_code_cust, ad.division, ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
         INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
         FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
        WHERE ai.item_id_edw = aix.item_id_edw
          AND aix.facility_num = acdf.facility_code
          AND acdf.chain_id = v_chain_id
          AND acdf.div_id = ad.div_id) d
      WHERE aai.status_id = 30
        AND aai.file_id = p_file_id
        AND d.item_code_cust = aai.item_code_cust
        AND d.division = aai.division;         
    
    BEGIN
      FOR rec IN cur_loop LOOP
        ... DO your stuff ...
      END LOOP;
    END;  
    

    Published by: Dave hemming on December 4, 2008 09:17

Maybe you are looking for