Wrong with this query

Hi i need to execute the following query using decode
select decode(blob_content,(select blob_content from a_images2 where employee_number not in (select employee_number from a_images2 )),(select blob_content from a_images2 where employee_number='FINALPHOTO'),(SELECT BLOB_CONTENT FROM A_IMAGES2 WHERE EMPLOYEE_NUMBER=:APP_USER)) photo
from a_images2;
but im getting the following error
     ORA-00932: inconsistent datatypes: expected - got BLOB
why this causing problem, what is wrong with the above query.
Regards,
Mini

BLOBs are not supported by decode.
Please take a look at this:
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions049.htm#sthref1080

Similar Messages

  • Whats wrong with this query.can anyone help me......

    select CASE WHEN TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0 AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)||'00',SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),'DD-MM-YYYY HH24:MI:SS') end
    from table;
    i have written this query.whats wrong with this query..........
    the error is "literal does not match format string"
    Reegards soumen

    Why does your date_format loose, ununify and not fix ?
    And what is your exact requirement?
    >>
    CASE WHEN
    TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0
    AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    <<
    This is
    CASE WHEN TO_CHAR(START_TIME_TIMESTAMP,'MM') between '01' and '13'
    >>
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)
    ||'00',
    SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),
    'DD-MM-YYYY HH24:MI:SS')
    <<
    This is
    TO_DATE(
    TO_CHAR(START_TIME_TIMESTAMP,'MM"00"SS"00"),
    'DD-MM-YYYY HH24:MI:SS')
    Obviously, format is not matching !
    SQL> select to_char(sysdate,'MM"00"SS"00') from dual;
    TO_CHAR(
    06004900
    SQL> select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual;
    select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual
    ERROR at line 1:
    ORA-01861: literal does not match format string

  • Anything Wrong with this query?

    I have been trying to create a report based on this query:
    SELECT call_type.call_type_detail,
    code_city.code_city_detail, area_code.area_code_detail,
    call_reason.call_reason_detail, cform.cform_phone_number_body,
    call_outcome.call_outcome_detail,
    outcome_reason.outcome_reason_detail, cform.cform_date_time ,
    cform.cform_comments
    FROM call_type, code_city, area_code, call_reason, cform,
    call_outcome, outcome_reason
    I have verified all fields to make sure they match and when I
    try to test it CFR crashes...any idea as to why this may be
    happening? Thanks!

    The funny thing is I WAS using inner join already, but didn't
    know it was called that and didn't add it to the post since I have
    quite a few variables as criteria and thought it would make it
    difficult to understand. In the end it was stalling because of an
    error in a table I had not properly specified.
    This is what I had from the start!
    SELECT call_type.call_type_detail,
    code_city.code_city_detail, area_code.area_code_detail,
    call_reason.call_reason_detail, cform.cform_phone_number_body,
    call_outcome.call_outcome_detail,
    outcome_reason.outcome_reason_detail, cform.cform_date_time ,
    cform.cform_comments
    FROM call_type, code_city, area_code, call_reason, cform,
    call_outcome, outcome_reason
    WHERE cform.cform_date_time BETWEEN
    #CreateODBCDateTime(param.CustomFullStartDate)# AND
    #CreateODBCDateTime(param.CustomFullEndDate)# AND
    cform.cform_call_product=#param.GetCustomProduct# AND
    cform.call_service= #param.GetCustomService# AND
    cform.cform_call_reason=#param.GetCustomCallReason# AND
    cform.cform_call_outcome=#param.GetCustomCallOutcome# AND
    cform.cform_call_outcome_reason=#param.GetCustomReason# AND
    call_type.call_type_id=cform.cform_call_type AND
    call_city.call_city_id=cform.cform_call_city AND
    area_code.area_code_id=cform.cform_area_code AND
    call_reason.call_reason_id=cform.cform_call_reason AND
    call_outcome.call_outcome_id=cform.cform_call_outcome AND
    outcome_reason.outcome_reason_id=cform.cform_outcome_reason AND
    cform.cform_date_time

  • What is wrong with this query?

    Hi,
    The below query is showing this error:
    ORA-01788:CONNECT BY LOOP in user data.
    Please let me know where i am going wrong?
    The data in the table xx_dates is :
    Empno        date1                      date2
    1           20-JAN-2008            24-JAN-2008
    2           20-JAN-2008            20-JAN-2008The query i am using is:
    select empno,date1,date2,date1+level-1,level,DBMS_RANDOM.random
    from xx_dates
    connect by empno=prior empno  start with empno=1
               and date1 <= date2-level + 1Edited by: Sreekanth Munagala on Nov 17, 2008 6:01 AM

    Or maybe it's this you are looking for...
    SQL> ed
    Wrote file afiedt.buf
      1  with xx_dates as (select 1 as empno, to_date('20-JAN-2008','DD-MON-YYYY') as date1, to_date('24-JAN-2008','DD-MON-YYYY') as date2 from dual union all
      2                    select 2, to_date('20-JAN-2008','DD-MON-YYYY'), to_date('20-JAN-2008','DD-MON-YYYY') from dual)
      3  --
      4  select empno,date1,date2,date1+level-1,level,DBMS_RANDOM.random
      5  from xx_dates
      6  connect by level <= (date2-date1) + 1
      7* start with empno=1
    SQL> /
         EMPNO DATE1                DATE2                DATE1+LEVEL-1             LEVEL     RANDOM
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 20-JAN-2008 00:00:00          1 -291581367
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 21-JAN-2008 00:00:00          2 1347815622
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 22-JAN-2008 00:00:00          3 -595509310
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 23-JAN-2008 00:00:00          4 -1.602E+09
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 24-JAN-2008 00:00:00          5 -1.511E+09
    SQL>

  • Is there something wrong with this query

    my query in a prepared statement is:
    select * from RAC.v_ABRIDGEMENTS where ((?     BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) OR (?     BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) and ENTRY_DATE = ? and COUNTY = ? ) its obviusly wrong - the between stuff where i place two years - a lowYearLimit and an upperYearLimit they some how override the entry_date match that i'm trying to do :
    so eg .
    select * from RAC.v_ABRIDGEMENTS where (('1870'     BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) OR ('1870'     BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) and ENTRY_DATE = '1870-01-03 00:00:00.000' and COUNTY = 'Wigtown' )
    will give all stuff 1870 and not just the 1870-01-03 matching stuff in 1870 ---how can i fix this ? ---basically the year stuff is in format of upperyear and lower year to account for occurances where the year is in a year range - such as 1870-1873 --this is in the same column                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    OK, reformatting this so I can read it (and getting rid of the useless sets of parenthesis), this is:
    select *
    from RAC.v_ABRIDGEMENTS
    where ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
       OR ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
      and ENTRY_DATE = ?
      and COUNTY = ?Now, if you understand operator precendence, the answer should be obvious; however, you probably don't so I'll spell it out....
    Your WHERE clause has:
    WHERE condition A
       OR condition B
      AND condition C
      AND condition DApplying standard operator precedence, this is the same as:
    A or (B and C and D)What I think you want is:
    select *
    from RAC.v_ABRIDGEMENTS
    where (
          ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
       OR ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
      and ENTRY_DATE = ?
      and COUNTY = ?This gives you:
    WHERE (A or B) and C and D

  • What's wrong with this query ?

    v_SQL := 'OPEN RCT' || v_iLevel || ' FOR
                   SELECT     datasets.*,
                        CASE fn_GetSupplierStatus(:p_SupplierID, DatasetID)
                             WHEN 1 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 1)
                             WHEN 3 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 2)
                             WHEN 4 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 3)
                             WHEN 5 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 4)
                             ELSE
                                  CASE IsDataset
                                       WHEN 0 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                       ELSE SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                  END
                             END AS CStatus,
                             CASE fn_GetUserPermission(:p_UserID, DatasetID)
                                  WHEN 2 THEN SMfn_GetSpecifiedRow(:p_UserPermission, 1)
                                  ELSE
                                       CASE IsDataset
                                            WHEN 0 THEN ''''
                                            ELSE SMfn_GetSpecifiedRow(:p_UserPermission, 2)
                                       END
                             END AS UStatus,
                             SMfn_DatasetHasChildren(DatasetID) as HasChildren,
                             :p_RoleID as RoleID
                        FROM datasets
                        WHERE     Level_ = :v_iLevel';
              raise_application_error(-20001, v_SQL);
              execute immediate v_SQL
                   using     p_SupplierID, p_SupplierStatus, p_SupplierStatus, p_SupplierStatus, p_SupplierStatus,
                        p_SupplierStatus, p_SupplierStatus, p_UserID, p_UserPermission, p_UserPermission, p_RoleID, v_iLevel;
    What I am trying to do is to populate the cursor using a dynamic query, so that I can change cursor name each time.
    All functions used exist, and still I get this error: Invalid SQL statement.
    Is it possible to populate a cursor which is a parameter to the procedure (ref cursor) with a dynamic query ?
    Thanks.

    this is the query that gets executed:
    OPEN RCT1 FOR
                   SELECT     datasets.*,
                        CASE fn_GetSupplierStatus(:p_SupplierID, DatasetID)
                             WHEN 1 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 1)
                             WHEN 3 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 2)
                             WHEN 4 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 3)
                             WHEN 5 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 4)
                             ELSE
                                  CASE IsDataset
                                       WHEN 0 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                       ELSE SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                  END
                             END AS CStatus,
                             CASE fn_GetUserPermission(:p_UserID, DatasetID)
                                  WHEN 2 THEN SMfn_GetSpecifiedRow(:p_UserPermission, 1)
                                  ELSE
                                       CASE IsDataset
                                            WHEN 0 THEN ''
                                            ELSE SMfn_GetSpecifiedRow(:p_UserPermission, 2)
                                       END
                             END AS UStatus,
                             SMfn_DatasetHasChildren(DatasetID) as HasChildren,
                             :p_RoleID as RoleID
                        FROM datasets
                        WHERE     Level_ = :v_iLevel
    The select works fine (without "Open RCT1 FOR") if I try to run it, but when trying to populate the cursor, I get the error Ivalid SQL statement.

  • What's wrong with this query--need help

    Requirement: need to get the names of employees who were hired on tuesday this has to use to_char function
    select ename
    from emp
    where to_char(hiredate,'day')='tuesday';
    when i execute the query
    o/p is no rows selected
    please help.
    thanks in advance.

    Hi,
    861173 wrote:
    Requirement: need to get the names of employees who were hired on tuesday this has to use to_char function
    select ename
    from emp
    where to_char(hiredate,'day')='tuesday';
    when i execute the query
    o/p is no rows selected Try:
    WHERE   TO_CHAR (hiredate, 'fmday')  = 'tuesday'Without 'FM" in the 2nd argument, TO_CHAR pads the results to make it a consistent length. If your NLS_DATE_LANGUAGE=ENGLISH, that means it will always return a 9-character string, since the longest name in English ('Wednesday') has 9 letters. 'FM' (case-insernsitive) tells TO_CHAR not to add that kind of padding.

  • Any see what is wrong with this query?

    Logs Record Set - query - Top 4 of 4 Rows
    ATTRIBUTES DATELASTMODIFIED DIRECTORY MODE NAME SIZE TYPE
    1 [empty string] 06/06/2007 10:59:17 AM
    G:\Tracker\wwwRoot\Data
    [empty string] ChargedOut_06Jun2007_ILS_105634322.txt 828
    File
    2 [empty string] 06/06/2007 10:57:00 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Error_06Jun2007_ ILS_105634322.txt 88 File
    3 [empty string] 06/06/2007 10:58:46 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Final_06Jun2007_ ILS_105634322.txt 27841 File
    4 [empty string] 06/06/2007 10:56:07 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Upload_06Jun2007_ ILS_105634322.txt 94768 File
    ChargeOut Stats - struct
    CACHED false
    COLUMNLIST NAME
    EXECUTIONTIME 0
    RECORDCOUNT 0
    SQL SELECT Name FROM Logs WHERE Name = 'ChargedOut_06Jun2007_
    ILS_105634322.txt'
    chargeOut Record Set - query - Top 0 of 0 Rows
    NAME
    CODE
    <cfdirectory directory="#ExpandPath('data')#"
    action="list" name="Logs"
    sort="Name">
    <cfquery dbtype="query" name="ChargedOut"
    result="stats">
    SELECT Name
    FROM Logs
    WHERE Name = 'ChargedOut#Set#.txt'
    </cfquery>
    I can not see why SELECT Name FROM Logs WHERE Name =
    'ChargedOut_06Jun2007_ ILS_105634322.txt' is not returning
    the
    corresponding record from the logs record set.

    Thanks, I finally saw the errant white space character!

  • Whats Wrong with this query

    SAMPLE DATA
        CT_NO   RENT_NO DUE_DATE    DUE_AMT
         2233         1 11-SEP-06     11800
         2233         2 11-OCT-06     11800
         2233         3 11-NOV-06     11800
         2233         4 11-DEC-06     11800
         2233         5 11-JAN-07     11800
         2233         6 11-FEB-07     50000
         2233         7 11-MAR-07     11800
         2233         8 11-APR-07     11800
         2233         9 11-MAY-07     11800
         2233        10 11-JUN-07     11800
         2233        11 11-JUL-07     11800
         2233        12 11-AUG-07     50000
         2233        13 11-SEP-07     11800
         2233        14 11-OCT-07     11800
         2233        15 11-NOV-07     11800
         2233        16 11-DEC-07     11800
         2233        17 11-JAN-08     11800
         2233        18 11-FEB-08     50000
         2233        19 11-MAR-08     11800
         2233        20 11-APR-08     11800
         2233        21 11-MAY-08     11800
         2233        22 11-JUN-08     11800
         2233        23 11-JUL-08     11800
         2233        24 11-AUG-08     50000
         2233        25 11-SEP-08     11800
         2233        26 11-OCT-08     11800
         2233        27 11-NOV-08     11800
         2233        28 11-DEC-08     11800
         2233        29 11-JAN-09     11800
         2233        30 11-FEB-09     50000
         2233        31 11-MAR-09     11800
         2233        32 11-APR-09     11800
         2233        33 11-MAY-09     11800
         2233        34 11-JUN-09     11800
         2233        35 11-JUL-09     11800
         2233        36 11-AUG-09     50000
         2233        37 11-SEP-09     11800
         2233        38 11-OCT-09     11800
         2233        39 11-NOV-09     11800
         2233        40 11-DEC-09     11800
         2233        41 11-JAN-10     11800
         2233        42 11-FEB-10     50000
         2233        43 11-MAR-10     11800
         2233        44 11-APR-10     11800
         2233        45 11-MAY-10     11800
         2233        46 11-JUN-10     11800
         2233        47 11-JUL-10     11800
         2233        48 11-AUG-10     50000
    My QUERY
    select
    count(distinct(case when b.due_date <='15-feb-2010' then b.rent_no else 0  end))ovd_due,
    SUM(case when rcv_dt is null or RCV_DT>'15-feb-2010'
                     THEN due_amt
    else 0
                END) Rent_Bal
    from le_dues b
    where ct_no=2233
    my result from the query
      OVD_DUE  RENT_BAL
           43    159000here we can see tha OVE_DUE should be 42 but my query is returning 43....WHY
    please correct my query.

    Hi,
    It looks like 43 is the correct answer. The distinct values you are counting are all the integers from 0 through 42 inclusive.
    Don't compare DATEs to strings. For example
    when b.due_date <='15-feb-2010' is asking for trouble. Use TO_DATE or a DATE literal:
    when b.due_date <= DATE '2010-02-15' instead.
    If you don't want to count 0, don''t include 0 in the list of things to be counted.
    COUNT ( DISTINCT CASE
                   WHEN  b.due_date <= TO_DATE ( '15-feb-2010'
                                  , 'DD-Mon-YYYY'
                   AND   b.rent_no != 0     -- If needed (probably not; unclear from example)
                   THEN  b.rent_no
               END
          )     AS ovd_due,

  • What is wrong With My Query

    Pleas what is wrong with this query
         select h.business_unit_id bu, h.edi_sequence_id seq, d.edi_det_sequ_id dseq, s.edi_size_sequ_id sseq, h.po_number po, h.total_unit tUnit, h.total_amount tDollar, s.quantity qty, s.unit_price price,
    (select (case when count(*) = 0 then 'N' else 'Y' end)
    from(select s.business_unit_id, s.edi_sequence_id, s.edi_det_sequ_id, s.edi_size_sequ_id
    from sewn.nt_edii_purchase_size s
    where s.business_unit_id='01'
    and s.edi_sequence_id = '168420'
    and (s.edi_sequence_id, s.edi_det_sequ_id, s.edi_size_sequ_id) not in
    (select edi_sequence_id, edi_det_sequ_id, edi_size_sequ_id
    from sewn.nt_edii_po_det_error
    where business_unit_id = '01'
    and edi_sequence_id='168420'
    and error_code in(select error_code
    from sewn.nt_edii_error_codes
    where severity='CR'))))eligible
    from sewn.nt_edii_purchase_size s, sewn.nt_edii_purchase_det d,
    sewn.nt_edii_purchase_hdr h
    where h.business_unit_id = '01'
    and h.edi_sequence_id = '168420'
    and h.business_unit_id = d.business_unit_id
    and h.edi_sequence_id = d.edi_sequence_id
    and d.business_unit_id = s.business_unit_id
    and d.edi_sequence_id = s.edi_sequence_id
    and d.edi_det_sequ_id = s.edi_det_sequ_id
    group by h.business_unit_id, h.edi_sequence_id, d.edi_det_sequ_id,
    s.edi_size_sequ_id,h.po_number, h.total_unit, h.total_amount, s.quantity,s.unit_price

    Never mind, I got it working

  • Problem with this query

    Hi
    We are using this query
    SELECT ...........
    FROM TRIP JOIN TRIPEXTENSION ON TRIPEXTENSION.TRIPID = TRIP.TRIPID JOIN FOREIGNRECLOC ON FOREIGNRECLOC.TRIPID = TRIP.TRIPID JOIN CUSTSEGCONTROL ON CUSTSEGCONTROL.TRIPID = TRIP.TRIPID JOIN CUSTOMERCONTROL ON CUSTOMERCONTROL.CUSTOMERID = CUSTSEGCONTROL.CUSTOMERID JOIN CUSTOMER ON CUSTOMER.CUSTOMERID = CUSTSEGCONTROL.CUSTOMERID LEFT JOIN TRIPSEGMENT ON TRIPSEGMENT.TRIPSEGMENTID = CUSTSEGCONTROL.TRIPSEGMENTID LEFT JOIN TRIPSEGMENTEXTENSION ON (TRIPSEGMENTEXTENSION.TRIPSEGMENTID = TRIPSEGMENT.TRIPSEGMENTID AND TRIPSEGMENTEXTENSION.TRIPID = TRIP.TRIPID) LEFT JOIN TICKET ON CUSTOMERCONTROL.TICKETID = TICKET.TICKETID WHERE FOREIGNRECLOC.TRIPID IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) AND ((TRIP.STATUS <> ? AND (CUSTSEGCONTROL.DELETEDITEM = 0 OR CUSTSEGCONTROL.DELETEDITEM is null )) OR (TRIP.STATUS = ?)) AND TRIPEXTENSION.EOTTIME = CUSTSEGCONTROL.EOTTIME AND TRIPEXTENSION.EOTTIME = CUSTOMERCONTROL.EOTTIME AND TRIPEXTENSION.EOTTIME = TRIP.EOTTIME
    It is taking long time to execute and causing timeout. The columns used in where clause are as follows
    FOREIGNRECLOC.TRIPID - PRIMARY KEY
    TRIP.STATUS - NO INDEX/CONTAINS LOW CARDINALITY DATA
    CUSTSEGCONTROL.DELETEDITEM - NO INDEX/CONTAINS LOW CARDINALITY DATA
    TRIPEXTENSION.EOTTIME/CUSTSEGCONTROL.EOTTIME/CUSTOMERCONTROL.EOTTIME/TRIPEXTENSION.EOTTIME - NO INDEX/CONTAINS HIGH CARDINALITY DATA
    Our 'experts' said something 'seriously' wrong with this query. Can anyone provide any suggestion/observation on this?
    thanks and regards,
    SUMIT

    Hi Devid
    Thans for your response. The result of explain plan is
    SQL> SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation                        | Name                      | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                 |                           |     1 |   592 |    51   (8)|
    |   1 |  TABLE ACCESS BY INDEX ROWID     | FOREIGNRECLOC             |     1 |    16 |     1   (0)|
    |   2 |   NESTED LOOPS                   |                           |     1 |   592 |    51   (8)|
    |   3 |    NESTED LOOPS                  |                           |     1 |   576 |    50   (8)|
    |   4 |     NESTED LOOPS                 |                           |     1 |   569 |    50   (8)|
    |   5 |      NESTED LOOPS                |                           |     1 |   511 |    49   (9)|
    |   6 |       HASH JOIN                  |                           |     1 |   397 |    42  (10)|
    |   7 |        HASH JOIN                 |                           |    11 |  3443 |    36   (9)|
    |   8 |         HASH JOIN                |                           |    13 |  3588 |    29   (7)|
    |   9 |          HASH JOIN               |                           |   327 | 51339 |    10  (10)|
    |  10 |           TABLE ACCESS FULL      | TRIP                      |   270 | 17820 |     3   (0)|
    |  11 |           HASH JOIN              |                           |   327 | 29757 |     7  (15)|
    |  12 |            TABLE ACCESS FULL     | TRIPSEGMENT               |   123 |  9225 |     3   (0)|
    |  13 |            TABLE ACCESS FULL     | TRIPSEGMENTEXTENSION      |   327 |  5232 |     3   (0)|
    |  14 |          TABLE ACCESS FULL       | CUSTSEGCONTROL            |  3180 |   369K|    19   (6)|
    |  15 |         TABLE ACCESS FULL        | CUSTOMERCONTROL           |  2658 | 98346 |     6   (0)|
    |  16 |        TABLE ACCESS FULL         | CUSTOMER                  |   464 | 38976 |     5   (0)|
    |  17 |       TABLE ACCESS BY INDEX ROWID| TRIPEXTENSION             |     1 |   114 |     7   (0)|
    |  18 |        INDEX RANGE SCAN          | EXTENSION_TRIPID_FK_INDEX |     7 |       |     1   (0)|
    |  19 |      TABLE ACCESS BY INDEX ROWID | TICKET                    |     1 |    58 |     1   (0)|
    |  20 |       INDEX UNIQUE SCAN          | SYS_C0011530              |     1 |       |     0   (0)|
    |  21 |     INDEX UNIQUE SCAN            | SYS_C0011533              |     1 |     7 |     0   (0)|
    |  22 |    INDEX RANGE SCAN              | TRIPSEGEXT_TRIPID_INDEX   |     1 |       |     0   (0)|
    Note
       - 'PLAN_TABLE' is old version
    32 rows selected.thanks and regars,
    SUMIT

  • What's wrong with this ejb-query?

    Hi people,
    may be i worked too much, may be i've just missed something, but guys, can enyone tell me what the hell is wrong with this GOD DAMNED query?
    <ejb-ql>Select Object(adt) From AddrDataTable AS adt, IN (adt.addresseeQualities) AS aq WHERE adt.season.id = ?1 And aq.aQTemplate.id=?2</ejb-ql>
    That JBoss throws following exception:
    org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'Select Object(adt) From AddrDataTable AS adt, IN (adt.addresseeQualities) AS aq WHERE adt.season.id = ?1 And aq.aQTemplate.id=?2'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 103.
    Was expecting one of:
    "ABS" ...
    "LENGTH" ...
    "LOCATE" ...
    "SQRT" ...
    "+" ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <NUMERIC_VALUED_PARAMETER> ...
    <NUMERIC_VALUED_PATH> ...
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:50)
    The worst thing is that when i remove WHERE clause JBoss keeps silence like a fish - it works fine!
    So, any ideas about this?
    Thank you

    Are you sure the ?1 and ?2 parameters exist in the method for which the query is addressed.
    In the statement adt.season.id I guess season is a CMR field and then season has a CMP field called id
    and the same for aq.aQTemplate.id, aQTemplate being the CMR field and the is being a CMP field in the CMR.
    and in adt.addresseeQualities is a CMR field?
    Looks like a complex query
    SELECT OBJECT(adt) from BEAN AS adt,
    IN(adt.CMR_FIELD) AS aq
    WHERE
    adt.ANOTHER_CMR.ANOTHER_AMR_CMP_FIELD=?1
    AND
    aq.2_CMR_FIELD.2_CMP_FIELD =?2

  • Can someone tell me what's wrong with this LOV query please?

    This query works fine..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = 'ADAM'
    But this one..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = apex_application.g_user
    Gives the following error.
    1 error has occurred
    * LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Thanks very much,
    -Adam vonNieda

    Ya know, I still don't know what's wrong with this.
    declare
    l_val varchar2(100) := nvl(apex_application.g_user,'ADAM');
    begin
    return 'select filter_name display_value, filter_id return_value
    from otmgui_filter where username = '''|| l_val || '''';
    end;
    Gets the same error as above. All I'm trying to do is create a dropdown LOV which selects based on the apex_application.g_user.
    What am I missing here?
    Thanks,
    -Adam

  • What's wrong with this SQL?

    what's wrong with this SQL?
    Posted: Jan 16, 2007 9:35 AM Reply
    Hi, everyone:
    when I insert into table, i use the fellowing SQL:
    INSERT INTO xhealthcall_script_data
    (XHC_CALL_ENDED, XHC_SWITCH_PORT, XHC_SCRIPT_ID, XHC_FAX_SPECIFIED)
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N'
    FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION
    SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    I always got an error like;
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT,
    ERROR at line 3:
    ORA-00936: missing expression
    but I can't find anything wrong, who can tell me why?
    thank you so much in advance
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:38 AM in response to: jerrygreat Reply
    For starters, an insert select does not have a values clause.
    HTH -- Mark D Powell --
    PP
    Posts: 41
    From: q
    Registered: 8/10/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:48 AM in response to: mpowel01 Reply
    Even I see "missing VALUES" as the only error
    Eric H
    Posts: 2,822
    Registered: 10/15/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:54 AM in response to: jerrygreat Reply
    ...and why are you doing a UNION on the exact same two queries?
    (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:55 AM in response to: mpowel01 Reply
    Hi,
    thank you for your answer, but the problem is, if I deleted "values" as you pointed out, and then execute it again, I got error like "ERROR at line 3:
    ORA-03113: end-of-file on communication channel", and I was then disconnected with server, I have to relogin SQLplus, and do everything from beganing.
    so what 's wrong caused disconnection, I can't find any triggers related. it is so wired?
    I wonder if anyone can help me about this.
    thank you very much
    jerry
    yingkuan
    Posts: 1,801
    From: San Jose, CA
    Registered: 10/8/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:59 AM in response to: jerrygreat Reply
    Dup Post
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:00 AM in response to: Eric H Reply
    Hi,
    acturlly what I do is debugging a previous developer's scipt for data loading, this script was called by Cron work, but it never can be successfully executed.
    I think he use union for eliminating duplications of rows, I just guess.
    thank you
    jerry
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:03 AM in response to: yingkuan Reply
    Scratch the VALUES keyword then make sure that the select list matches the column list in number and type.
    1 insert into marktest
    2 (fld1, fld2, fld3, fld4, fld5)
    3* select * from marktest
    UT1 > /
    16 rows created.
    HTH -- Mark D Powell --
    Jagan
    Posts: 41
    From: Hyderabad
    Registered: 7/21/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:07 AM in response to: jerrygreat Reply
    try this - just paste the code and give me the error- i mean past the entire error as it is if error occurs
    INSERT INTO xhealthcall_script_data
    (xhc_call_ended, xhc_switch_port, xhc_script_id,
    xhc_fax_specified)
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE'
    UNION
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE';
    Regards
    Jagan
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 11:31 AM in response to: Jagan Reply
    Hi, Jagan:
    thank you very much for your answer.
    but when I execute it, I still can get error like:
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    so wired, do you have any ideas?
    thank you very much

    And this one,
    Aother question about SQL?
    I thought I already told him to deal with
    ORA-03113: end-of-file on communication channel
    problem first.
    There's nothing wrong (syntax wise) with the query. (of course when no "value" in the insert)

  • Do you see anything wrong with this GL mapping in a cube?

    hi,
    Can you verify if something is wring with this mapping:
    In model 1:
    0fi_gl_4 --> 0figl_O02 --> 0figl_C02
    the standard cube shows the following key figures and I mapped them to the following fields from the datasource:
    DMSOL(in datasource) to 0Debit_LC (in DSO) to 0Debit (in cube)
    DMHAB(in datasource) to 0Credit_LC (in DSO) to 0Credit (in cube)
    In model 2:
    0fi_gl_6 --> 0figl_C01
    the standard cube shows the following key figures and I mapped them to the following fields from the datasource:
    UMSOL(in datasource) to 0Debit (in cube)
    UMHAB(in datasource) to 0Credit (in cube)
    1. Do you see anything wrong with this mapping? And what is the solution?
    2. What is the problem with the mapping if both cubes sit under the same multiprovider, since 0debit and 0credit are from differnt souce fields?
    thnx

    Hi,
    Thanks for the explanation.
    on #1,
    if my goal is to provide a sort of trial balance, credits and debits as two columns, will it be ok to assume that it should be Local Currency or could it be Document Currency, Local Currency 2 or Local Currency 3? If the latter, then how do I decide?
    on #2,
    i. why will there be difficulty creating a union between the two?
    ii. will there also be an inconsistency if I created 2 separate multiproviders for each model, and create a jump query from the 0fi gl_6 model to 0fi gl_c4 model. If not, why not in this case?
    iii. So, is there any advantage in placing a multiprovider on each of these models separately? i.e. instead of directly reporting off the cubes separately?
    3. I am wondering why in the case of gl_6 (the totals) help.sap recomended to go directly from the datasource to the cube i.e. without DSO in between.
    If without the DSO step is an advantage, what are the advantages?
    And why then do we use DSOs in most model instead? I will appreciate any reasons you may think of..
    Thnx.
    Edited by: AmandaBaah on Jul 28, 2009 11:07 AM
    Edited by: AmandaBaah on Jul 29, 2009 2:25 AM

Maybe you are looking for

  • MSSQL JDBC driver missing for installation of NW '04 SR1

    Hi all, during the installation of NW '04 SR1/EP6 on a system running MSSQL Server 2000 SP4 SAPinst crashes with the following error: ERROR 2007-03-06 22:33:34 MDB-05800  <html>Cannot find jdbc driver for MS SQL Server</html> I searched this forum, t

  • View Footage from FCP to Sony HDR-HC7 Camera

    Hi all, I have final cut pro and a Sony HDR-HC7 camera with a SAMSUNG external monitor. I'm trying to view edited video from FCP to my camera then through HDMI to my SAMSUNG external monitor. I can't get this to work. This works fine through my DVDPR

  • How To Store XML Fragments Using Functions Such As XMLElement

    Hi Not sure what I am missing. I wish to store XML fragments in variables so can pass around and concatenate with other fragments to make final XML document. Even before attempting to concatenate XML fragments, I am struggling to store any XML fragme

  • What's the code to get the length of a File[]?

    I have an File array but i'm wondering to get the length of the array. anyone knows? Thx

  • Can i transfer the stuff off my ipod onto my new computer

    I have had to get a new computer as my old one broke and no longer works is there any way of getting the stuff off my ipod onto my new computer without losing what is currently on my ipod? All you help would be greatly appreciated