Use of CS operator in SELECT... WHERE clause not allowed

Hi all gurus,
quite a dumb question, but since I'm facing the issue... I need to access a standard DB table with some selection criteria , in particular I'd like to extract all the entries where the field NAME contains a specific substring.
Since the CS operator seems not to be supported as far as the compiler tells, what's the best (efficient/effective) way to perform such a task?
Thanks,
M.

Keshav.T wrote:
Range table
Thanks Keshav, I hoped there's an alternative way to do that without using range structures/tables... and also, to overcome the case sensitive problem.
I'd go for that if no alternative arise.

Similar Messages

  • Queryeditor using fields more than once in where clause not possible?

    I have to create a select query with a WHERE clause using a field multiple times.
    I can't get this to work. For example:
    SELECT ALL
      EMSDTALIB.EMSPPA.PAIDNR,
      EMSDTALIB.EMSPPA.PANAAM,
      EMSDTALIB.EMSPPA.PAVLTR,
      EMSDTALIB.EMSPPA.PATITL,
      EMSDTALIB.EMSPPA.PAADRS,
      EMSDTALIB.EMSPPA.PAHSNR,
      EMSDTALIB.EMSPPA.PAHSNT,
      EMSDTALIB.EMSPPA.PAPCA1
    FROM EMSDTALIB.EMSPPA
    WHERE EMSDTALIB.EMSPPA.PABEDR=1 AND EMSDTALIB.EMSPPA.PADTUD=0 AND
      (EMSDTALIB.EMSPPA.PADVBD='001' OR EMSDTALIB.EMSPPA.PADVBD='003' OR EMSDTALIB.EMSPPA.PADVBD='006')How do I get this to work?
    Regards,
    Roland

    Hi Roland, Luca, ICON_SS,
    I just tried similar queries using the latest release bits and it works fine.
    My Queries that worked fine are :
    SELECT ALL DASUSR1.PERSON.PERSONID, DASUSR1.PERSON.NAME, DASUSR1.PERSON.JOBTITLE, DASUSR1.PERSON.FREQUENTFLYER
    FROM DASUSR1.PERSON
    WHERE ( DASUSR1.PERSON.NAME='Able, Tony' OR NAME='Black, John' )
    SELECT ALL DASUSR1.PERSON.PERSONID, DASUSR1.PERSON.NAME, DASUSR1.PERSON.JOBTITLE, DASUSR1.PERSON.FREQUENTFLYER
    FROM DASUSR1.PERSON
    WHERE ( DASUSR1.PERSON.PERSONID=1 OR PERSONID=2 OR PERSONID=3)
    I would suggest you to Download & Install latest Creator bits released 9/27/2004, if not already done.
    Appreciate your valuable feedback,
    Sakthi

  • String operations in SELECT WHERE clause

    Hi,
    PARAMETERS: P_MAKTX TYPE MAKT-MAKTX.
    Lets say the user inputs "Pump". I want the program to search the text "pump" in all makt-maktx and display the result.
    Could someone tell me how to write the select statement.
    SELECT * from MAKT into table IT_MAKT where MAKTX ??? P_MAKTX.
    Please advise.
    Regards,
    Shobhit

    Try this....
    This is an example for using the parameter.  You could use a select-option instead.
    report zrich_0001
           no standard page heading.
    data: imakt type table of makt with header line.
    parameters: p_maktx type makt-maktx.
    ranges: r_maktx for imakt-maktx.
    r_maktx-sign = 'I'.
    r_maktx-option = 'CP'.
    concatenate '*' p_maktx '*' into r_maktx-low.
    condense r_maktx-low.
    append r_maktx.
    select * into corresponding fields of table imakt
             from makt
                  where maktx in r_maktx
                    and spras = sy-langu.
    loop at imakt.
      write:/ imakt-matnr, imakt-maktx.
    endloop.
    Regards,
    Rich Heilman

  • Using a Dimension/ Measure in a Where clause of Another Dimension/ Measure in IDT

    Hi All
    I am building a Universe using Information Design Tool. In the Business Layer, I need to use a created Business Layer Dimension (not Tables) in a Where clause of another dimension as follow:
    Dimension: "Current Week No"
         SELECT
              budgets.dbo.Calenderweeks.WeekNo
         WHERE
              budgets.dbo.Calenderweeks.EndDate = convert(SMALLDATETIME, fn CURDATE()})  
    Dimension: "Last Week No"
         SELECT
              budgets.dbo.Calenderweeks.WeekNo
         WHERE
              budget.dbo.Calenderweeks  .WeekNo = @Select(Dimension\Current Week No) - 1
    The first dimension is working well. However, the "Last Week No" shows NOTHING (I do not get any value)
    Anyone can explain why I am not get any value from the second dimension, and how I can use a Dimension/ Measure in a Where clause of another Dimension/ Measure ?
    Thanks

    Short answer:
    Beware of object WHERE clauses. They are rarely (I'd almost say never) the solution to the problem you're trying to solve.
    Long answer:
    It doesn't work because you are inadvertently filtering the same value twice in two incompatible ways in the same SQL statement.  Both objects SELECT the same column in the database.  The first object uses a WHERE clause to set it to the current week.  The second object attempts to use a WHERE clause to set it to the previous week, but does so by selecting the first object, so you end up with both objects in your data provider.
    Remember that BO is going to place all the objects in your data provider in the same SQL (except of course where your context definition has ensured otherwise.), so you have two WHERE clauses in your generated SQL which attempt to find a line equal both the current week and the previous week... and returns, naturally, no results.
    Rewrite it with a derived table (as explained in the response above) and you'll get what you want.

  • EQUAL condition on WHERE clause not working

    Hi,
    Can someone please tell me why the following WHERE clause  (marked with ***** below) is not finding any EQUAL conditions?
    I know that table i_cust_mast is populated with several thousand rows and that there ARE matching rows in KNVP.
    Here is the code as I have it:
    TYPES:
          BEGIN OF t_cust_mast,
            kunnr TYPE kunnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            stras TYPE stras_gp,
            adrnr TYPE adrnr,
            ort01 TYPE ort01_gp,
            regio TYPE regio,
            pstlz TYPE pstlz,
            vkbur TYPE vkbur,
            konda TYPE konda,
            sortl TYPE sortl,
            katr1 TYPE katr1,
            katr2 TYPE katr2,
            katr3 TYPE katr3,
            katr4 TYPE katr4,
            katr5 TYPE katr5,
            katr6 TYPE katr6,
            katr7 TYPE katr7,
            katr8 TYPE katr8,
            katr9 TYPE katr9,
            katr10 TYPE katr10,
            bzirk TYPE bzirk,
            vkgrp TYPE vkgrp,
            kdgrp TYPE kdgrp,
            klabc TYPE klabc,
            kondaa TYPE konda,
            kalks TYPE kalks,
            pltyp TYPE pltyp,
            hityp TYPE hityp_kh,
            hkunnr TYPE hkunnr_kh,
            datab TYPE datab,
            datbi TYPE datbi,
            lzone TYPE lzone,
          parvw TYPE parvw,
            kunn2 TYPE kunn2,
            kunn2a TYPE kunn2,
            kunn2b TYPE kunn2,
            kunn2c TYPE kunn2,
            kunn2d TYPE kunn2,
            kunn2e TYPE kunn2,
            kunn2f TYPE kunn2,
            kunn2g TYPE kunn2,
            parza TYPE parza,
            ktokd TYPE ktokd,
            loevm TYPE loevm_x,
          END OF t_cust_mast .
        TYPES:
          BEGIN OF t_part_func,
            kunnr TYPE kunnr,
            parvw type parvw,
            kunn2 TYPE kunn2,
            parza type parza,
          END OF t_part_func .
        TYPES:
          t_t_cust_mast TYPE STANDARD TABLE OF t_cust_mast,
          t_t_part_func TYPE STANDARD TABLE OF t_part_func.
        DATA: i_cust_mast TYPE t_t_cust_mast,
              i_part_func TYPE t_t_part_func.
      CONSTANTS: c_type_a TYPE msgty VALUE 'A'.
      FIELD-SYMBOLS: <x_cm> LIKE LINE OF i_cust_mast.
    Get Customer Master Data
      SELECT
       hkunnr hname1 hname2 hstras hadrnr hort01 h~regio
       hpstlz ivkbur ikonda hsortl hkatr1 hkatr2 h~katr3
       hkatr4 hkatr5 hkatr6 hkatr7 hkatr8 hkatr9 h~katr10
       ibzirk ivkgrp ikdgrp iklabc ikonda ikalks i~pltyp
       khityp khkunnr kdatab kdatbi h~lzone
       hktokd hloevm
      INTO TABLE i_cust_mast " up to 50 rows
      FROM kna1 AS h
      JOIN knvv AS i ON ikunnr = hkunnr
      JOIN knvh AS k ON hityp = c_type_a   " 'A'
                    AND kkunnr = ikunnr
                    AND kvkorg = ivkorg
                    AND kvtweg = ivtweg
                    AND kspart = ispart
                    AND k~datab <= sy-datum
                    AND k~datbi >= sy-datum.
      IF sy-subrc = 0.
        SORT i_cust_mast[] BY kunnr.
      ENDIF.
    Get Partner Function Data for each Customer Master Record
      LOOP AT i_cust_mast ASSIGNING <x_cm>.
        SELECT hkunnr hparvw hkunn2 hparza
          INTO TABLE i_part_func
        FROM knvp AS h
          WHERE h~kunnr = <x_cm>-kunnr.        ***** WHERE clause not finding any matches *****
      ENDLOOP.
    Thanks!!!
    Andy

    TYPES:
          BEGIN OF t_cust_mast,
            kunnr TYPE kunnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            stras TYPE stras_gp,
            adrnr TYPE adrnr,
            ort01 TYPE ort01_gp,
            regio TYPE regio,
            pstlz TYPE pstlz,
            vkbur TYPE vkbur,
            konda TYPE konda,
            sortl TYPE sortl,
            katr1 TYPE katr1,
            katr2 TYPE katr2,
            katr3 TYPE katr3,
            katr4 TYPE katr4,
            katr5 TYPE katr5,
            katr6 TYPE katr6,
            katr7 TYPE katr7,
            katr8 TYPE katr8,
            katr9 TYPE katr9,
            katr10 TYPE katr10,
            bzirk TYPE bzirk,
            vkgrp TYPE vkgrp,
            kdgrp TYPE kdgrp,
            klabc TYPE klabc,
            kondaa TYPE konda,
            kalks TYPE kalks,
            pltyp TYPE pltyp,
            hityp TYPE hityp_kh,
            hkunnr TYPE hkunnr_kh,
            datab TYPE datab,
            datbi TYPE datbi,
            lzone TYPE lzone,
          parvw TYPE parvw,
            kunn2 TYPE kunn2,
            kunn2a TYPE kunn2,
            kunn2b TYPE kunn2,
            kunn2c TYPE kunn2,
            kunn2d TYPE kunn2,
            kunn2e TYPE kunn2,
            kunn2f TYPE kunn2,
            kunn2g TYPE kunn2,
            parza TYPE parza,
            ktokd TYPE ktokd,
            loevm TYPE loevm_x,
          END OF t_cust_mast .
        TYPES:
          BEGIN OF t_part_func,
            kunnr TYPE kunnr,
            parvw type parvw,
            kunn2 TYPE kunn2,
            parza type parza,
          END OF t_part_func .
        TYPES:
          t_t_cust_mast TYPE STANDARD TABLE OF t_cust_mast,
          t_t_part_func TYPE STANDARD TABLE OF t_part_func.
        DATA: i_cust_mast TYPE t_t_cust_mast,
              i_part_func TYPE t_t_part_func. 
    CONSTANTS: c_type_a TYPE msgty VALUE 'A'.
      FIELD-SYMBOLS: <x_cm> LIKE LINE OF i_cust_mast.
    Get Customer Master Data
      SELECT
       hkunnr hname1 hname2 hstras hadrnr hort01 h~regio
       hpstlz ivkbur ikonda hsortl hkatr1 hkatr2 h~katr3
       hkatr4 hkatr5 hkatr6 hkatr7 hkatr8 hkatr9 h~katr10
       ibzirk ivkgrp ikdgrp iklabc ikonda ikalks i~pltyp
       khityp khkunnr kdatab kdatbi h~lzone
       hktokd hloevm
      INTO TABLE i_cust_mast " up to 50 rows
      FROM kna1 AS h
      JOIN knvv AS i ON ikunnr = hkunnr
      JOIN knvh AS k ON hityp = c_type_a   " 'A'
                    AND kkunnr = ikunnr
                    AND kvkorg = ivkorg
                    AND kvtweg = ivtweg
                    AND kspart = ispart
                    AND k~datab <= sy-datum
                    AND k~datbi >= sy-datum.
      IF sy-subrc = 0.
        SORT i_cust_mast[] BY kunnr.
      ENDIF.
    Get Partner Function Data for each Customer Master Record
      LOOP AT i_cust_mast ASSIGNING <x_cm>.
        SELECT hkunnr hparvw hkunn2 hparza
          INTO TABLE i_part_func
        FROM knvp AS h
          WHERE h~kunnr = <x_cm>-kunnr.
      ENDLOOP.

  • Using Mac OSX Install Disc 1, I am not able to get any further than the Partition tab.  It allows me to select my hard drive selection, but will not allow me to make any other selections.  Does anyone know their way around this obstacle?  Thanks!

    Using Mac OSX Install Disc 1, I am not able to get any further than the Partition tab.  It allows me to select my hard drive selection, but will not allow me to make any other selections such as options.  Does anyone know their way around this obstacle?  Am I doing anything wrong?  Thanks

    Hello, The Hatter, I read about the 'trick' of backing up, erasing, and restoring too, but I figured it would take longer than defragmenting the disk.
    But the defragmentation process has just finished! so I'm gonna try to run Boot Camp again soon!
    Thanks for your helpfulness, anyway.
    And P.S. I didn't clone my system onto the external drive, I just inserted the Mac OS X Install CD, rebooted holding down the "C" key, and installed a fresh Snow Leopard system onto the predetermined partition. I will use that in cases of emergency, when my main/internal system becomes unusable.

  • HT1541 When i'm trying to send an application as gift using "send gift via email" option, it is not allowing me to buy the app. A pop up appears with message "Please contact itunes support to complete this purchase"

    When i'm trying to send an application as gift using "send gift via email" option, it is not allowing me to buy the app. A pop up appears with message "Please contact itunes support to complete this purchase"

    Okay, so do as it says, contact iTunes customer support.

  • Using OR operator in the WHERE clause in Oracle BI

    Hi, i am using Oracle BI EE 10.1.3.3.3.
    I construct the simple report in BI Answers on the Accounts presentation layer, and use the following filter clause:
    "WHERE (AccountNum BETWEEN '441' and '473') OR (БалСчет1Порядка BETWEEN '501' and '519')"
    Then i look in the cursor cache and find the real query which is going to database, and it's "where" clause now is:
    "where ( (T45172.BA >= '441' or T45172.BA >= '501') and
    (T45172.BA >= '441' or T45172.BA <= '519') and
    (T45172.BA >= '501' or T45172.BA <= '473') and
    (T45172.BA <= '473' or T45172.BA <= '519') ) "
    Why BI create so many expressions instead of the source 2 expressions?
    How can i force BI to use the source expressions?

    I have the same settings too.
    I post the following query in the Administration web interface, and set the maximum logging level (7):
    SELECT "Plan Account"."Balance Account" saw_0
    FROM "Plan Account"
    WHERE ("Plan Account"."Balance Account" between '441' and '473')
    OR ("Plan Account"."Balance Account" between '501' and '519')
    ORDER BY saw_0
    And got the following BI execution plan:
    RqList <<5619441>> [for database 0:0,0] distinct D1.c1 as c1 [for database 3023:44913,46]
    Child Nodes (RqJoinSpec): <<5619450>> [for database 3023:44913:DB,46]
    RqList <<5619277>> [for database 3023:44913:DB,46]
    D1.c1 as c1 GB [for database 3023:44913,46]
    Child Nodes (RqJoinSpec): <<5619360>> [for database 3023:44913:DB,46]
    RqList <<5619284>> [for database 3023:44913:DB,46]
    Dim - Plan Account.BA as c1 GB [for database 3023:44913,46]
    Child Nodes (RqJoinSpec): <<5619350>> [for database 3023:44913:DB,46]
    TB_PLAN_ACCOUNT T45172
    DetailFilter: (not Dim - Plan Account.BA < '441' or not Dim - Plan Account.BA < '501') and (not Dim - Plan Account.BA < '441' or not '519' < Dim - Plan Account.BA) and (not Dim - Plan Account.BA < '501' or not '473' < Dim - Plan Account.BA) and (not '473' < Dim - Plan Account.BA or not '519' < Dim - Plan Account.BA) [for database 0:0]
    ) as D1
    ) as D1
    OrderBy: c1 asc [for database 0:0,0]
    and following query sent to database:
    -------------------- Sending query to database named DB (id: <<5619277>>):
    select distinct D1.c1 as c1
    from
    (select distinct T45172.BA as c1
    from
    TB_PLAN_ACCOUNT T45172 /* Dim - Plan Account */
    where ( (T45172.BA >= '441' or T45172.BA >= '501') and (T45172.BA >= '441' or T45172.BA <= '519') and (T45172.BA >= '501' or T45172.BA <= '473') and (T45172.BA <= '473' or T45172.BA <= '519') )
    ) D1
    So, i got the same bad where clause...
    What can you advice?

  • Using a report value for a where clause in other report

    Hi All,
    i'm getting kinda nuts here. I created a page with three reports.
    First report show the name of the user who logged in with his/her whole name. Second report shows the year, week, begin/end date of the week for the user in the first report. The third report show the hours the user worked in the week selected in the second report.
    The link between first and second report is on column report. Somehow i managed it to work with second_report.mdw_code = :P3_ACRONIEM. I have no idea were this P3_ACRONIEM item is coming from, while i have no items in my page whatsoever. Now i need to link the second report to the third report. I have to use the second_report.mdw_code, second_report.year and second_report.week but i have no idea how to link these together. Any idea's? (Like making items, but then i have no idea how to link that item to the value in the second report). Please help.
    Kind regards,
    Dave
    The link between the first and the second i could get it to work with :P3_ACRONIEM. I have no idea where this ITEM is coming from, because i have no items in my page (and it's the only page in the application). Then

    Hi Dave,
    If I understand you correctly, you have a one report that lists users, a second report that lists dates and a final report that shows hours worked?
    If so, you may find it easiest to have hidden fields on your page and base the second and third reports on these using appropriate WHERE clauses. (I generally put hidden fields in a region in the "After Header" position)
    So, if the first report contains a USER_ID field, have a hidden field called P1_USER_ID. The link on the first report will branch back to the same page and set the value of P1_USER_ID to #USER_ID# The second report can then use WHERE USER_ID = :P1_USER_ID. When the page reloads, the second report redisplays and is filtered to show only those records relating to the selected USER_ID in the first report.
    To extend this, if the second report contains WEEK_NUMBER, it should have a link that branches back to the same page and sets a hidden P1_WEEK_NUMBER field with #WEEK_NUMBER#. The third report should when have WHERE WEEK_NUMBER = :P1_WEEK_NUMBER AND USER_ID = :P1_USER_ID. You can, if need be, have and set more than one hidden field during each link.
    Regards
    Andy

  • How to use a lexical variable in a WHERE clause and as a function argument.

    Hello,
    My report has a lexical variable which has values like 'and id in (1,3,4)'. I want to use this variable in two separate queries. In the first, it is used in the WHERE clause, something like:
    .. where date is not null &var;
    In the second query, the variable is used in a function call, something like:
    select * from table (my_function(&var));
    The trouble is that the first query works when the value of the variable is unquoted, but for the second query the value should be quoted.
    Does anyone have an idea how I could solve this problem?
    Thanks in advance,
    Frans
    Message was edited by:
    fransie

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html
    Presents many options.

  • Mutating table exception & use of a table column in where clause

    Hello,
    I have a scenario in which I am getting a Mutating table exception in which I have a trigger using which I insert into a second table in case there is an insert in the first table or the one which is associated with the trigger .
    my trigger code has this line which is causing the Mutating table exception :
    BEGIN
    IF INSERTING THEN
    SELECT a,b INTO var_a,var_b
    FROM tableA,tableB,tableC
    WHERE tableC.c = :new:c
    The problem is the tableC reference in my where clause is causing a Mutating table exception , but I don't see any other way in which I can get rid of it cause I need to check if new:c values exists in the table or not , can anybody suggest how I can get rid of the tableC reference in my SQL statement yet be able to check for the value of :new:C in my statement ?

    Hopefully this demonstrates the problem , the bold portion or the where clause is where I am getting flummoxed , I need to be able to compare the new value to a column in table C but if I use tableC reference I get mutating table exception
    create or replace
    trigger myTrigger
    after insert or delete or update on TableC
    referencing old as old new as new
    for each row
    DECLARE val1 number; val2 CHAR(1);
    BEGIN
    IF INSERTING THEN
    SELECT tableA.val1,tableB.val2 INTO val1,val2
    FROM TableA tableA,TableB tableB
    WHERE :new.val1
    AND :new.val1 is not null
    AND tableA.val2 = :new.val2
    AND tableB.val3 = tableA.val3
    AND tableC.val4 = :new.val5
    INSERT INTO TableD (col1 ,
    col2,
    col3,
    col4,
    col5,
    col6,
    col7,
    col8,
    col9)
    VALUES(:new.val1,
    :new.val2,
    :new.val3,
    tableA.val1,
    tableB.val2,
    :new.val4,
    :new.val5,
    :new.val6,
    :new.val7);

  • How to use multiple search conditions in the where clause

    Hi,
    Below is my query
    /****** Script for SelectTopNRows command from SSMS  ******/
    SELECT distinct 
    ctacct,sum(GLMN02)
      FROM [ODS].[Staging].[tODS_INF_GLPCT]
      inner join 
      [ODS].[Staging].[tODS_INF_GLPGL] ON tODS_INF_GLPCT.CTPAGE = tODS_INF_GLPGL.GLPAGE
      where 
      CTACCT like '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4110%'
    This one gives me the exact result i want, now if i add one more to my where clause like this
    /****** Script for SelectTopNRows command from SSMS  ******/
    SELECT distinct 
    ctacct,sum(GLMN02)
    --,ctdesc,CTPAGE
    --SUM(GLMN02)
      FROM [ODS].[Staging].[tODS_INF_GLPCT]
      inner join 
      [ODS].[Staging].[tODS_INF_GLPGL] ON tODS_INF_GLPCT.CTPAGE = tODS_INF_GLPGL.GLPAGE
      where 
      CTACCT like'[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4110%' or
      CTACCT like '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4115%'
    This query doesnt give me the exact values instead it gives me all the weird values.Can someone please help me with how to work on this where clause?
    Thanks

    Hi Patrick,
    This is what i ve tried earlier and it isnt working .If i use the first query
    /****** Script for SelectTopNRows command from SSMS  ******/
    SELECT distinct 
    ctdesc,SUM(GLMN02)
    --,ctdesc,CTPAGE
    --SUM(GLMN02)
      FROM [ODS].[Staging].[tODS_INF_GLPCT]
      inner join 
      [ODS].[Staging].[tODS_INF_GLPGL] ON tODS_INF_GLPCT.CTPAGE = tODS_INF_GLPGL.GLPAGE
      where 
     CTAcct LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4110%'
       --OR
       --CTAcct LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4115%'
      and GLYEAR = 2014
      and CTDESC = 'Sales'
      group by ctdesc
    The result set is 
    Sales                        
    -182273.96
    And if i use the second query
    SELECT distinct 
    ctdesc,SUM(GLMN02)
    --,ctdesc,CTPAGE
    --SUM(GLMN02)
      FROM [ODS].[Staging].[tODS_INF_GLPCT]
      inner join 
      [ODS].[Staging].[tODS_INF_GLPGL] ON tODS_INF_GLPCT.CTPAGE = tODS_INF_GLPGL.GLPAGE
      where 
     CTAcct LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4110%'
     OR
       CTAcct LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4115%'
      and GLYEAR = 2014
      and CTDESC = 'Sales'
      group by ctdesc
    The result set i get is 
    Sales                        
    -1455441.08
    And i verified that  CTAcct LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-63020-4115%'
    this second line of where clause has not desc as Sales.
    I am not sure whats causing the difference in the values.
    Can you please help me with this?
    Thanks

  • How to use the MAX DATE condition in WHERE CLAUSE FILEDS

    Hi,
    I am trying to fetch the result for getting maximun date but when i try to execute the query i am getting the error as follows.
    CONDITION : trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')
    ERROR: Group function is not allowed here.
    CHEERS,
    PRABU AMMAIAPPAN

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • How to use floor(to_number(substr x))) in where clause???

    Hi,
    I have a column doc_id which value like abcd.01.023. If I
    select floor(to_number(substr(doc_id, instr(doc_id, '.', 1)+1, instr(doc_id, '.', 1)+1 )))
    it works,
    but get ORA-01722: invalid number if I use in where clause like:
    Where floor(to_number(substr(doc_id, instr(doc_id, '.', 1)+1, instr(doc_id, '.', 1)+1 ))) =0
    Could you tell me how to fix?
    Thansk

    My guess is that you didn't process the same rows with each query. Maybe you have some where conditions on the 'select' query that filters out the offending rows. If the doc_id value could not be converted to a number is should raise the error in either case.
    Besides that, your substring looks wrong to me. Why take "instr(doc_id, '.', 1)+1" characters? Why not just:
    floor(substr(doc_id, instr(doc_id, '.') + 1))
    Even then, the portion after the first '.' must be a valid number.
    Richard

  • SELECT WHERE clause

    Hi,
    I'm working with Oracle JDeveloper 9.0.5.2 with ADF.
    I have a data page in FindMode. Into the jsp related to this data page, I have some attributes where I could set some values before executing a query on a view object.
    My question is:
    Is it exist a way, at run time, to capture the select string including the WHERE clause just indicated in the jsp page ?
    For example:
    if, into the text box related to "Attribute1", I indicate "abc" and, into the text box related to "Attribute2", I indicate "5", how can I get the WHERE string "Attribute1 LIKE 'abc' AND Attribute2 = 5" ?
    Thanks in advance.
    Kind Regards.
    Massimo

    Dear Brenden Anstey,
    thanks for your prompt reply.
    But, unfortunately, your suggestion does not resolve my problem.
    I'll try to explain better what I want:
    I have a Struts Data Page. The related jsp page is in the Find mode because I have to use it to insert some values for some attributes and just after to choose a submit button in order to execute a query from a view object that respects the values above inserted.
    1) Into my jsp I have the following attributes:
    - “Attribute1” (type: VARCHAR2)
    - “Attribute2” (type: NUMBER)
    2) I insert the following values:
    - “string1” for “Attribute1”
    - “123” for “Attribute2”
    3) Then, I choose the submit button to excute the query on the view object.
    Now, I need to know what is the SQL string that ADF builds at run time to excute the query and to get a records data set from a view object. In the above example, the SQL string should be:
    SELECT * FROM ViewObjectName WHERE Attribute1 LIKE ‘string1’ AND Attribute2 = 123
    I think it should be possible to obtain this, because if, for example, I indicate “a” for the numeric attribute “Attribute2”, it appears a jsp with an error message like this:
    JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM ViewObjectName WHERE ( ( (Attribute2 = a) ) )
    So, it means that the SQL string has to be been registred somewhere.
    Could anyone help me ????
    Thanks in advance
    Best Regards.
    Massimo

