Case with where clause - ORA-00920: Invalid relational operator

Hi All, when I try to run the query below, I get the following error...
ORA-00920: invalid relational operator
00920. 00000 -  "invalid relational operator"
*Cause:   
*Action:
Error at Line: 16 Column: 5
Does anyone know what's wrong with my query? thanks in advance.
SELECT concat (year,period)
FROM DD_ACTUALS_FACT
WHERE CASE Period
WHEN 'JAN' THEN '01'
WHEN 'FEB' THEN '02'
WHEN 'MAR' THEN '03'
WHEN 'APR' THEN '04'
WHEN 'MAY' THEN '05'
WHEN 'JUN' THEN '06'
WHEN 'JUL' THEN '07'
WHEN 'AUG' THEN '08'
WHEN 'SEP' THEN '09'
WHEN 'OCT' THEN '10'
WHEN 'NOV' THEN '11'
WHEN 'DEC' THEN '12'
END as "MonthNo"
ORDER BY CONCAT (year,"MonthNo") DESC

The problem is the as "MonthNo" - you can't give an "AS" alias to an expression in a where clause.
You have not actually given any condition, just a set of translations from period into a number.
You also haven't said what you're trying to do.
Perhaps you want:
SELECT concat (year,period)
FROM DD_ACTUALS_FACT
WHERE something
ORDER BY CONCAT (year, CASE Period
WHEN 'JAN' THEN '01'
WHEN 'FEB' THEN '02'
WHEN 'MAR' THEN '03'
WHEN 'APR' THEN '04'
WHEN 'MAY' THEN '05'
WHEN 'JUN' THEN '06'
WHEN 'JUL' THEN '07'
WHEN 'AUG' THEN '08'
WHEN 'SEP' THEN '09'
WHEN 'OCT' THEN '10'
WHEN 'NOV' THEN '11'
WHEN 'DEC' THEN '12'
END  ) DESC

