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

Similar Messages

  • 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

  • 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

  • I am getting "ORA-00900: invalid SQL statement"  error.?

    I did installed oracle 11gR2. and used "DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','USER1','USER2')"   to see the result like below,  but I am getting "ORA-00900: invalid SQL statement"  error.   Any idea?
    I am using:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> desc user1.tbl_a
    Name                                      Null?    Type
    FIELD_A1                                  NOT NULL NUMBER
    FIELD_A2                                           VARCHAR2(20)
    FIELD_A4                                  NOT NULL NUMBER(5,2)
    FIELD_A5                                           VARCHAR2(10)
    FIELD_A6                                  NOT NULL NUMBER(2)
    SQL> desc user2.tbl_a
    Name                                      Null?    Type
    FIELD_A1                                  NOT NULL NUMBER
    FIELD_A2                                           VARCHAR2(50)
    FIELD_A3                                           DATE
    FIELD_A4                                           NUMBER(5,2)
    FIELD_A5                                  NOT NULL VARCHAR2(10)
    SQL> select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','USER1','USER2') from dual
    expected result:
    DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','U1','U2')
    ALTER TABLE "U1"."TBL_A" ADD ("FIELD_A3" DATE)
      ALTER TABLE "U1"."TBL_A" DROP ("FIELD_A6")
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A2" VARCHAR2(50))
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2) DEFAULT 0)
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NULL)
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A5" NOT NULL ENABLE)

    Thanks for reply rp,
    I got result using "select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','USER1','USER2') from dual"

  • 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.

  • Help!! iternmittently getting ORA-12560. Here is a snipset..

    Hello..
    i have MS com+ objects which are calling stored procedures simultaneously and rapidly and
    intermittently getting ORA-12560. TNS Protocol Adapter
    error. here is a snippset of trace log..
    please give me comments to solve this problem
    =========================================================
    (6600) nigini: entry
    (6600) nigini: Count in NI global area now: 1
    (6600) nigini: Count in NI global area now: 1
    (6600) nrigbi: entry
    (6600) nrigbni: entry
    (6600) nrigbni: Unable to get data from navigation file tnsnav.ora
    (6600) nrigbni: exit
    (6600) nrigbi: exit
    (6600) nigini: exit
    (6600) niqname: Hst is already an NVstring.
    (6600) niqname: Inserting CID.
    (6600) niotns: entry
    (6600) niotns: niotns: setting up interrupt handler...
    (6600) snsbitini_ts: entry
    (6600) snsbitini_ts: normal exit
    (6600) snsbitcl_ts: entry
    (6600) snsbitcl_ts: normal exit
    (6600) snsbitini_ts: entry
    (6600) snsbitini_ts: normal exit
    (6600) niotns: Not trying to enable dead connection detection.
    (6600) niotns: Calling address: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.99.117)(PORT=1521)))(CONNECT_DATA=(SID=ESCROW0)(SERVICE_NAME=ESCROW0)(CID=(PROGRAM=C:\WINNT\system32\dllhost.exe)(HOST=MATDEV)(USER=Administrator))))
    (6600) nscall: entry
    (6600) nsmal: entry
    (6600) nsmal: 164 bytes at 0x319fba8
    (6600) nsmal: normal exit
    (6600) nscall: connecting...
    (6600) nladini: entry
    (6600) nladini: exit
    (6600) nladget: entry
    (6600) nladget: exit
    (6600) nsc2addr: entry
    (6600) nttbnd2addr: entry
    (6600) nttgetport: entry
    (6600) nttgetport: port resolved to 1521
    (6600) nttgetport: exit
    (6600) nttbnd2addr: using host IP address: 192.168.99.117
    (6600) nttbnd2addr: exit
    (6600) nsc2addr: normal exit
    (6600) nsopen: entry
    (6600) nsmal: entry
    (6600) nsmal: 492 bytes at 0x3197008
    (6600) nsmal: normal exit
    (6600) nsopenmplx: entry
    (6600) nsmal: entry
    (6600) nsmal: 2348 bytes at 0x3194f30
    (6600) nsmal: normal exit
    (6600) snsbitini_ts: entry
    (6600) snsbitini_ts: normal exit
    (6600) snsbitts_ts: entry
    (6600) snsbitts_ts: acquired the bit
    (6600) snsbitts_ts: normal exit
    (6600) snsbitcl_ts: entry
    (6600) snsbitcl_ts: normal exit
    (6600) nsopenmplx: normal exit
    (6600) nsopen: opening transport...
    (6600) nttcon: entry
    (6600) nttcon: toc = 1
    (6600) nttcnp: entry
    (6600) ntvlin: entry
    (6600) ntvllt: entry
    (6600) ntvllt: tcp.validnode_checking not turned on
    (6600) ntvllt: exit
    (6600) ntvlin: exit
    (6600) nttcnp: Validnode Table IN use; err 0x0
    (6600) nttcnp: creating a socket.
    (6600) nttcnp: exit
    (6600) nttcni: entry
    (6600) nttcni: trying to connect to socket 10093.
    (6600) ntt2err: entry
    (6600) ntt2err: soc 10093 error - operation=1, ntresnt[0]=530, ntresnt[1]=93, ntresnt[2]=0
    (6600) ntt2err: exit
    (6600) nttcni: exit
    (6600) nttcon: exit
    (6600) nserror: entry
    (6600) nserror: nsres: id=0, op=65, ns=12560, ns2=0; nt[0]=530, nt[1]=93, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
    (6600) snsbitts_ts: entry
    (6600) snsbitts_ts: acquired the bit
    (6600) snsbitts_ts: normal exit
    (6600) snsbitcl_ts: entry
    (6600) snsbitcl_ts: normal exit
    (6600) nsopen: unable to open transport
    (6600) snsbitts_ts: entry
    (6600) snsbitts_ts: acquired the bit
    (6600) snsbitts_ts: normal exit
    (6600) snsbitcl_ts: entry
    (6600) snsbitcl_ts: normal exit
    (6600) snsbittrm_ts: entry
    (6600) snsbittrm_ts: normal exit
    (6600) snsbitts_ts: entry
    (6600) snsbitts_ts: acquired the bit
    (6600) snsbitts_ts: normal exit
    (6600) snsbitcl_ts: entry
    (6600) snsbitcl_ts: normal exit
    (6600) nsbfr: entry
    (6600) nsbfr: normal exit
    (6600) nsbfr: entry
    (6600) nsbfr: normal exit
    (6600) nsmfr: entry
    (6600) nsmfr: 2348 bytes at 0x3194f30
    (6600) nsmfr: normal exit
    (6600) nsmfr: entry
    (6600) nsmfr: 492 bytes at 0x3197008
    (6600) nsmfr: normal exit
    (6600) nsopen: error exit
    (6600) nsclose: entry
    (6600) nsclose: normal exit
    (6600) nladget: entry
    (6600) nladget: exit
    (6600) nsmfr: entry
    (6600) nsmfr: 164 bytes at 0x319fba8
    (6600) nsmfr: normal exit
    (6600) nladtrm: entry
    (6600) nladtrm: exit
    (6600) nscall: error exit
    (6600) nioqper: error from nscall
    (6600) nioqper: nr err code: 0
    (6600) nioqper: ns main err code: 12560
    (6600) nioqper: ns (2) err code: 0
    (6600) nioqper: nt main err code: 530
    (6600) nioqper: nt (2) err code: 93
    (6600) nioqper: nt OS err code: 0
    (6600) niomapnserror: entry
    (6600) niqme: entry
    (6600) niqme: reporting NS-12560 error as ORA-12560
    (6600) niqme: exit
    (6600) niomapnserror: returning error 12560
    (6600) niomapnserror: exit
    (6600) niotns: Couldn't connect, returning 12560
    (6600) niotns: exit
    (6600) snsbittrm_ts: entry
    (6600) snsbittrm_ts: normal exit
    (6600) snsbittrm_ts: entry
    (6600) snsbittrm_ts: normal exit
    (6600) nsbfrfl: entry
    (6600) nsbfrfl: normal exit
    (6600) nigtrm: Count in the NI global area is now 0
    (6600) nrigbd: entry
    (6600) nrigbd: exit
    (6600) nigtrm: Count in the NL global area is now 0

    which version of oracle are you using?
    If you are using, 8.1.6 , then you would be hitting bug.892253.
    For more info. read metalink Note:21490.1.

  • Getting ORA-01017: invalid username/password error only with specific tools

    Hi,
    I am a Junior DBA still getting familiar with Oracle. I am having trouble accessing one of my databases through both TOAD and SQLDetective tools. When I try to log in to my database using these tools, I get the error:
    ORA - 01017: invalid username/password; login denied
    Even though the password and username is correct.
    I can successfully login through other tools like SQLTools and through SQL Plus. I have searched this issue and I have seen people with the same problems but I couldnt find a solution. The weird thing is, I can use TOAD and SQLDetective to login to other databases without any issues. It seems to be this one specific database.
    My database is an 11g database on a linux box. I have 9i and 10g clients installed on my machine. The all my apps use the tnsnames from the 9i home on my machine.
    Any help on this would be greatly appreciated. Thanks.
    Rgs,
    Rob
    Edited by: rgilligan on 16-Apr-2010 02:11

    Hello, if it is 11g, look at the parameter sec_case_sensitive_logon. This parameter defaults to true, which makes the password case sensitive. Some tools/apps do a UPPER or LOWER on the password and so this may the reason for the error
    Henner

  • Getting ora:00904 invalid indentifier error while running i query

    Hi,
    I have a remote database and local database both are oracle 10gR2.Now i have written the below mentioned query in my local database and is working fine,but in case remote database it is throughing error ora:00904 invalid indentifier.
    I had export the dump from remote db and import it on my local db and i tried the same and it is working fine on local after that also.
    As i believe that this error usually come for column name not exist or column name or it's length or for any special character in column name of the table.But as i said it is working fine on local db but not in remote db though i am using the same dump for local and remote.
    Though when i am querying the table i can able to fetch data for the any record but when i am using the below mentioned query for the same i am getting the error.As i am doing this to fecth the data for child parent related relationship.
    Can any one suggest is there anything related to configaration or something else.
    Please do let me know if you do want some more information on the query what i am doing inside of it.
    Rgds,
    Anit
    Edited by: Anit A. on Sep 1, 2008 2:32 AM
    Edited by: Anit A. on Sep 1, 2008 2:33 AM

    WITH t
    AS
    SELECT decode(t.spnlevel
    ,3,t.u_quotesdtlid
    ,2,decode((select count(*)
    from u_quotesdtl t2
    where t2.u_quotesdtlid = t.u_quotesdtlid
    and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
    ),0,(select t1.u_quotesdtlid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '3'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ),t.u_quotesdtlid
    ,1,decode((select count(*)
    from u_quotesdtl t2
    where t2.QUOTEID = t.QUOTEID
    and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
    ),0,t.u_quotesdtlid,decode((select count(*)
    from u_quotesdtl t3
    where t3.QUOTEID = t.QUOTEID
    and t3.parentspn = (t3.jobgroupid||':'||t3.jobtype)
    and t3.u_quotesdtlid in (select t1.u_quotesdtlid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '2'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ),0,(select t4.u_quotesdtlid
    from u_quotesdtl t4
    ,(select t1.parentspn
    ,t1.jobtype
    ,t1.jobgroupid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '2'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ) t5
    where t4.spnitemcode = t5.parentspn
    and t4.spnlevel = '3'
    and t4.jobtype = t5.jobtype
    and t4.jobgroupid = t5.jobgroupid
    and t4.QUOTEID = t.QUOTEID
    (select t1.u_quotesdtlid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '2'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ,null,t.u_quotesdtlid) as parentquoteid
    ,t.u_quotesdtlid as quotesdtlid
    ,t.spnlevel as spnlevel
    FROM u_quotesdtl t
    WHERE t.QUOTEID ='som key id'
    ORDER BY parentquoteid,t.spnlevel desc
    select * from t;

  • Getting ORA-01722 - Invalid number error in SQL

    I am trying to run a query like
    SELECT NVL (ic.industryclassdesc, 'NULL') industryclass,
    NVL (hci.updated_by, 'NULL') updatedby,
    NVL (hci.operation, 'NULL') operation,
    hci.audittimestamp audittimestamp
    FROM xxx_company_inxxxx hci, xxx_industry ic
    WHERE hci.company_id = 9079496
    AND ic.industryclassid = hci.industryclass_id
    ORDER BY DECODE (hci.operation, 'D', 'X', hci.operation), hci.audittimestamp
    And getting the error - ORA-01722 - Invalid number.
    But the columns - ic.industryclassid, hci.industryclass_id and also hci.company_id are 'Number' datatype and also not nullable.
    Can anyone suggest a approch

    SELECT NVL (ic.industryclassdesc, 'NULL')
    > industryclass,
    NVL (hci.updated_by, 'NULL') updatedby,
    NVL (hci.operation, 'NULL') operation,
    hci.audittimestamp audittimestamp
    xxx_company_inxxxx hci, xxx_industry ic
    WHERE hci.company_id = 9079496
    AND ic.industryclassid = hci.industryclass_id
    BY DECODE (hci.operation, 'D', 'X', hci.operation),
    hci.audittimestamp
    And getting the error - ORA-01722 - Invalid number.
    Do not enter 'String' in the nvl function,if the column is number datatype,
    venki
    null

  • Htmldb_item.select_list_from_query-report error: ORA-01722: invalid number

    Hi, i am trying to create a tabular form
    with one of the item's value depending on another item's value, but i have an ORA-01722: invalid number error
    my application is:
    DESC AC6LIS
    ACLIS_SEQ_ID NOT NULL NUMBER(10)
    ACLIS_TSG_ID NOT NULL VARCHAR2(5)
    ACLIS_EDZ_ID NOT NULL VARCHAR2(3)
    DESC VE1EDZ
    EDZ_TSG_ID NOT NULL VARCHAR2(5)
    EDZ_ID NOT NULL VARCHAR2(3)
    EDZ_DESCRIZ VARCHAR2(50)
    select ACLIS_TSG_ID, htmldb_item.select_list_from_query(2,ACLIS_EDZ_ID,'select EDZ_DESCRIZ, EDZ_ID from ve1edz where ve1edz.EDZ_TSG_ID ='||ac6lis.ACLIS_TSG_ID) edz_select_list from ac6lis
    Any Help?
    Thans in advance
    Costantino

    When your inner SELECT statement is firing it is doing a type conversion. It is seeing a number value in 'ac6lis.ACLIS_TSG_ID' and trying to do a number comparison with 've1edz.EDZ_TSG_ID'. 've1edz.EDZ_TSG_ID' has a non-numeric value in one of the rows which results in your error. To correct this place quotes around the value of 'ac6lis.ACLIS_TSG_ID' like:
    select ACLIS_TSG_ID,
           htmldb_item.select_list_from_query(2,ACLIS_EDZ_ID,'select EDZ_DESCRIZ, EDZ_ID from ve1edz where ve1edz.EDZ_TSG_ID ='''||ac6lis.ACLIS_TSG_ID||'''') edz_select_list
      from ac6lisMike

  • Getting ORA-00903:invalid table name with both system and table owner

    Hi All,
    Oracle version 9.2
    I'm trying to retrieve some information from a few tables and import them to Excel. I haven't got much idea about ORACLE, but I'm not able to do anything.
    I open SQL PLus, and use CONNECT SYSTEM/[email protected] AS SYSDBA
    The console shows connected.
    I use select table_name,owner from dba_tables where owner='USER1';
    I can see the tables I want to access in the output.
    I do select * from USER1.TABLE1 and also tried with select * from TABLE1, both return ORA-00903:invalid table
    I also tried to connect with "CONNECT USER1/[email protected]" also shows connected, but then same error ORA-00903:invalid table
    Could anyone guide me so I can find out whats going on wrong??
    Thanks.. Best regards!

    Great! this worked! At least now I know I can read the data.
    Now I would like to get the data from this table into Excel 2007, but I can't install Office in the ORACLE server, so I have setup my client computer (Windows 2003 server with Excel 2007).
    I installed the ORACLE ODBC driver, and put the TNSName.ora file into the network admin folder.
    I successfully create the ODBC connector, and try connection is successfull. However, when I try to get the data, Excel send an error saying that it cannot list the tables!
    Anyway, any simple solution will do. If there is an easy way of making ORACLE create for example a CSV file with all the data from the table it will be good as well. What would be the easiest way?

  • Getting ORA-00911: invalid character error in the func ?

    CREATE OR REPLACE FUNCTION f_get_oibt_value(argin_rollent IN VARCHAR2,
    argin_rollsubent IN VARCHAR2,
    argin_legalORdervied IN CHAR,
    argin_year IN VARCHAR2,
    argin_currmtd IN VARCHAR2)
    RETURN NUMBER AS
    ln_oibt_value NUMBER;
    ln_oibt_l_value NUMBER;
    ls_acct_id VARCHAR2(10);
    sql_stmt VARCHAR2(2999);
    BEGIN
    -- dbms_output.enable(9999);
    IF UPPER(argin_legalOrdervied) = 'L' THEN
    ls_acct_id := 'OIBT-L';
    ELSE
    ls_acct_id := 'OIBT-D';
    END IF;
    sql_stmt := 'SELECT SUM (NVL (DECODE (yr, ''' || argin_year || ''', avg_ytd_' || argin_currmtd || ', 0), 0)) ';
    sql_stmt := sql_stmt || 'FROM ma_temp_local ';
    sql_stmt := sql_stmt || 'WHERE roll_ent = :argin_rollent '; --(Input argument)
    sql_stmt := sql_stmt || 'AND roll_sub_ent = :argin_rollsubent '; --(Input argument)
    sql_stmt := sql_stmt || 'AND ent NOT IN (''817'', ''PSP'') ';
    sql_stmt := sql_stmt || 'AND acct_id = ''legal'' '; --Fixed
    sql_stmt := sql_stmt || 'AND acct = :ls_acct_id '; --Fixed
    sql_stmt := sql_stmt || 'AND rel_type = '' '' '; --Fixed
    sql_stmt := sql_stmt || 'AND acct_lvl <= ''0'' '; --Fixed
    sql_stmt := sql_stmt || 'AND yr = :argin_year '; --(Input argument)
    sql_stmt := sql_stmt || 'AND rec_type = ''A'' '; -- Fixed
    sql_stmt := sql_stmt || 'AND product_code = ''ALL'' '; -- Fixed
    sql_stmt := sql_stmt || 'AND segment_code = ''ALL'' '; -- Fixed
    sql_stmt := sql_stmt || 'GROUP BY roll_ent, roll_sub_ent;';
    --dbms_output.put_line(sql_stmt);
    EXECUTE IMMEDIATE sql_stmt
    INTO ln_oibt_l_value
    USING argin_rollent, argin_rollsubent, ls_acct_id, argin_year;
    RETURN ln_oibt_value;
    END f_get_oibt_value;
    getting below errors..
    ORA-00911: invalid character
    ORA-06512: at "F_GET_OIBT_VALUE", line 36
    ORA-06512: at line 3

    Are You Getting the error while creating the function or while excuting it
    SQL>CREATE OR REPLACE FUNCTION f_get_oibt_value(argin_rollent IN VARCHAR2,
    2 argin_rollsubent IN VARCHAR2,
    3 argin_legalORdervied IN CHAR,
    4 argin_year IN VARCHAR2,
    5 argin_currmtd IN VARCHAR2)
    6 RETURN NUMBER AS
    7
    8 ln_oibt_value NUMBER;
    9
    10 ln_oibt_l_value NUMBER;
    11 ls_acct_id VARCHAR2(10);
    12 sql_stmt VARCHAR2(2999);
    13
    14 BEGIN
    15 -- dbms_output.enable(9999);
    16 IF UPPER(argin_legalOrdervied) = 'L' THEN
    17 ls_acct_id := 'OIBT-L';
    18 ELSE
    19 ls_acct_id := 'OIBT-D';
    20 END IF;
    21
    22 sql_stmt := 'SELECT SUM (NVL (DECODE (yr, ''' || argin_year || ''', avg_ytd_' || argin_currmtd || ', 0), 0)) ';
    23 sql_stmt := sql_stmt || 'FROM ma_temp_local ';
    24 sql_stmt := sql_stmt || 'WHERE roll_ent = :argin_rollent '; --(Input argument)
    25 sql_stmt := sql_stmt || 'AND roll_sub_ent = :argin_rollsubent '; --(Input argument)
    26 sql_stmt := sql_stmt || 'AND ent NOT IN (''817'', ''PSP'') ';
    27 sql_stmt := sql_stmt || 'AND acct_id = ''legal'' '; --Fixed
    28 sql_stmt := sql_stmt || 'AND acct = :ls_acct_id '; --Fixed
    29 sql_stmt := sql_stmt || 'AND rel_type = '' '' '; --Fixed
    30 sql_stmt := sql_stmt || 'AND acct_lvl <= ''0'' '; --Fixed
    31 sql_stmt := sql_stmt || 'AND yr = :argin_year '; --(Input argument)
    32 sql_stmt := sql_stmt || 'AND rec_type = ''A'' '; -- Fixed
    33 sql_stmt := sql_stmt || 'AND product_code = ''ALL'' '; -- Fixed
    34 sql_stmt := sql_stmt || 'AND segment_code = ''ALL'' '; -- Fixed
    35 sql_stmt := sql_stmt || 'GROUP BY roll_ent, roll_sub_ent;';
    36 --dbms_output.put_line(sql_stmt);
    37 EXECUTE IMMEDIATE sql_stmt
    38 INTO ln_oibt_l_value
    39 USING argin_rollent, argin_rollsubent, ls_acct_id, argin_year;
    40
    41
    42 RETURN ln_oibt_value;
    43
    44 END f_get_oibt_value;
    45 /
    Function created.
    SQL>drop function f_get_oibt_value;
    Function dropped.
    SQL>

  • Proxy connections getting ORA-01001: invalid cursor

    All,
    I am having tremendous difficulty using Oracle proxy connections under WebSphere 5.1. The problem appears to be that the proxy sessions (or the logical connections) are not being closed properly resulting in 'invalid cursor' and 'fetch out of sequence' exceptions.
    Here's the sequence of events:
    Environment
    AppServer : Websphere 5.1
    Database : Oracle 10gR2
    Datesource: oracle.jdbc.pool.OracleConnectionPoolDataSource
    Start up application server
    Check the sessions on the db
    USERNAME                       TYPE       SERVER    MODULE
    * APAX                           USER       DEDICATED
    * APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)* = connection pool sessions
    Step 1: getting the connection
    // lookup datasource in jndi
    Connection myConnection = myDataSource.getConnection();Step 2: opening a proxy connection
    Properties myProperties = new Properties();
    myProperties.put("CONNECTION_TAG", aPrincipal);
    myProperties.put("PROXY_USER_NAME", aPrincipal);
    OracleConnection myOracleConnection =
      (OracleConnection) WSJdbcUtil.getNativeConnection((WSJdbcConnection) myConnection);
    myOracleConnection.openProxySession(OracleConnection.PROXYTYPE_USER_NAME, myProperties);Step 3: check the sessions on the db
    SQL>  select username, type, server, module
    from v$session
    where type != 'BACKGROUND'
    and username is not null
    order by username;
    USERNAME                       TYPE       SERVER    MODULE
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)
    * USER1                          USER       PSEUDO* = proxy connection
    Step 4: prepare and execute query
    myResultSet = myStatement.executeQuery();Exception thrown: java.sql.SQLException: ORA-01001: invalid cursor
    SQLState = 72000
    vendorCode = 1001
    Session information:
    USERNAME                       TYPE       SERVER    MODULE
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)
    * USER1                          USER       DEDICATED* = proxy session appears to have changed
    Step 5: clear up
    OracleConnection myOracleConnection =
      (OracleConnection) WSJdbcUtil.getNativeConnection((WSJdbcConnection) aConnection);
    myOracleConnection.close(OracleConnection.PROXY_SESSION);
    myOracleConnection.close();Check sessions again
    USERNAME                       TYPE       SERVER    MODULE
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)There are no Oracle udump files or other tracing information.
    Any ideas?

    We were getting ORA-01001 error messages that didn't appear to make sense when calling certain pl/sql procedures from a application running on a Weblogic/Apache platform. The errors would not occur when we invoked the same procedures via script from a standalone SQL client.
    We were able to put an end to the Web application errors by upgrading our jdbc driver from 10.1.0.4.0 to 10.2.0.1.0.

  • Getting ORA-00911: invalid character

    I've '?' as a bind variable in my sql query. When i try to execute this in java, i'm getting the following error:
    ORA-00911: invalid character
    Is this related to some specific jdbc drivers/version or oracle's version?

    ORA-00911: invalid character
    Is this related to some specific jdbc drivers/version
    or oracle's version?The error code is Oracle specific, but the cause is code-specific.
    http://ora-00911.ora-code.com/

Maybe you are looking for

  • Multiple Currencies in a single Hierarchy?

    So I'm not sure if this is possible or not, but it seems like it might be through the use of a custom translation rule. Basically the current setup is 3 hierarchies to translate data into JPY, USD, and EUR. Each hiearchy simply has parent entities in

  • Shared photo streams not transferring photos

    My shared photo stream was working fine, and then suddenly it wouldn't receive any photos from other users, and wouldn't send them my uploaded pictures? How do i get it to work again? I also got an email that someone subscribed but it never showed up

  • Prevent objects being transported for Sandpit source system

    Hi there, We have a 3-tier systems landscape for BI: DEV, QAS, PRD (we do not have a sandpit BI). In our R/3 development system we habe two clients which are both setup as source system for BI DEV. One of the clients in R/3 DEV serves as sandpit in t

  • JDeveloper 3.2+

    It is my understanding JDeveloper3.2+ runs on WIN2K. My project needs to run Jdeveloper runtime on HP and maybe SUN. Is this possible and with support from Oracle?

  • Material specific shipping text???

    Hello Friends Is there any way to have shipping instructions print out that are specific to certain materials? I don't want to maintain this text in Sale text tab in material master because we are allready using this field to print on order acknowled