Maybe you are looking for

  • Page Size and Rotated printing Bug

    When using the DataMax I4208 printer, I cannot use Crystal Reports 2008 as it will autorotate the text 90 degrees as it sees fit to the label.  It is always wrong which causes the font size to be reduced to a super fine font too small for a microscop

  • Control printing with ALTERNATIVE in several pages

    Hello all,  I'm currently working on generating a PDF where each page needs to be conditional (ie user can print 1st & 2nd page, or 1st, 2nd & 3rd, or 1st & 3rd).  Altogether there are about 20 pages. The use of alternative + command with next page w

  • Further info on 6980 printer problems please read this one

    I have a HP 6980 deskjet that I attach via usb to my macbook when I need to print. Everything has been working fine for a year now except yesterday it gives me a message "problem printing to printer, please check that the printer is chosen in the pri

  • Does JMF Support multilingual absolute paths for video playback?

    Hi everyone, I hope I can find some answer here. Does JMF supports multilingual paths for videos? E.g. I have a video located by the following URL: G:\video\Stürmische\video.mp4 When I try to open this video by JMF, I get the following Exception: Pro

  • Query builder by microsoft access with CF basics

    does anyone if query builder by microsoft access can work with with CF mx how can i use it with cf and oracle queries? also, is it free. does anyone know how i can get it. and install it with my db (oracle 9i)???? thanks