Similar Messages

  • Requesting help-On a report Getting ora-00920 invalid relational operator.

    Hi everyone,
    I am having a report region with the following query:
    select CASE
    WHEN ISITRECENTADDENDUM(meckey_fk,code)
    THEN
    '<a href="javascript:popUp2('''
                   || 'f?p=&APP_ID.:61:&SESSION.::NO::P61_MECKEY_FK:'
                   || &P60_MECKEY.
                   || ''', 700, 700);">'
    || '<img src="#IMAGE_PREFIX#gobut.gif">'
    || '</a>'
    ELSE NULL
    END EditAddendum,
    '<a href="javascript:popURL('''
                   ||'&REPORTS_URL.keynewmec&P_1=&P60_MECNUM.'
                   || ''', 700, 700);">'
    || '<img src="#WORKSPACE_IMAGES#printer.jpg">'
    || '</a>'
    PrintMEC,
    "CODE",
    "MECKEY_FK",
    "ADDENDUM",
    "WHO_CREATED",
    "WHEN_CREATED"
    from "C_ADDENDUMS"
    where "MECKEY_FK" = v('P60_MECKEY')
    And my function returning boolean is as follows:
    create or replace FUNCTION "ISITRECENTADDENDUM"
    (meckeyi in number,
    codei in varchar2)
    return Boolean
    is
    x varchar2(1);
    begin
    select max(code) into x from c_addendums where meckey_fk = meckeyi;
    if x = codei then
    return true;
    else
    return false;
    end if;
    exception
    when others then
    return FALSE;
    end;
    But I am getting ORA-00920 invalid relational operator. Can anyone please help me out? I am not knowing where the error is. When I run the function by itself I am getting "False" returned as expected. Appreciate any advice on this.
    Rgds,
    Suma.

    Suma,
    It looks like what you are trying to do is display a link for the record with the highest value in the Code column, and nothing for the other records.
    If that is the case, you can eliminate the function and just use a SQL query like this:
    (not tested)
    select CASE
              WHEN code = Max(code) over (partition by meckey_fk)
                 THEN
                   '<a href="#">'
                   || ' '
                   || '< img class="TargetAlertIcon" src="chrome://targetalert/content/skin/internal.png"></a>'
              ELSE NULL
           END EditAddendum,
           '<a href="#">'
           || ' '
           || '< img class="TargetAlertIcon" src="chrome://targetalert/content/skin/internal.png"></a>' PrintMEC,
           "CODE", "MECKEY_FK", "ADDENDUM", "WHO_CREATED", "WHEN_CREATED"
      from "C_ADDENDUMS"
    where "MECKEY_FK" = :P60_MECKEYIs that what you're trying to do?
    Doug

  • Error: ORA-00920: invalid relational operator (WWV-16016)

    Hi,
    When I try to query in the form, I'm getting the following error
    An unexpected error occurred: ORA-00920: invalid relational operator (WWV-16016).
    The form has a field of type varchar2 with lov attached to it. This error is happening only if I enter characters more than 40 or select a value which has more than 40 characters from the lov.
    Anbody had this problem?..Is there a solution for this?..Help would be appreciated.
    Thanks
    PJ

    I figured out the problem and it seems like if the value has any 'IN' or 'BETWEEN' and try to query this error is happening and it's not because of character length. I think Portal assumes that relational operator is entered and tries to query based on those words. Is it a bug in the Portal?..
    Thanks
    PJ

  • Using regexp_instr in a where clause - invalid relational operator

    Whey I try to run this query in TOAD I get an ORA-00920: invalid relational operator error. It's part of a 10g stored procedure. When I highlight it and run it it prompts me for the missing values and then the error pops up. The AND in line 4 is highlighted.
    select CRIME_CLASSIFICATION_ID, crime_type, nvl(count(CRIME_CLASSIFICATION_ID),0) as CRIMECNT
    From vaps.vw_offenses
        where  regexp_instr(valoc,to_char(location_id))
            AND ( fromdate is null or
             offense_date between to_date(fromdate, 'mm/dd/yyyy')  AND to_date(todate,'mm/dd/yyyy')
    group by crime_classification_id, crime_type

    Hi,
    Review what REGEXP_INSTR does: it returns a NUMBER.
    Your WHERE clause couldn't make any sense if you used any other kind of NUMBER expression in that place, e.g. a NUMBER literal such as 12:
    select CRIME_CLASSIFICATION_ID, crime_type, nvl(count(CRIME_CLASSIFICATION_ID),0) as CRIMECNT
    From vaps.vw_offenses
        where  12     -- This is obviously wrong
            AND ( fromdate is null or
             offense_date between to_date(fromdate, 'mm/dd/yyyy')  AND to_date(todate,'mm/dd/yyyy')
    group by crime_classification_id, crime_type
    It's not going to work any better with a function (like REGEXP_INSTR) that returns a NUMBER.
    How can you fix it?  That depends on what you want to do.  Why are you calling REGEXP_INSTR?  What is that condition checking?
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Invalid relational operator

    Hi,
    if I :
    create table t (a number, b number, c number);
    and then run the following query:
    delete from t where a='1' and (b, c) in (
    select b, c from t
    where a='1'
    group by b, c
    having count(*) > 1);
    -- nothing to see here
    I get the following error:
    ORA-00920: invalid relational operator
    If I remove the "-- nothing to see here" comment, the query runs fine.
    If I remove the quotes around the 1s it also runs fine, with or without the trailing comment.
    I had a look through the forum and couldn't see this listed anywhere, though I presume others have come across similar problems?
    I presume there is a simpler test case; I tried to reduce it a bit, but most of what is there seems to be needed to reproduce the error.
    Note that it doesn't have to be a comment following the query; any text at all will cause the same error.
    regards,
    William

    Having just played around a bit, if you change the subquery to just return a single column, say "b" rather than "b" and "c":
    delete from t where a='1' and b in (
    select b from t
    where a='1'
    group by b
    having count(*) > 1);
    -- nothing to see here
    Then I get error "ORA-00911: invalid character" instead.
    If I run the buffer as a script (F5) I get:
    SQL ERROR:ORA-00911: invalid character
    delete from t where a='1' and b in (
    select b from t
    where a='1'
    group by b
    having count(*) > 1);
    -- nothing to see here
    ORA-00911: invalid character
    In case that helps you locate it at all.
    Note: if I move the "group by" clause onto the where line then it runs correctly.
    regards,
    William
    Message was edited by:
    user454290

  • Export (expdp) with where clause

    Hello Gurus,
    I am trying to export with where clause. I am getting below error.
    Here is my export command.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Merge with where clause after matched and unmatched

    Hai,
    Can anybody give me one example of merge statement with
    where clause after matched condition and after the unmatched condition.
    MERGE INTO V1 VV1
    USING (SELECT     A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
    FROM V1 A,
    (SELECT                
    SUM(SUNITS) SUM_UNITS FROM V1 B                                   
    GROUP BY CNO) c
    WHERE
    A.DDATE=0 AND A.SUNITS <>0 AND
    A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
    ON (1=1)
    WHEN MATCHED THEN UPDATE SET
    VV1.SUNITS=XX.SUMMED
    WHERE XX.XXDD=0
    WHEN NOT MATCHED THEN INSERT
    (VV1.CNO, VV1.SUNITS, VV1.SUNITS)
    VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
    WHERE XX.XXDD<>0
    i am getting the error
    WHERE XX.XXDD=0
    ERROR at line 13:
    ORA-00905: missing keyword
    Thanks,
    Pal

    One of the example is there:
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
    What Oracle version do you use ?
    Besides the condition (1=1) is non-deterministic,
    I would expect there an exception like "unable to get a stable set of rows".
    Rgds.

  • Hierarchical query with where clause

    Hi,
    How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
    When I try with the following query,
    select id, level from relation
    where session_id = 79977
    connect by prior id = root_id start with id = 5042;
    It gets duplicate values.
    I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
    Thanks in Advance.
    Regards,
    -Parmy

    Hi Sridhar Murthy an others,
    Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
    Any way thanks for your reply,
    It's working for me.
    With happiness,
    -Parmy

  • Case in where clause

    Hello to everyone
    I have a select like as
    select
              where   (KPMERCE IS NULL AND KSMERCE IS NULL)
         UNION
              where   (KPMERCE IS NOT NULL AND KSMERCE IS NULL AND K_PMERCE = KPMERCE)
         UNION
              where   (KSMERCE IS NOT NULL AND K_PMERCE = KPMERCE AND K_SMERCE = KSMERCE)is possibile create a CASE in where clause, something as, So, i can write a single query,      
              CASE  (in where-clause)
              WHEN   (KPMERCE IS NULL AND KSMERCE IS NULL)                            
              WHEN   (KPMERCE IS NOT NULL AND KSMERCE IS NULL AND K_PMERCE = KPMERCE)
          WHEN   (KPMERCE IS NOT NULL AND KSMERCE IS NOT NULL AND K_PMERCE = KPMERCE AND K_SMERCE = KSMERCE)  so
    IF CONDITION IS SATISFYED RETURNs ROWS OTHERWISE NO ROWS
    Thanks in advance

    If your select lists are equal, then you can do it like this:
    where (  (KPMERCE IS NULL AND KSMERCE IS NULL)
           or (KPMERCE IS NOT NULL AND KSMERCE IS NULL AND K_PMERCE = KPMERCE)
           or (KSMERCE IS NOT NULL AND K_PMERCE = KPMERCE AND K_SMERCE = KSMERCE)
           )Regards,
    Rob.

  • Outer Join with Where Clause in LTS

    HI all,
    I have a requirement like this in ANSI SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
    and p2.product_group = 'NEW'
    In Regular SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1, product_group p2
    WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
    In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
    p2.product_group = 'NEW' in WHERE clause of LTS.
    This doesn't seem to solve purpose.
    Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
    product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
    I am using Version 10.1.3.4.1
    Creating an Opaque view would be my last option though.

    Hello
    I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
    Try this solution which worked for me (using your example ) -
    1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
    PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID  AND  PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL' 
    2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP  table and select Join Type as Left Outer Join.
    3. Check Consistency and make sure there are no errors .
    when you run a request you should see the following query generated -
    select distinct T26908.PROD_ID as c1,
         T26908.PROD_NAME as c2,
         T26912.GROUP_NAME as c3
    from
         PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
    order by c1, c2, c3
    Hope this works for you. If it does please mark this response as 'Correct' .
    Good Luck.

  • Insert with Where Clause

    Hi,
    Can we write Insert with 'Where' clause? I'm looking for something similar to the below one (which is giving me an error)
    insert into PS_AUDIT_OUT (AUDIT_ID, EMPLID, RECNAME, FIELDNAME, MATCHVAL, ERRORMSG)
    Values ('1','10000139','NAMES','FIRST_NAME',';','')
    Where AUDIT_ID IN
    (  select AUDIT_ID from PS_AUDIT_FLD where AUDIT_ID ='1' and RECNAME ='NAMES'
    AND FIELDNAME = 'FIRST_NAME' AND MATCHVAL = ';' );
    Thanks
    Durai

    It is not clear what are you trying to do, but it looks like:
    insert
      into PS_AUDIT_OUT(
                        AUDIT_ID,
                        EMPLID,
                        RECNAME,
                        FIELDNAME,
                        MATCHVAL,
                        ERRORMSG
    select  '1',
            '10000139',
            'NAMES',
            'FIRST_NAME',
      from  PS_AUDIT_FLD
      where AUDIT_ID = '1'
        and RECNAME ='NAMES'
        and FIELDNAME = 'FIRST_NAME'
        and MATCHVAL = ';'
    SY.

  • Populate list by executing query with where clause

    Hi,
    I m populating my list from database table using following command.
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("learning", new HashMap());
    EntityManager em = emf.createEntityManager();
    String query = "select d from Dept d";
    List list = em.createQuery(query).getResultList();
    My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string.
    String query = "select d from Dept d where d.dept_name='ANYNAME'";
    Moreover I cant select even indivisual columns by using following line
    String query = "select d.dept_code,d.dept_name from Dept d";
    It looks like that my query is getting all rows from table as Object.
    What to do to
    1. put some where clause
    2. get some particular colums instead of all columns
    3. apply some table joins in query
    plz help.

    Hi Alex,
    I misunderstood your question. You had mentioned "My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string. "
    I thought you might not have permissions to modify the code in the class, and that's why I suggested that you could write new classes.
    1) write new classes,? means if I need just two columns from a table >(instead of all columns), do I need to write new class with just two >columns (getters and setters)?You can write a SQL statement anyway you want , there are no restrictions in JDBC , so if you need just 2 columns you can write a custom query for that.
    "select column1 as a, column2 as be from table_name where column3 = xyz" etc.
    2) Is not anyway to write SQL statement like
    select dept_code,dept_name from dept where dept_name='anything'The above SQL is correct, it should work.
    3) Stored procedures? can I get some example(code) to get an idea >how to implement complex queries with where clause and joinings >using stored procedures?Stored procedures are specific to the database you are using, Oracle has a particular syntax for store procdures.
    You can call stored procedures from JDBC also, search on Google for
    "Calling stored procedures from JDBC"
    4) I m using hibernate. can I get any example of using hibernate own >query?Tutorial on Hibernate Query Language:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html

  • ORA-29283 invalid file operation

    NLSRTL      10.2.0.5.0     Production
    Oracle Database 10g Enterprise Edition      10.2.0.5.0     64bi
    PL/SQL      10.2.0.5.0     Production
    TNS for IBM/AIX RISC System/6000:      10.2.0.5.0     Productio
    I am trying to get the content of a trace file generated for me.
    Because I don't have privileges to log on the server and copy the trace file for me directly with some os user, I am doing the following:
    1. I alter my session trace identifier to easier identify the trace file
    ALTER SESSION SET TRACEFILE_IDENTIFIER = 'Func01';2. I invoke DBMS_MONITOR
    3. I run the procedure I want to monitor.
    4. I disable the monitoring by calling DBMS_MONITOR
    5. At this point I run the following query to identify my trace file:
    select u_dump.value || '/' || instance.value || '_ora_' || v$process.spid || nvl2(v$process.traceid, '_' || v$process.traceid, null ) || '.trc'"Trace File"
    from V$PARAMETER u_dump
    cross join V$PARAMETER instance
    cross join V$PROCESS
    join V$SESSION on v$process.addr = V$SESSION.paddr
    where 1=1
       and u_dump.name = 'user_dump_dest'
       and instance.name = 'instance_name'
       and V$SESSION.audsid=sys_context('userenv','sessionid');It gives me: /ORACLE/MYDB/trace/MYDB_ora_3616822_Func01.trc
    I have created directory in advanced on the path where the traces are stored:
    CREATE OR REPLACE DIRECTORY trace_dir AS '/ORACLE/MYDB/trace/';
    SELECT * FROM dba_directories WHERE directory_name = 'TRACE_DIR';
    Output:
    OWNER DIRECTORY_NAME DIRECTORY_PATH
    SYS     TRACE_DIR      /ORACLE/MYDB/trace/I don't have rights to grant read, write on TRACE_DIR to my user, as I am not logged with SYS.
    I created a table to store in it the lines from the trace file:
    CREATE TABLE tmp_traces_tab
      callnum NUMBER,
      line NUMBER,
      fileline CLOB
    );Then I run the following PL/SQL block to retrieve the content of the trace and store it in the table T:
    DECLARE
      l_file            UTL_FILE.file_type;
      l_location     VARCHAR2 (100) := 'TRACE_DIR';
      l_filename    VARCHAR2 (255) := 'MYDB_ora_3616822_Func01.trc';
      l_text           VARCHAR2 (32767);
      l_line           NUMBER := 1;
      l_call           NUMBER := 1;
    BEGIN
      -- Open file.
      l_file := UTL_FILE.fopen (l_location, l_filename, 'r', 32767);
      -- Read and output first line.
      UTL_FILE.get_line (l_file, l_text, 32767);
      INSERT INTO tmp_traces_tab (callnum, line, fileline) VALUES (l_call, l_line, l_text);
      l_line := l_line + 1;
      BEGIN
        LOOP
          UTL_FILE.get_line (l_file, l_text, 32767);
           INSERT INTO tmp_traces_tab (callnum, line, fileline) VALUES (l_call, l_line, l_text);
           l_line := l_line + 1;
        END LOOP;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          NULL;
      END;
      INSERT INTO tmp_traces_tab (callnum, line, fileline) VALUES (l_call, l_line, l_text);
      l_line := l_line + 1;
      UTL_FILE.fclose (l_file);
    END;
    /And when I run the code I get the error: ORA-29283 invalid file operation.
    Is it possible to a role my user to be able to get the content of the trace files in the directory TRACE_DIR without having explicit READ , WRITE privileges on it?
    My user currently has these roles:
    select * from dba_role_privs where grantee = USER;
    Output:
    U1     OPR_ROLE_LOSS_SNAPSHOT_READER     YES     YES
    U1     RESOURCE     NO     YES
    U1     CONNECT     NO     YES
    U1     DBA     NO     YES
    U1     OPR_ROLE_SUPPORT_USER     YES     YESI know that on another db with different user I hit no errors when doing completely the same (of course the program unit I monitor is different).
    That other user with which I have NO issues has these roles:
    select * from dba_role_privs where grantee = USER;
    Output:
    U2    DBA    NO    YES
    U2    EXEC_SYS_PACKAGES_ROLE    NO    YES
    U2    EXECUTE_CATALOG_ROLE    NO    YES
    U2    CONNECT    NO    YES

    Verdi wrote:
    NLSRTL      10.2.0.5.0     Production
    Oracle Database 10g Enterprise Edition      10.2.0.5.0     64bi
    PL/SQL      10.2.0.5.0     Production
    TNS for IBM/AIX RISC System/6000:      10.2.0.5.0     Productio
    And when I run the code I get the error: ORA-29283 invalid file operation.
    Is it possible to a role my user to be able to get the content of the trace files in the directory TRACE_DIR without having explicit READ , WRITE privileges on it?
    My user currently has these roles:
    select * from dba_role_privs where grantee = USER;
    Output:
    U1     OPR_ROLE_LOSS_SNAPSHOT_READER     YES     YES
    U1     RESOURCE     NO     YES
    U1     CONNECT     NO     YES
    U1     DBA     NO     YES
    U1     OPR_ROLE_SUPPORT_USER     YES     YESI know that on another db with different user I hit no errors when doing completely the same (of course the program unit I monitor is different).
    Thanks for posting version alongwith other details.
    TO my knowledge, No you cannot.
    Privileges acquired via a Role are not valid in PL/SQL. You need to have explicit privileges.

  • ORA-30511: invalid DDL operation in system triggers

    Hi,
    I am calling a procedure in a Trigger.
    In that Procedure EXECUTE IMMEDIATE is used to CREATE a table.
    But when The Trigger is firing its giving Error as :ORA-30511: invalid DDL operation in system triggers
    Kindly any help will be needful for me

    user598986 wrote:
    Hi,
    I am calling a procedure in a Trigger.
    In that Procedure EXECUTE IMMEDIATE is used to CREATE a table.
    But when The Trigger is firing its giving Error as :ORA-30511: invalid DDL operation in system triggers[I thought I already explained it|http://forums.oracle.com/forums/message.jspa?messageID=3379456#3379683]. And again, granting privileges dynamically in a logon trigger is a very bad design. If you want to stick to it, you could schedule a job in trigger, as Timur suggested, however keep in mind, job runs asynchronously, so trigger will have to wait for the job to finish. Otherwise there might be a gap where session would not have privs granted yet.
    SY.

  • Can we use Case in Where Clause along with Exists

    Hi Everybody,
    Can we use Case in the where clause with exists? As i have a requirement in which i have to check whether value exists in 6 views, now depending on some value(gns_type )of select clause i have to attach a paticular exists else the performance dies.
    Please go through the query any suggestion appreciated.
    Thanks
    SELECT count(*)
    FROM
    (SELECT eah.changed_date,
    decode(eua.is_deleted, 'N', decode(eah.alert_type, NULL, 'GN', 'R', 'GAR', 'G', 'GAG', 'Y', 'GAY'), 'Y', decode(eah.alert_type, 'R', 'GDR', 'G', 'GDG', 'Y', 'GDY', NULL, 'GN'), NULL, 'GN') AS
    alert_type,
    decode(eac.pta_line, 'N', '') ptaline,
    eac.exp_type_desc,
    eac.supplier_name,
    eac.transaction_id,
    eah.gns_type,
    eac.po_amount,
    eac.po_end_date,
    eah.notes,
    eua.is_deleted,
    eac.expenditure_type,
    eua.gns_alert_summary_id,
    eah.changed_date alert_date,
    eua.user_alert_id,
    eah.reference_number,
    decode(eac.cms_pta_line,'N','',eac.cms_pta_line) cms_pta_line,
    cms_po_amount,
    cms_po_end_date,
    mgns.is_decommitted,
    eac.gns_alert_id,
    eah.gns_type source_name
    FROM xxdl.xxdl_sc_gns_alerts_summary eah,
    xxdl.xxdl_sc_gns_detail_alerts eac,
    xxdl.xxdl_sc_gns_user_alerts eua,
    xxdl.xxdl_sc_manage_gns_master mgns
    WHERE eah.gns_alert_summary_id = eac.gns_alert_summary_id
    AND eah.gns_alert_summary_id = eua.gns_alert_summary_id
    AND eah.transaction_id = eac.transaction_id
    AND eah.transaction_id = mgns.transaction_id)
    a
    WHERE(EXISTS
    (SELECT 1
    FROM xxdl_sc_mng_gns_pta_req_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS( SELECT 1
    FROM xxdl_sc_mng_gns_pta_inv_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS(SELECT 1
    FROM xxdl_sc_mng_gns_pta_req_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS(SELECT 1
    FROM xxdl_sc_mng_gns_pta_inv_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS( SELECT 1
    FROM xxdl_sc_mng_gns_pta_po_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS (SELECT 1
    FROM xxdl_sc_mng_gns_pta_po_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    AND TRUNC(alert_date) >= TRUNC(add_months(sysdate, -1))
    AND TRUNC(alert_date) <= TRUNC(sysdate)
    AND is_deleted = 'N'
    ORDER BY changed_date DESC

    you can do
    WHERE
    CASE WHEN (something) THEN
      CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END
               WHEN (something else) THEN
         CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END      
    END = 1Looking at your current query, it looks like all those exist statements could be a lot neater, maybe like:
    WHERE (69309,242528,34694) IN
    (SELECT project_id,task_id,award_id FROM
      (Select project_id,task_id,award_id,transaction_id,source_name
      FROM
      xxdl_sc_mng_gns_pta_req_hc_v
      UNION ALL
      Select project_id,task_id,award_id
      xxdl_sc_mng_gns_pta_inv_hc_v
      ...) x
    where a.transaction_id = x.transaction_id
    and a.source_name = x.source_name
    )or put the tuple in the where clause at the bottom

Maybe you are looking for

  • Adobe Premiere CC crashes on startup on windows 7

    I have a HP Pavilion DV6t. it is windows 7 and has 8gb of ram, and an nvidia graphics processor. I have just reset my system after a hdd failure and on that hdd it worked perfectly every time. On my new hard drive, I still have windows 7, same driver

  • OUT OF MEMORY - during loading images (JPEG's)

    Hallo, We use the OHJ (version 4.1.12) inside a Java/Swing application with JDK 1.3.1. Our online help contains a lot of larger JPEG images. When the user navigates through the online help - an out of memory occurs while loading the images. I tried t

  • IPod Touch 2G + iPod Photo docking station

    I have an iPod Photo docking station connected to my iMac via USB. Are there any issues with using ipod photo dock with ipod touch 2g? I'm only interested in recharging and syncing and not using the s-video or line out ports.

  • How to select outgoing server automatically?

    The code below is part of Apple Mail templates. Where you see the "Trial", this is a code that automatically writes Trial into the subject line of an email when using this template. I have several accounts with outgoing servers. How can I put in the

  • How to run two thread parallel y on two cores of dual-core ??

    I want to run two threads on two cores ??? is there any package which support parallel computing?? can we do this by using java.util.concurrency pakage?? Thanks you please Reply.....