Oracle is adding "RowId" to select statement = ORA-00918 follows

Hi,
i've a problem with a strange case:
Oracle adds a rowId column to the select - and this select has joins to 2 other tables and a ora-00918 is the result!
But my application don't throw a java-excpetion - this appears only in the database log files - in the application, no problem is determined!
Database is suffering under this statement because in an hour, 1800 statements are failing... so what could this be and how i can prevent it to add this column!?
select rowid, t1.name, .......... from t1, t2, t3 etc....
I use the following statement:
Statement selStmt = stmt.getConnection().createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
Thx for help!
lg
Manny

Tough to help if you don't provide you Java and OS infor and the Oracle JDBC driver version.
Post all of the relevant Java code that is used to setup and execute the prepared statement and handle the result set.
The Oracle JDBC driver uses ROWID to support scroll sensitive or updatable result sets so it is probably being added for this reason.
Remove the 'TYPE_SCROLL_SENSITIVE' setting and see if the problem goes away.
Seacrh for ROWID in the JDBC Dev guide (Chap 17) - http://www.stanford.edu/dept/itss/docs/oracle/10g/java.101/b10979/resltset.htm
>
17.1.2.2 Oracle JDBC Implementation for Result Set Updatability
To support updatability, Oracle JDBC uses ROWIDs to uniquely identify database rows that appear in a result set. For every query into an updatable result set, the Oracle JDBC driver automatically retrieves the ROWID along with the columns you select.
>
And since you are trying to produce a scroll sensitive result set you should do a test as described in this doc hint:
>
There is a simple way to determine if your query will probably produce a scroll-sensitive or updatable result set: If you can legally add a ROWID column to the query list, then the query is probably suitable for either a scroll-sensitive or an updatable result set. (You can try this out using SQL*Plus, for example.)
>
and:
>
The Oracle JDBC drivers use the ROWID to uniquely identify a row in a database table. As long as the ROWID is still valid when a driver tries to send an UPDATE or DELETE operation to the database, the operation will be executed.
>
Hope that helps.

