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.

Similar Messages

  • 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

  • Snapshot too old ORA-01555 from select statement (discoverer)??

    Hi All
    Am I loosing the plot .. but we have a select statement run from discoverer which is causing the famous snapshot too old error.
    My understanding is that undo is generated from select/insert/update.
    So why is the following discoverer Select statement causing the error?
    from alert
    ORA-01555 caused by SQL statement below (SQL ID: gk0wxgqmx66sh, Query Duration=3866 sec, SCN: 0x001e.089cf3f9):
    SELECT  ( ROUND(( TO_DATE(SYSDATE)-o101038.HIRE_DATE )/365,2) ) as
      "  bla bla
    ORDER BY o101020.SUB_ORGANIZATION_NAME ASC
    Thanks in Advance

    simon.9999 wrote:
    Hi All
    Am I loosing the plot .. but we have a select statement run from discoverer which is causing the famous snapshot too old error.
    My understanding is that undo is generated from select/insert/update.
    So why is the following discoverer Select statement causing the error?
    from alert
    ORA-01555 caused by SQL statement below (SQL ID: gk0wxgqmx66sh, Query Duration=3866 sec, SCN: 0x001e.089cf3f9):
    SELECT  ( ROUND(( TO_DATE(SYSDATE)-o101038.HIRE_DATE )/365,2) ) as
      "  bla bla
    ORDER BY o101020.SUB_ORGANIZATION_NAME ASC
    Thanks in Advance
    The SELECT statement is the victim.
    Some session is doing DML against the same table against which the SELECT occurs & is likely doing COMMIT inside a LOOP.

  • 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-01401 select error when using NLS_COMP=LINGUISTIC ?

    Hello All.
    I observed a strange thing regarding case insensitive search in XE 11.2.0-1.0 and would like to know, if I am doing someting wrong, or if XE behaves wrong.
    I have tables with columns of type NVARCHAR2. If I do a simple select with a simple "like" whereclause, I get the ORA-01401 error, without having a single idea, where this error comes from. Here is my sceanrio:
    1) Create a simple table
         CREATE TABLE TTEST
              ID NUMBER,
              SYM NVARCHAR2(30)
    2) change your NLS_SORT and NLS_COMP settings to provide case insensitve search capabilities
         ALTER SESSION SET NLS_SORT=BINARY_CI;
         ALTER SESSION SET NLS_COMP=LINGUISTIC;
    3) do a simple select on this table:
         SELECT * FROM TTEST WHERE SYM LIKE N'm%';
    You will get the "ORA-01401 : inserted value to large for column" error.
    If you change your NLS_COMP setting to BINARY, the select is working fine again.
    Any idea what's going on here?
    Thanks for help and kind regards
    .............mikelm

    Hi,
    looks like you hit "Bug 7335665 : WRONG RESULTS WHEN NLS_COMP=LINGUISTIC AND NLS_SORT=BINARY_CI ON NVARCHAR2".
    Workaround can be to not use NVARCHAR2 but varchar2
    Another is to use for your query 3:
    SELECT ID FROM People WHERE Lastname >= 'do' and Lastname < 'dp';The bug is stated to be patched for 12.1
    Herald ten Dam
    http://htendam.wordpress.com

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

  • ORA-01401 error on char column with oracle oci driver

    Hello,
    We found a potential bug in the kodo.jdbc.sql.OracleDictionary class
    shipped as source with Kodo:
    In newer Kodo versions (at least in 3.3.4), the method
    public void setString (PreparedStatement stmnt, int idx, String
    val,          Column col)
    has the following code block:
    // call setFixedCHAR for fixed width character columns to get padding
    // semantics
    if (col != null && col.getType () == Types.CHAR
    && val != null && val.length () != col.getSize ())
    ((OraclePreparedStatement) inner).setFixedCHAR (idx, val);
    This block seems to be intended for select statements but is called on
    inserts/updates also. The latter causes a known problem with the Oracle
    oci driver when settings CHAR columns as FixedCHAR, which reports an
    ORA-01401 error (inserted value too large for column) when definitely no
    column is too long. This does not happen with the thin driver.
    We reproduced this with 8.1.7 and 9.2.0 drivers.
    For us we solved the problem by subclassing OracleDictionary and removing
    the new code block.
    Regards,
    Rainer Meyer
    ELAXY Financial Software & Solutions GmbH & Co. KG

    Rainer-
    I read at
    re:'ORA-01401 inserted value too large for column' - 9i that:
    "This is fixed in Oracle9i Release 2"
    Can you try that version of the driver? Also, does it fail in the Oracle
    10 OCI driver?
    Rainer Meyer wrote:
    Hello,
    We found a potential bug in the kodo.jdbc.sql.OracleDictionary class
    shipped as source with Kodo:
    In newer Kodo versions (at least in 3.3.4), the method
    public void setString (PreparedStatement stmnt, int idx, String
    val,          Column col)
    has the following code block:
    // call setFixedCHAR for fixed width character columns to get padding
    // semantics
    if (col != null && col.getType () == Types.CHAR
    && val != null && val.length () != col.getSize ())
    ((OraclePreparedStatement) inner).setFixedCHAR (idx, val);
    This block seems to be intended for select statements but is called on
    inserts/updates also. The latter causes a known problem with the Oracle
    oci driver when settings CHAR columns as FixedCHAR, which reports an
    ORA-01401 error (inserted value too large for column) when definitely no
    column is too long. This does not happen with the thin driver.
    We reproduced this with 8.1.7 and 9.2.0 drivers.
    For us we solved the problem by subclassing OracleDictionary and removing
    the new code block.
    Regards,
    Rainer Meyer
    ELAXY Financial Software & Solutions GmbH & Co. KG
    Marc Prud'hommeaux
    SolarMetric Inc.

  • WHEN IMPLEMENTING THE FILESENDERCUSTOMIZER CLASS AN ORA-01401 IS RECEIVED

    The following error is received when an FTP adapater is being implemented with
    the "FileSenderCustomizer"-Interface class:
    Initializing the Bridge oracle.oai.agent.adapter.technology.TechBridge..
    Bridge started in D3L mode.
    java.sql.SQLException: ORA-01401: inserted value too large for column ORA-06512: at line 1
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:242)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:554)
    at oracle.jdbc.ttc7.TTC7Proto .doOall7(TTC7Protocol.java:1478)
    at oracle.jdbc.ttc7.TTC7Proto .parseExecuteFetch(TTC7Protocol.java:888)
    at oracle.jdbc.driver.OracleStatement.executeNonQueryOracleStatement.java:2076)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1986)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeoutOracleStatement.java:2697)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdateOraclePreparedStatement.java:457)
    at oracle.jdbc.driver.OraclePreparedStatement.executeOraclePreparedStatement.java:531)
    at oracle.oai.agent.common.logger.ErrorLogDBObject.insertLogObject(ErrorLogDBObject.java:136)
    at oracle.oai.agent.common.logger.ErrorLogObserver.run(ErrorLogObserver.java:127)
    at java.lang.Thread.run(Thread.java:568)
    Error code: 1401
    This error is received when a configuration error has been detected into the adapter.ini file.
    Whenever the same setup has been encountered into a standard not customized adapter this error is not received and the adapter kindly states into his log file that an incorrect property has been detected into the adapter.ini. Has anybody encountered this kind of problem and if so how did you fixed it.
    Kind Regards

    Are you saying that if you do not modify the WHERE condition and run the SELECT as-is (as in your original post) in SQL*Plus, you get the same error?
    Can you post a test case? I'm not getting any error in example below.
    SQL> create table comics (id number) ;
    Table created.
    SQL> insert into comics values ('2.0') ;
    1 row created.
    SQL> insert into comics values ('2') ;
    1 row created.
    SQL> insert into comics values (2.0) ;
    1 row created.
    SQL> insert into comics values (2) ;
    1 row created.
    SQL> commit ;
    Commit complete.
    SQL> select * from comics WHERE (comics.id = '2.0') ;
            ID
             2
             2
             2
             2
    4 rows selected.
    SQL> drop table comics ;
    Table dropped.
    SQL> create table comics (id varchar2(10)) ;
    Table created.
    SQL> insert into comics values ('2.0') ;
    1 row created.
    SQL> insert into comics values ('2') ;
    1 row created.
    SQL> insert into comics values (2.0) ;
    1 row created.
    SQL> insert into comics values (2) ;
    1 row created.
    SQL> select * from comics WHERE (comics.id = '2.0') ;
    ID
    2.0
    1 row selected.
    SQL>Message was edited by:
    Kamal Kishore

  • Passing value as a parameter in select statement

    Hi,
    Very simple query, how do I pass the values that i get in the cursor to a select statement. If table1 values are 1,2,3,4 etc , each time the cursor goes through , I will get one value in the variable - Offer
    So I want to pass that value to the select statement.. how do i do it?
    the one below does not work.
    drop table L1;
    create table L1
    (col1 varchar(300) null) ;
    insert into L1 (col1)
    select filter_name from table1 ;
    SET SERVEROUTPUT ON;
    DECLARE
    offer table1.col1%TYPE;
    factor INTEGER := 0;
    CURSOR c1 IS
    SELECT col1 FROM table1;
    BEGIN
    OPEN c1; -- PL/SQL evaluates factor
    LOOP
    FETCH c1 INTO offer;
    EXIT WHEN c1%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(offer);
    select * from table1 f where f.filter_name =:offer ;
    factor := factor + 1;
    DBMS_OUTPUT.PUT_LINE(factor);
    END LOOP;
    CLOSE c1;
    END;

    Hi Greg,
    Thanks for the response, No there is no ODB.net involved here.
    If I remove the : from :offer. I get this error now.
    Changed SQL is:
    select * from table1 f where f.filter_name =offer ;
    Error report:
    ORA-06550: line 16, column 23:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 16, column 9:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Using Select statement in IF condition?

    hi all,
    Can i use select statement in IF COndition in pl sql ?
    eg like- if( select 1 from ASD) then
    end if;

    There is no way to do any kind of select statement inside if conditions.
    Why don't test simple cases like this first?
    An example to show it.
    SQL> begin
      2   if exists (select 1 from dual) then
      3    dbms_output.put_line('ok');
      4   end if;
      5  end;
      6  /
    if exists (select 1 from dual) then
    ERRORE alla riga 2:
    ORA-06550: line 2, column 5:
    PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL
    statement only
    ORA-06550: line 2, column 2:
    PL/SQL: Statement ignored
    SQL> begin
      2   if ( (select count(*) from dual) > 0 ) then
      3    dbms_output.put_line('ok');
      4   end if;
      5  end;
      6  /
    if ( (select count(*) from dual) > 0 ) then
    ERRORE alla riga 2:
    ORA-06550: line 2, column 8:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternativ
    ORA-06550: line 2, column 33:
    PLS-00103: Encountered the symbol ")" when expecting one of the following:
    . , @ ; for <an identifier>
    <a double-quoted delimited-identifier> group having intersect
    minus order partition start subpartition union where connect
    SQL> begin
      2   if ( 0 in (select count(*) from dual) ) then
      3    dbms_output.put_line('ok');
      4   end if;
      5  end;
      6  /
    if ( 0 in (select count(*) from dual) ) then
    ERRORE alla riga 2:
    ORA-06550: line 2, column 12:
    PLS-00405: subquery not allowed in this context
    ORA-06550: line 2, column 2:
    PL/SQL: Statement ignoredBye Alessandro

  • How to get the value from a function using a select statement

    I have a function(user defined not built in) that returns multiple values(like an array). My question is how do i get those values in a select statement. when i tried to retrieve it,
    select pack.my_members from dual;
    i am getting an error
    ORA-00902: invalid datatype
    I am sure this must be a syntax error with the select statement
    The following is the function that give the array of data
    package pack
    package spec
    Type my_table is table of varchar2(25);
    function the_members
    return pack.my_table;
    pakcage body
    function the_members return pack.my_table
    Remarks: This function returns a table containing names of the
    members
    is
    tm pack.my_table:= pack.my_table('first member','second member','third member','fourth member');
    begin
    return tm;
    end the_members;

    Check this example on Pipelinedfunction

  • Using Cursor in Select statements? How to do this?

    I am getting an error whilt passing a cursor to a select clause:
    SELECT dbms_xmlquery.getXML('select deptno, dname, '||
    'cursor(select empno, ename, sal from emp e where e.deptno = d.deptno) employees '||
    'from dept d where d.deptno in (10, 20)')
    FROM dual;
    DBMS_XMLQUERY.GETXML('SELECTDEPTNO'||'CURSORIS(SELECTEMPNOFROMEMPEWHEREE.DEPT=D.
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: ORA-00923
    : FROM keyword not found where expected
    </ERROR
    THIS IS DUE TO THE CURSOR AND ITS FROM STATEMENT?
    CAN ANY ONE PLEASE GUIDE AS TO HOW TO USE CURSORS IN A SELECT STATEMENT PLEASE?

    Another duplicate thread. See my response Select CLAUSE error using CURSORS & XSU.Please SEE..
    Cheers, APC

  • Use of a stored procedure in a select statement submitted to cx_oracle

    Hi,
    I am developping under python and I'm using the cx_oracle interface.
    I've written a stored procedure that I've tested directly under sqlplus session : it's ok. I've also tested this stored procedure from python by using callproc routine : its also ok.
    Now I need to use this procedure within a select statement that I submit to the execute statement of cx_oracle as :
    s = "select a.airport_name,gmlpos.ExpLatLong(a.point_name) from airport"
    self.db = oracledb('ops/opeope00@ACE2008B')
    dbmsg = self.db.execute(s)
    IF (dbmsg == "") :
    An error occurs :
    Message = request = select a.AIRPORT_NAME, gmlpos.ExpLatLong(a.point_name) from airport, errmsg = ORA-00904: "GMLPOS"."EXPLATLONG": invalid identifier
    Noting that the execution of any other select (without stored procedure) order from python works fine.
    Is anybody has a solution or workaround ?
    thanks a lot for your help

    The result gives what is expected :
    AIRP
    GMLPOS.EXPLATLONG(A.POINT_NAME)
    LFLL
    -45.71666666666667 -5.08333333333333
    As I said the stored procedure works fine.
    Thanks for your expertise
    PS : why change the login password until nobody says which machine or database is concerned ?

  • How to use bind variable value for table name in select statement.

    Hi everyone,
    I am having tough time to use value of bind variable for table name in select statement. I tried &p37_table_name. ,
    :p37_table_name or v('p37_table_name) but none worked.
    Following is the sql for interactive report:
    select * from v('p37_table_name') where key_loc = :P37_KEY_LOC and
    to_char(inspection_dte,'mm/dd/yyyy') = :P37_INSP_DT AND :p37_column_name is not null ;
    I am setting value of p37_table_name in previous page which is atm_state_day_insp.
    Following is error msg:
    "Query cannot be parsed, please check the syntax of your query. (ORA-00933: SQL command not properly ended) "
    Any help would be higly appreciated.
    Raj

    Interestingly enough I always had the same impression that you had to use a function to do this but found out from someone else that all you need to do is change the radio button from Use Query-Specific Column Names and Validate Query to Use Generic Column Names (parse query at runtime only). Apex will substitute your bind variable for you at run-time (something you can't normally do in pl/sql without using dynamic sql)

  • What causes "ORA-01445: cannot select ROWID from" error

    While executing a SELECT query i got this error:
    ORA-01445: cannot select ROWID from, or sample, a join view without a
    key-preserved table
    Below mentioned is the join condition part of the query. The line which the error has occured is italicized
    from checkout_hdtl ch
    inner join pmt_htl ph on ph.post_ln_a = ch.post_ln_code
    inner join pin_dls pd on pd.post_ln_a = ph.post_ln_code
    inner join carton_dtl cd on cd.carton_nbr = ch.carton_nbr
    and cd.lseq_nbr = pd.lseq_nbr
    inner join invoice_module im on cd.invevt_code = im.inv_code
    inner join item_dock_master del on nm.invent_code = iwm.inv_code
    left outer join inv_curr_comm_code mnb on ium.invent_code = im.inv_code
    and icc.cntry = ph.shipto_cntry
    left outer join vw_ver_master vw on vw.del_rec = ch.del_rec
    left outer join cmd code_entry on code_pi.cntry =
    cd.code_entry where ch.shpmt_nbr = '3'
    What do i do?

    I would rather use Notepad than store my data in SQL server. It just so happens that our product is released for SQL Server as well. Hence i did the testing.
    >Is there a limit to the number of joins that can be performed in Oracle?
    Wrong question as it does not have anything to do with the number of views.. it has everything to do with the ability to correctly identify the unique row. Re-read the error message details posted by Blu - it explains the error.As you can see from my post, i created a table using the(CTAS) SELECT query from the View vw_ver_master's definition. So the view's result set is now stored in a table and now there are only tables involved in these JOINS.
    The query will succeed if i comment out ANY one of these JOINS in this statement. This is so weird.
    I

Maybe you are looking for

  • Text Frame Options. Room for Side Heads added without warning

    Hi - I just got asked this and have no clue how to help. Anyone know what this is? Every now and then, my Frame file will –apparently on its own – reset most of its text frames into having room for side heads.  Makes for lots of bad labels on graphic

  • Videos will not work in Firefox but work fine in windows explorer. why?

    I tried to verify my plug-in's and all are enabled. I found where was suggested to remove and reinstall Firefox but that did not fix problem either. I tried to change viewer for videos but still no luck. Not certain why Quicktime doesn't work. Note,

  • Error in SAP B1 8.8 licensing

    Hi,  I have completed the installation of B1 8.8 version. I have downloded and applied the 8.8 license in license server but B1 is still in 31 days trial mode. Please help me to reosolve this issue.

  • Excise condition types not appearing in the Delivery document pricing

    Hi, This is a scenario of sales from an Exciseable Plant. The client has pricing requirement at delivery document. I have configured the pricing at Delivery document, but the Excise condition type (JEXP) does not appear. We are maintaine ED values at

  • Just a bit of sound...and a thank you !

    hi there this was made using logic 8 ...I'm waiting for leopard... http://www.tristanklein.com/songs/BFD-full-test.mp3 as I am here, I'dlike to thank everybody @ apple for the superb job they made for many years...logic has always been my favorite to