Similar Messages

  • How to use Oracle Table Type values in Select Statement.

    Hi,
    I am fetching initial set of values into Oracle Table of Records Type and want to use list of values in the Select statement.
    For example, try something like the following:
    TYPE t_record IS RECORD (
    ID TABLEA.ID%type,
    NO TABLEA.NO%type,
    v_record t_record;
    TYPE t_table IS TABLE OF v_record%TYPE;
    v_table t_table;
    -- Code to populate the values in v_table here.
    SELEC ID,NO, BULK COLLECT INTO <some other table variabes here> FROM TABLEA
    WHERE ID IN v_table(i).ID;
    I want to know how to use the values from Oracle Table Type in the Select Statement.

    Something like this:
    create or replace type t_record as  object (
    id number,
    no number
    CREATE or replace type t_table AS TABLE OF t_record;
    set serveroutput on
    declare
      v_table t_table := t_table();
      v_t1 t_table := t_table();
    begin
      v_table.extend(1);
      v_table(1).ID := 1;
      v_table(1).No := 10;
      v_table.extend(1);
      v_table(2).ID := 2;
      v_table(2).ID := 20;
      SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
      from TableA
      FROM TABLEA
      WHERE ID IN (select t.ID from table(v_Table) t);
      for i in 1..v_t1.count loop
        dbms_output.put_line(v_t1(i).ID);
        dbms_output.put_line(v_t1(i).No);
      end loop;
    end;
    /Untested!
    P;
    Edited by: bluefrog on Mar 5, 2010 5:08 PM

  • Adding columns in select statements

    All if i have the following statement and i wanted to add the two volume columns in the select statement can i just do a A1.volume + A2.Volume as vol
    SELECT A1.ORDERID,A1.MARKET,A1.GIMSG, A2.ORDERID,A2.MARKET,A2.TRADERID, A1.VOLUME, A2.VOLUME
    FROM table1 A1 JOIN table2
      ON A1.TRADEDATE = A2.TRADEDATE

    No that wouldnt work,
    Error will be invalid no(error no ORA-01722)
    but you can use pipe(||)
    select col1||col2 as col from ......
    ex: SQL> select e.ename||d.dname as result_col from emp e,dept d where e.deptno=d.deptno;
    RESULT_COL
    SMITHRESEARCH
    ALLENSALES
    WARDSALES
    JONESRESEARCH
    MARTINSALES
    BLAKESALES
    CLARKACCOUNTING
    SCOTTRESEARCH
    KINGACCOUNTING
    TURNERSALES
    ADAMSRESEARCH
    RESULT_COL
    JAMESSALES
    FORDRESEARCH
    MILLERACCOUNTING
    14 rows selected.
    Message was edited by:
    user517498

  • Oracle Error while execute the Select statement

    Hi all,
    I have two database, from one databse to another datadase, i am not able get value. while i am generating the select statement in one database, it throws an
    error ORA-00942: table or view does not exist.
    For this, what i have to do.can anyone post more detail on this.
    Any idea?

    Please do not create duplicate threads.
    ORA-00942: table or view does not exist

  • How to get rid of ROWID in Join query -- ORA-00918: column ambiguously defined

    Hi, All
    the source of my data block is from two tables Emp and Title. My select statements is:
    select a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
    But at run time, I got "ORA-00918: column ambiguously defined"
    the wrapped statement becomes:
    SELECT ROWID,a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
    I run the query in SQL*PLUS, found out it was ROWID caused problem.
    Can anybody tell me how to get rid of ROWID? or I missed something in datablock defination?
    Thanks in adance.
    Deborah

    I guess you are using oracle 7.x. In Oracle 8 and onwards, database lets you select ROWID from the views based on multiple views as long as view definition does not contain any aggregated functions or DISTINCT in it. Now coming back to forms ..Forms runtime engine uses ROWID to identify rows uniquely unless specified otherwise. If you are using forms 4.5/5.0 against Oracle 7.x , then change these properties and you should be able to run the form.
    BLOCK PROPERTY
    Key Mode : can be either updateable OR Non-updateable
    ( Certainly not 'Unique' .. That forces forms runtime engine to use ROWID to identify unique rows. )
    ITEM PROPERTY
    Identify one of the block items as unique. And then set the following property
    Primary Key : True.
    This should take care of rowid problem.
    Regards,
    Murali.
    Hi, All
    the source of my data block is from two tables Emp and Title. My select statements is:
    select a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
    But at run time, I got "ORA-00918: column ambiguously defined"
    the wrapped statement becomes:
    SELECT ROWID,a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
    I run the query in SQL*PLUS, found out it was ROWID caused problem.
    Can anybody tell me how to get rid of ROWID? or I missed something in datablock defination?
    Thanks in adance.
    Deborah

  • Using variable in select statement (php)

    I am having difficulty using a variable in a select
    statement.
    The following manual query (using a static date) works fine:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > '2006-06-01' ";
    However, If I use the following:
    $dateVar = date('Y-m-d');
    mysql_select_db($database_mw, $mw);
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > $dateVar ";
    ALL records are returned, which means the $dateVar variable
    is not being recognized. I have compared the $dateVar values
    <?php echo $datetime; ?> against the actual value of my date
    field <?php echo $row_Recordset1['classDate']; ?> in my
    results table and it seems that the values are indeed accurate in
    terms of a date 2006-06-04 for example.
    My date field "classDate" is of a "date" type within the
    mysql database. I'm using Dreamweaver MX 2004 with Mac OSX 10.3.9.
    I'm sure this is just a syntax problem, at least I hope it
    is.
    Any help is greatly appreciated.

    On Wed, 7 Jun 2006 04:49:57 +0000 (UTC), "mgwaters"
    <[email protected]> wrote:
    >Thanks Gary. That did seem to get the select statement
    working, but I had to
    >enter a manual date as before $dateVar = '2006-06-01'; on
    the previous line of
    >code to actually get it to filter my records. So... it
    looks like my setting of
    >the date variable:
    > $dateVar = date('Y-m-d');
    > does not seem to be recognized within the SELECT
    statement.
    Try this:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate>'$dateVar'";
    print $query_Recordset1;
    See what is in the SQL statement.
    Gary

  • * table name in the select statements

    Hi,
      I have come across a select Statement as below.
    Select * into *nast from nast where <conditions>.. End select.
    what does this *nast represents and when is it used. why do we need to call a Table  with *<Table Name>
    Kind Regards,
    Usha

    hi,
    select statement will always points to a database table so we have to give database table name and it gets data from that table. for storing that data we have to use internal tables must have same structure of database table.
    so select statement has the following form as........
    select * from [dbtable] into table [internal table]
    endselect.
    in sap select will act as a loop so that we hav to use end sleect. select has different varities in sap. for some types no need of end select.
    for ex:
    select single *
    select * ..................... into table [internal table name].....
    if helpful reward some points.
    with regards,
    suresh.

  • Optimizing a Select Statement

    Hi,
    I have recently been asked to generate a program that reports of payroll postings to FI.  This involves creating a giant select statement from the ppoix table to gather all the postings.  My select statement is as follows:
      SELECT pernr                       "EE Number
             seqno                       "Sequential number
             actsign                     "Indicator: Status of record
             runid                       "Number of posting run
             postnum                     "Number
             tslin                       "Line number of data transfer
             lgart                       "Wage Type
             betrg                       "Amount
            waers                       "Currency
            anzhl                       "Number
            meins                       "Base unit of measure
             spprc         "Special processing of posting items
            momag         "Transfer to FI/CO:EE grouping for acct determi
            komok         "Transfer to FI/CO: Symbolic account
            mcode                       "Matchcode search term
            koart                       "Account assignment type
            auart                       "Expenditure type
            nofin         "Indicator: Expenditure type is not funded
               INTO CORRESPONDING FIELDS OF TABLE i_ppoix
               FROM ppoix
               FOR ALL ENTRIES IN run_doc_xref
               WHERE runid  = run_doc_xref-runid
                 AND tslin  = run_doc_xref-linum
                 AND spprc  <> 'A'
                 AND lgart IN s_lgart
                 AND pernr in s_pernr.
    where s_pernr is a select option that holds personnel nummbers and s_lgart is a select option that holds wagetypes.  This statement works fine for a certain amount of personnel numbers and a certain amount of wagetypes, but once you exceed a certain limit the Database does not allow you to perform a select statement this large.  Is there a better way to perform such a large select such as this one) ie: FM, or some other method I am not aware of.  This select statement comes from the standard SAP delivered cost center admin report and this report dumps as well when too much data is passed to it.
    any ideas would be much appreciated.
    thanks.

    The problem here is with the select-options.
    For a select statement, you cannot have more that certain amount of data.
    The problem with your select becomes complex because of the FOR ALL ENTRIES in and the huge s_pernr and the 40 million records :(.
    I am guessing that the s_lgart will be small.
    How many entries do you have in internal table "run_doc_xref"?
    If there are not that many, then I would suggest this:
    TYPES:
      BEGIN OF ty_temp_ppoix,
       pernr   TYPE ppoix-pernr,
       lgart   TYPE ppoix-lgart,
       seqno   TYPE ppoix-seqno,
       actsign TYPE ppoix-actsign,
       runid   TYPE ppoix-runid,
       postnum TYPE ppoix-postnum,
       tslin   TYPE ppoix-tslin,
       betrg   TYPE ppoix-betrg,
       spprc   TYPE ppoix-spprc,
      END OF ty_temp_ppoix.
    DATA:
    i_temp_ppoix TYPE SORTED TABLE OF ty_temp_ppoix
       WITH NON-UNIQUE KEY pernr lgart
       INITIAL SIZE 0
       WITH HEADER LINE.
    DATA:
      v_pernr_lines TYPE sy-tabix,
      v_lgart_lines TYPE sy-tabix.
    IF NOT run_doc_xref[] IS INITIAL.
      DESCRIBE TABLE s_pernr LINES v_pernr_lines.
      DESCRIBE TABLE s_lgart LINES v_lgart_lines.
      IF v_pernr_lines GT 800 OR
         v_lgart_lines GT 800.
    * There is an index on runid and tslin. This should be ok
    * ( still bad because of the huge table :(  )
        SELECT pernr lgart seqno actsign runid postnum tslin betrg spprc
    * Selecting into sorted TEMP table here
          INTO TABLE i_temp_ppoix
          FROM ppoix
          FOR ALL ENTRIES IN run_doc_xref
          WHERE runid = run_doc_xref-runid
          AND   tslin = run_doc_xref-linum
          AND   spprc <> 'A'.
    * The sorted table should make the delete faster
        DELETE i_temp_ppoix WHERE NOT pernr IN s_pernr
                            AND   NOT lgart IN s_lgart.
    * Now populate the actual target
        LOOP AT i_temp_ppoix.
          MOVE: i_temp_ppoix-pernr TO i_ppoix-pernr.
    *  and the rest of the fields
          APPEND i_ppoix.
          DELETE i_temp_ppoix.
        ENDLOOP.
      ELSE.
        SELECT pernr seqno actsign runid postnum tslin lgart betrg spprc
    * Selecting into your ACTUAL target here
          INTO TABLE i_ppoix
          FROM ppoix
          FOR ALL ENTRIES IN run_doc_xref
          WHERE runid = run_doc_xref-runid
          AND   tslin = run_doc_xref-linum
          AND   spprc <> 'A'
          AND   pernr IN s_pernr
          AND   lgart IN s_lgart.
      ENDIF.
    ELSE.
    * Error message because of no entries in run_doc_xref?
    * Please answer this so a new solution can be implemented here
    * if it is NOT an error
    ENDIF.
    Hope this helps.
    Regards,
    -Ramesh

  • Select statement takes very long to run with order by clause.

    Hi all,
    I have a select statement which when I run without the order by clause takes arround 2 minutes to run. But with the order by clause it goes on for ever. I am trying to access the database server through a network which is not too fast.
    The select statement is based on 9 views which are again based on some views. It also has inline views and outer joins. These views and inline views can not be done away with.
    When selected without the order by clause it gives 3215 records.
    Anything like 2 to 3 minutes will be Ok.
    Thanks.
    --Malay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    The select statement is as follows :-
    SELECT f.system_name,
    a.signal_type,
    f.sys_signal_name,
    a.bus_desc,
    b.vl_ident,
    b.vl_name,
    b.src_mac,
    b.src_mac_addr,
    b.dest_mac,
    b.dest_mac_addr,
    b.network,
    bb.bufr_size_in_bytes,
    bb.bag_in_ms,
    bb.is_rma_used,
    bb.is_ic_used,
    bb.sub_vl_cnt,
    bb.skew_max_in_ns,
    cc.msg_name,
    c.src_ip,
    c.src_ip_addr,
    c.src_port,
    c.dest_ip,
    c.dest_ip_addr,
    c.dest_port,
    cc.rate_in_ms,
    cc.tx_mode,
    cc.protocol,
    cc.port_type,
    cc.msg_length_in_bytes,
    d.mnemonic,
    d.start_addr32,
    d.lsb,
    d.end_addr32,
    d.msb,
    d.format,
    d.init_value,
    d.fs_mnemonic,
    d.fs_afdx_data_id,
    d.digital_data_id,
    DECODE(
    d.digital_datatype,
    NULL, '',
    'UNUSED', '',
    api$util.concat_column_data(
    'api_'
    || d.digital_datatype,
    'digital_data_id',
    d.digital_data_id,
    bool.FALSE
    ) AS data_details,
    f.connection_id
    || '_'
    || a.digital_bus_id
    || '_'
    || b.afdx_vl_id
    || '_'
    || bb.afdx_output_id
    || '_'
    || c.afdx_frame_id
    || '_'
    || cc.afdx_msg_id
    || '_'
    || d.afdx_data_id AS KEY
    FROM api_afdx a,
    api_afdx_vl b,
    api_afdx_output bb,
    api_afdx_frame c,
    api_afdx_msg cc,
    api_afdx_data d,
    vf_signal e,
    (SELECT DISTINCT aa.signal_id,
    cc.system_name,
    bb.connection_id,
    bb.sys_signal_name
    FROM vf_nodes aa,
    vf_connections bb,
    vf_system cc
    WHERE aa.connection_id = bb.connection_id
    AND bb.system_id = cc.system_id) f
    WHERE e.signal_id = f.signal_id(+)
    AND e.digital_bus_id = a.digital_bus_id
                   AND a.digital_bus_id = bb.digital_bus_id(+)
    AND bb.afdx_output_id = b.afdx_output_id(+)
                   AND b.afdx_vl_id = c.afdx_vl_id(+)
    AND bb.afdx_output_id = cc.afdx_output_id(+)
    AND cc.afdx_msg_id = d.afdx_msg_id(+)
    ORDER BY f.system_name,
    a.signal_type,
    f.sys_signal_name,
    b.vl_name,
    cc.msg_name,
    d.start_addr32,
    d.lsb;
    Where api_afdx ,
    api_afdx_vl ,
    api_afdx_output ,
    api_afdx_frame ,
    api_afdx_msg ,
    api_afdx_data ,
    vf_signal ,
    vf_nodes ,
    vf_connections ,
    vf_system
    are all views.

  • ORA-00911: invalid character using multiple select statements

    I am getting an ORA-00911: invalid character error when trying to execute 2 select statements using ODP.NET.
    cmd.CommandText = "select sysdate from dual;select sysdate from dual;";
    cmd.Connection = conn;
    cmd.CommandType = System.Data.CommandType.Text;
    conn.Open();
    OracleDataReader dr = cmd.ExecuteReader();
    This works in SQL server but for some reason it appears this does not work in Oracle?
    If this is the case what is a vaiable workaround? Wrapping the 2 statements in a transaction?
    Seems strange that you can't return multiple result sets using in-line sql statements.

    Oracle doesn't support passing multiple statements like that, and this is unrelated to ODP.NET.
    SQL> select * from emp;select * from dept;
    select * from emp;select * from dept
    ERROR at line 1:
    ORA-00911: invalid character
    You could do it via an anonymous block and ref cursors though if you dont want to do it via a stored procedure..
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    public class test
    public static void Main()
        using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;"))
            con.Open();
            string strSql = "begin open :refcur1 for select * from emp;" +
                "open :refcur2 for select * from dept;" +
                "open :refcur3 for select * from salgrade;end;";
            using (OracleCommand cmd = new OracleCommand(strSql, con))
                cmd.Parameters.Add("refcur1", OracleDbType.RefCursor, ParameterDirection.Output);
                cmd.Parameters.Add("refcur2", OracleDbType.RefCursor, ParameterDirection.Output);
                cmd.Parameters.Add("refcur3", OracleDbType.RefCursor, ParameterDirection.Output);
                OracleDataAdapter da = new OracleDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);
                cmd.Parameters["refcur1"].Dispose();
                cmd.Parameters["refcur2"].Dispose();
                cmd.Parameters["refcur3"].Dispose();
                foreach (DataTable dt in ds.Tables)
                    Console.WriteLine("\nProcessing {0} resultset...", dt.ToString());
                    foreach (DataRow row in dt.Rows)
                        Console.WriteLine("column 1: {0}", row[0]);
    }Hope it helps,
    Greg

  • ORA-24333 on Select Statement

    Last night I attempted to roll a Crystal Reports .NET project to my production web server. This app has 3 new Crystal Reports. The Reports are all based upon the same Oracle Views on the same Oracle Database. Two of the reports work while the third report returns an ORA-24333 error. The exact reports and .NET code, connecting to the same Oracle database work fine in Preview mode and when published to my development IIS web server. The ONLY thing that is different is that the report is now being run on the production IIS web server. (But it is still the same Oracle Database we are connecting to in all environments.)
    Here is the Command used for the Crystal Report that fails. Sorry it is so long. Basically, it is 4 Select statements joined together with Unions. Stuff in {} are parameters that are passed to it.
    SELECT A.Custno as Custno, C.CUST_NAME as Cust_Name, D.CONTACT_NAME as Contact_Name, A.FISCALPRD as FiscalPrd, A.PROJECTNAME as ProjectName, A.INVOICENO as InvoiceNO, A.INVDATE, A.PAYDATE, A.ORDERNO as OrderNo, A.TOTALAMT as TotalAmt, A.ELIGIBLEAMT as EligibleAmt, A.SALESPOINTERD as SalesPointErd, 0 as FORFEIT, 0 as BONUSPOINTERD, 0 as PAYPTSEARNED, P.POINTPERCD as POINTPERCD, case when A.PAYDATE is null and A.INVDATE>SYSDATE-30 then round(P.POINTPERCD*A.ELIGIBLEAMT/100,0) else 0 end as PAYPTSELIG, case when A.PAYDATE is null and A.INVDATE>SYSDATE-30 then TO_CHAR(A.INVDATE+30,'MM/DD/YYYY') else '' end as PAYBYforPAYPTS
    FROM VW_TRIPPOINTS A
    left join VW_POINTS P on A.COMPANY=P.COMPANY and substr(A.FISCALPRD,1,4)=to_char(P.FISCALYEAR) and P.CODE='P'
    join VW_CUSTOMERS C on (C.COMPANY=A.COMPANY or A.custno='313243') and C.CUST_NUMB=A.custno
    join VW_SALESMEN D on C.DIST_MGR=D.CONTACT_NUMBER
    where A.POINTCODE='S' and A.COMPANY='30' and A.ELIGIBLEAMT<>0 and A.custno='{?@Cust_ID}' and A.FISCALPRD>={?@BegPeriod} and A.FISCALPRD<={?@EndPeriod}
    Union --Bonus Points
    SELECT A.Custno as Custno, C.CUST_NAME as Cust_Name, D.CONTACT_NAME as Contact_Name, A.FISCALPRD as FiscalPrd, A.Notes as ProjectName, Cast((Row_Number() over (Order By CustNo, OrderNo, InvoiceNo, IDKey)) as varchar(10)) as InvoiceNO, A.INVDATE, Null as PAYDATE, Cast((Row_Number() over (Order By IDKey)) as varchar(10)) as ORDERNO, Coalesce(A.TOTALAMT,0) as TotalAmt, Coalesce(A.ELIGIBLEAMT,0) as EligibleAmt, Coalesce(A.SALESPOINTERD,0) as SalesPointErd, 0 as FORFEIT, A.BONUSPOINTERD as BonusPointErd, 0 as PAYPTSEARNED, 0 as POINTPERCD, 0 as PAYPTSELIG, '' as PAYBYforPAYPTS
    FROM VW_TRIPPOINTS A
    join VW_CUSTOMERS C on (C.COMPANY=A.COMPANY or A.custno='313243') and C.CUST_NUMB=A.custno
    join VW_SALESMEN D on C.DIST_MGR=D.CONTACT_NUMBER
    where A.POINTCODE='B' and A.COMPANY='30' and A.custno='{?@Cust_ID}' and A.FISCALPRD>={?@BegPeriod} and A.FISCALPRD<={?@EndPeriod}
    Union --Pay Points
    SELECT A.Custno as Custno, C.CUST_NAME as Cust_Name, D.CONTACT_NAME as Contact_Name, A.FISCALPRD as FiscalPrd, A.PROJECTNAME as ProjectName, A.INVOICENO as InvoiceNO, A.INVDATE, A.PAYDATE, A.ORDERNO as OrderNo, 0 as TotalAmt, 0 as EligibleAmt, 0 as SALESPOINTERD, 0 as FORFEIT, 0 as BONUSPOINTERD, coalesce(A.PAYPOINTERD,0) as PAYPTSEARNED, 0 as POINTPERCD, 0 as PAYPTSELIG, '' as PAYBYforPAYPTS
    FROM VW_TRIPPOINTS A
    join VW_CUSTOMERS C on (C.COMPANY=A.COMPANY or A.custno='313243') and C.CUST_NUMB=A.custno
    join VW_SALESMEN D on C.DIST_MGR=D.CONTACT_NUMBER
    where (A.POINTCODE='P' or A.POINTCODE='C') and A.COMPANY='30' and A.PAYPOINTERD<>0 and A.custno='{?@Cust_ID}' and A.FISCALPRD>={?@BegPeriod} and A.FISCALPRD<={?@EndPeriod}
    Union --Sales Points Forfeited
    SELECT A.Custno as Custno, C.CUST_NAME as Cust_Name, D.CONTACT_NAME as Contact_Name, A.FISCALPRD as FiscalPrd, A.PROJECTNAME as ProjectName, A.INVOICENO as InvoiceNO, A.INVDATE, A.PAYDATE, A.ORDERNO as OrderNo, 0 as TotalAmt, 0 as EligibleAmt, 0 as SalesPointErd, Coalesce(A.SalesPointErd,0) as FORFEIT, 0 as BONUSPOINTERD, 0 as PAYPTSEARNED, 0 as POINTPERCD, 0 as PAYPTSELIG, '' as PAYBYforPAYPTS
    FROM VW_TRIPPOINTS A
    join VW_CUSTOMERS C on (C.COMPANY=A.COMPANY or A.custno='313243') and C.CUST_NUMB=A.custno
    join VW_SALESMEN D on C.DIST_MGR=D.CONTACT_NUMBER
    where A.POINTCODE='R' and A.COMPANY='30' and A.SalesPointErd<>0 and A.custno='{?@Cust_ID}' and A.FISCALPRD>={?@BegPeriod} and A.FISCALPRD<={?@EndPeriod}
    order by custno, OrderNo, InvoiceNo

    Because we don't all have the Oracle error numbers and messages memorized:
    ORA-24333: zero iteration count
    Cause: An iteration count of zero was specified for the statement
    Action: Specify the number of times this statement must be executed

  • DISTINCT in SELECT statements for  Entities / Views - Oracle JDeveloper 11G

    Hi Steve,
    i have a question about using DISTINCT in SELECT statements for
    Entities / Views. On Oracle JDeveloper 11G ADF / BC4J
    --- This is unique---
    SELECT
    distinct(GC."course_title"),
    GC.SEC_GRP_PARENT_ID,
    from "grp_courses" GC
    --- This is NOT unique, but ROWID seems to be mandatory as PrimaryKey---
    SELECT
    distinct(GC."course_title"),
    GC.SEC_GRP_PARENT_ID,
    rowid
    from "grp_courses" GC
    How to use this query;
    SELECT
    distinct(GC."course_title"),
    GC.SEC_GRP_PARENT_ID,
    from "grp_courses" GC
    and yet still be able to use it in View / Entity without a Primary Key or some equivalent solution.
    Thanks & Regards,

    Hi, OK - I got it to work...
    Some notes:
    1) The View wizard cannot be initiated from the Entity Object.
    2) During the View wizard process - do not associate with Entity
    3) Selected columns must be mapped as expressions
    4) Using non-distinct columns will override the distinct function

  • ORA-01401 in SELECT statement !

    Hi all,
    We are facing a Strange problem.
    Oracle Database 10.2.0.1 on Fedora Core6
    AL32UTF8 Charset, NLS_LENGTH_SEMANTICS = CHAR
    In a particular select statement, the database gives out ORA-01401 error:
    ORA-01401: inserted value too large for column
    Here is the select statement:
    SELECT   a.loc_nbr AS loc_nbr, a.loc_type_code AS loc_type_code,
             TO_CHAR (a.loc_eff_dt, 'yyyy-mm-dd') AS loc_eff_dt,
             TO_CHAR (a.loc_end_dt, 'yyyy-mm-dd') AS loc_end_dt,
             a.loc_nm AS loc_nm, a.loc_city AS loc_city,
             a.loc_st_prov AS loc_st_prov, b.acct_loc_nbr AS acct_loc_nbr,
             c.noofres AS routes
        FROM loc a,
             (SELECT   c.acct_loc_nbr AS acct_loc_nbr,
                       a.loc_sys_nbr AS loc_sys_nbr_loc
                  FROM loc a, loc_attr c
                 WHERE a.loc_ctry_code = '040'
                   AND a.loc_co_code = '001'
                   AND a.loc_type_code LIKE '03%'
                   AND a.loc_eff_dt <= TO_DATE ('2008-02-22', 'yyyy-mm-dd')
                   AND a.loc_end_dt >= TO_DATE ('2008-02-22', 'yyyy-mm-dd')
                   AND a.loc_nm > '%'
                   AND LPAD (a.loc_nbr, 38, '0') LIKE '%'
                   AND a.loc_short_nm LIKE '%'
                   AND a.loc_city LIKE '%'
                   AND NVL (a.loc_st_prov, '     ') LIKE '%'
                   AND c.loc_ctry_code = a.loc_ctry_code
                   AND c.loc_co_code = a.loc_co_code
                   AND c.loc_nbr = a.loc_nbr
                   AND c.loc_type_code = a.loc_type_code
                   AND c.loc_attr_eff_dt <= a.loc_eff_dt
                   AND c.loc_attr_end_dt >= a.loc_eff_dt
              ORDER BY a.loc_nbr) b,
             (SELECT   COUNT (b.loc_nbr) AS noofres,
                       a.loc_sys_nbr AS loc_sys_nbr_rt
                  FROM loc a, rt_loc_assgn b
                 WHERE a.loc_ctry_code = '040'
                   AND a.loc_co_code = '001'
                   AND a.loc_type_code LIKE '03%'
                   AND a.loc_eff_dt <= TO_DATE ('2008-02-22', 'yyyy-mm-dd')
                   AND a.loc_end_dt >= TO_DATE ('2008-02-22', 'yyyy-mm-dd')
                   AND a.loc_nm > '%'
                   AND LPAD (a.loc_nbr, 38, '0') LIKE '%'
                   AND a.loc_short_nm LIKE '%'
                   AND a.loc_city LIKE '%'
                   AND NVL (a.loc_st_prov, '     ') LIKE '%'
                   AND b.ctry_code = a.loc_ctry_code
                   AND b.co_code = a.loc_co_code
                   AND b.loc_nbr = a.loc_nbr
                   AND (   a.loc_eff_dt BETWEEN b.rt_loc_eff_dt AND b.rt_loc_end_dt
                        OR a.loc_end_dt BETWEEN b.rt_loc_eff_dt AND b.rt_loc_end_dt
                   AND b.loc_svc_type_code = 'S'
              GROUP BY a.loc_sys_nbr) c
       WHERE a.loc_sys_nbr = b.loc_sys_nbr_loc(+)
         AND a.loc_sys_nbr = c.loc_sys_nbr_rt(+)
         AND a.loc_ctry_code = '040'
         AND a.loc_co_code = '001'
         AND a.loc_type_code LIKE '03%'
         AND a.loc_eff_dt <= TO_DATE ('2008-02-22', 'yyyy-mm-dd')
         AND a.loc_end_dt >= TO_DATE ('2008-02-22', 'yyyy-mm-dd')
         AND a.loc_nm > '%'
         AND LPAD (a.loc_nbr, 38, '0') LIKE '%'
         AND a.loc_short_nm LIKE '%'
         AND a.loc_city LIKE '%'
         AND NVL (a.loc_st_prov, '     ') LIKE '%'
    ORDER BY a.loc_nmWorkarounds:
    - If we comment ORDER BY clause, the query works fine
    - On line 49, if we surround loc_sys_nbr with TRIM() function, the query works fine
    - On line 60, if we use NVL (a.loc_st_prov, '' ) LIKE '%', the query works fine
    All these fields are CHAR() datatype.
    Any idea what is happening here?
    Thanks in advance :)

    Thanks Satish,
    We are hit by the bug 5874989 relating to impdp tool.

  • Select statement for last name added

    hi all,
    i want a select statement to retrieve the last name added into the "ename" column .
    i mean :
    if i insert "jack" into "ename" column , i want to write  a select statement to retrieve that last name while i do not know it is jack or any other name ?
    thanks

    Hi,
    Sorry, Oracle doesn't auotmatically keep track of the order in which rows were inserted.  If you need to know that, then you need to save something in the table that will tell you the insertion order, such as a sequence value.

  • Getting an ORA-24333 error while parsing a non SELECT statement ...

    Hi,
    I'm new to this forum and I've search through the entire forum to see if my problem was already solved, but at first sight it doesn't ?
    So I hope that someone can help me one this : I'm facing a strange problem with the OCI 8i. I've encapsulated any OCI call into a set of C++ classes. Everything works fine apart for one point : whenever I try to parse a NON "select" statement, I get the ORA-24333 error.
    Basically, the code follow the current schema (only "important" states are written here) :
    -> Opening an Oracle Session
    -> Receving de statement.
    -> Analyse it with a call to OCIStmtPrepare() with OCI_NTV_SYNTAX set.
    -> Calling OCIBindByName() to associate each variable with a data.
    -> Calling OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to retrieve the current list of INPUT/OUTPUT columns.
    And this is where the problem arise.
    With a statement like : "SELECT MyPackage.MyFunction(:v1) FROM DUAL"
    Everthing works fine. I can bind the INPUT/OUTPUT ":v1" variable.
    But with a statement like : "BEGIN MYFUNTION(:v1); END;"
    I get the ORA-24333 error after the call to OCIStmtExecute().
    I get this error only when I set OCI_DESCRIBE_ONLY. If I call OCIStmtExecute() with OCI_DEFAULT, the OCI execute the statement. This is fine but it's not what I want. I cannot change the statement received (by design), so they should be proceeded as received.
    What I'm looking for is a way to successfully perform the OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to get the list of variables columns related to the current statement.
    Any help would be greatly apprecitated here. Thanks !
    Here are my current configurations.
    -> Windows 2000 SP5 OCI 8i / VC++ 6.0
    -> Macintosh OS X 10.3.4 / Code Warrior 8.3
    (The code produce exactly the same results/troubles on both plateforms.)
    Thanks in advance for your respons.

    Hi,
    I'm new to this forum and I've search through the entire forum to see if my problem was already solved, but at first sight it doesn't ?
    So I hope that someone can help me one this : I'm facing a strange problem with the OCI 8i. I've encapsulated any OCI call into a set of C++ classes. Everything works fine apart for one point : whenever I try to parse a NON "select" statement, I get the ORA-24333 error.
    Basically, the code follow the current schema (only "important" states are written here) :
    -> Opening an Oracle Session
    -> Receving de statement.
    -> Analyse it with a call to OCIStmtPrepare() with OCI_NTV_SYNTAX set.
    -> Calling OCIBindByName() to associate each variable with a data.
    -> Calling OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to retrieve the current list of INPUT/OUTPUT columns.
    And this is where the problem arise.
    With a statement like : "SELECT MyPackage.MyFunction(:v1) FROM DUAL"
    Everthing works fine. I can bind the INPUT/OUTPUT ":v1" variable.
    But with a statement like : "BEGIN MYFUNTION(:v1); END;"
    I get the ORA-24333 error after the call to OCIStmtExecute().
    I get this error only when I set OCI_DESCRIBE_ONLY. If I call OCIStmtExecute() with OCI_DEFAULT, the OCI execute the statement. This is fine but it's not what I want. I cannot change the statement received (by design), so they should be proceeded as received.
    What I'm looking for is a way to successfully perform the OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to get the list of variables columns related to the current statement.
    Any help would be greatly apprecitated here. Thanks !
    Here are my current configurations.
    -> Windows 2000 SP5 OCI 8i / VC++ 6.0
    -> Macintosh OS X 10.3.4 / Code Warrior 8.3
    (The code produce exactly the same results/troubles on both plateforms.)
    Thanks in advance for your respons.

Maybe you are looking for