Illegal use of LONG datatype

While I was insert a rows into the same table I am getting an error. I am having one long column in table list. I am getting following error while I was inserting a row.
ORA-00997: illegal use of LONG datatype
Please let me know how do I insert long data type values for this kind of insert.

[duplicate thread|http://forums.oracle.com/forums/message.jspa?messageID=3770321#3770321]

Similar Messages

  • Illegal use of LONG datatype error message when i create materialized view

    Hello to all
    I want create read only materialized view replication environment two of our tables have LONG datatype when i create materialized view against on them
    I recieve this error message
    CREATE MATERIALIZED VIEW MDB.TOAD_PLAN_TABLE TABLESPACE aramis REFRESH FORCE WITH ROWID AS SELECT * FROM MDB.TOAD_PLAN_TABLE@arahisto
    Error report:
    SQL Error: ORA-00997: illegal use of LONG datatype
    00997. 00000 - "illegal use of LONG datatype"
    Do you know any resort solution for it?
    thanks

    You can not use longs in materialized views over a database link, you can however take a part of a long over to a materialized view.
    I have gotten this to work in the past l had to create a PL/SQL function that you can use to extract the character data from the long column and use that to
    as part of the function you will need to pass in the columns of the table that will identify the unique records so you can pick out the long column
    example function
    -- you will need to make sure this funtion is in the remote location as you can not select longs accross a DB LINK.
    CREATE OR REPLACE FUNCTION MDB.TOAD_PLAN_LONG_CONV
    (pass in the primary key columns for the table)
    RETURN VARCHAR2
    IS
    v_long VARCHAR2(32767) ;
    BEGIN
    BEGIN
    -- need to select the long column into the PL/SQL variable
    SELECT long_column
    INTO v_long
    FROM MDB.TOAD_PLAN_TABLE
    WHERE key_columns = passed columns ;
    EXCEPTION
    WHEN OTHERS THEN
    IF SQLCODE = '-01406' THEN
    NULL ;
    ELSE
    RAISE ;
    END IF ;
    END ;
    RETURN SUBSTR(v_long,1,4000) ;
    END ;
    Then when you create the materialized view utilize that function on the long column.
    create or replace materialized view MDB.TOAD_PLAN_TABLE TABLESPACE aramis REFRESH FORCE WITH ROWID
    AS
    SELECT column1, .... columnx,
    MDB.TOAD_PLAN_LONG_CONV@arahisto (primary key column list) as long_column_name
    FROM MDB.TOAD_PLAN_TABLE@arahisto ;
    See if this will work for you? Keep in mind however this solution will not get the entire long column only as much as a PL/SQL variable will hold of it.
    Mike

  • ORA-00997: illegal use of LONG datatype - while inserting a record

    Hello,
    I have this table:
    create table TEST
    USER VARCHAR2(20) not null,
    WINCFG LONG RAW
    There are a few records, some with user='OLDUSER'.
    I want to add new records with a statement like this one:
    insert into TEST
    select 'NEWUSER',wincfg from TEST where user='OLDUSER'
    But Oracle returns the error:
    "ORA-00997: illegal use of LONG datatype"
    I have no idea...
    Thank you

    SQL> insert into TEST
      2  (
      3  select 'NEWUSER',wincfg from TEST where user='OLDUSER'
      4  );
    select 'NEWUSER',wincfg from TEST where user='OLDUSER'
    ERROR at line 3:
    ORA-00997: illegal use of LONG datatype
    SQL> copy from scott/tiger@mydb insert test using select * from test;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
       1 rows selected from scott@mydb.
       1 rows inserted into TEST.
       1 rows committed into TEST at DEFAULT HOST connection.Hope it help

  • ORA - 00997 Illegal Use Of Long Datatype when no Long is used

    I have a query that was working fine for years. We have upgraded to 10.2.0.5 on a test instance and we now get this error.
    The view in the FROM clause is an org specific view on xxc_affi_relation_headers_all. All of the fields in the view and underlying table are either VARCHAR2, NUMBER, or DATE.
    I have simplified the query to one that still gives the error.
    The query is:
    SELECT *
    FROM xxc_affi_relation_headers xarh
    WHERE xarh.affi_relation_id = (select xarh.affi_relation_id
    from xxc_affi_relation_headers xarh
    where xarh.execute_vendor_id = 125
    connect by prior xarh.affi_relation_id = xarh.parent_relation_id
    start with xarh.affi_relation_id = 214
    If I run the sub query by itself, as below, there is no error and the result is 214.
    select xarh.affi_relation_id
    from xxc_affi_relation_headers xarh
    where xarh.execute_vendor_id = 125
    connect by prior xarh.affi_relation_id = xarh.parent_relation_id
    start with xarh.affi_relation_id = 214
    If I run the main query and replace the sub query with 214, as below, thre is no error.
    Is there something that would cause an implicit conversion to a LONG datatype in this query? I am not able to find a reason for this error message that fits the query.
    The original query that caused the error was:
    SELECT xarh.affi_relation_id
    FROM
    xxc_affi_relation_headers xarh
    WHERE NOT EXISTS (SELECT 1 FROM xxc_oe_order_line_dist xold
    WHERE xold.line_id = p_line_id AND xold.dist_type = 'I'
    AND xold.affi_relation_id = xarh.affi_relation_id)-- 1704
    AND v_creation_date
    BETWEEN NVL(xarh.start_date,v_creation_date-1) AND NVL(xarh.end_date,v_creation_date+1) --ES fix not a valid month
    AND xarh.sale_segment1 = (SELECT gcco.segment1 --RT 9631
    FROM oe_transaction_types_all otty, ra_cust_trx_types_all rctt, gl_code_combinations gcco
    WHERE otty.transaction_type_id = p_order_type_id
    AND otty.cust_trx_type_id = rctt.cust_trx_type_id
    AND rctt.gl_id_rev = gcco.code_combination_id )
    AND EXISTS(SELECT 1 FROM xxc_affi_relation_lines xarl WHERE xarl.affi_relation_id = xarh.affi_relation_id
    AND NVL(xarl.element_value,v_item_type) = v_item_type)
    connect by prior xarh.parent_relation_id = xarh.affi_relation_id
    Start with
    xarh.affi_relation_id = (select xarh.affi_relation_id
    from xxc_affi_relation_headers xarh
    where xarh.execute_vendor_id = p_vendor_id
    AND xarh.affi_relation_id != p_parent_relation_id
    AND NOT EXISTS (SELECT 1 FROM xxc_affi_relation_headers xarh2
    WHERE xarh2.parent_relation_id = xarh.affi_relation_id)
    AND v_creation_date BETWEEN NVL(xarh.start_date,v_creation_date-1) AND NVL(xarh.end_date,v_creation_date+1)--ES fix not a valid month
    start with xarh.affi_relation_id = p_parent_relation_id
    connect by prior xarh.affi_relation_id = xarh.parent_relation_id)
    --ORDER BY NVL(parent_relation_id,-1), NVL2(xarl.element_value,1,2)
    ;

    Its a bug
    See this Oracle Document
    Bug 9726739 - ORA-997 from SQL with CONNECT BY and UNION [ID 9726739.8]
    Best Regards
    mseberg

  • ORA-00997 - Illegal use os LONG Datatype

    Hello
    I'm having this error in my query, and I know I can't use one column LONG with a INSERT statement, but I can't change this column to VARCHAR2(4000) because of the short space.
    Somebody have the solution for this? Or how I make this insert? Some function or procedure... anything...
    Tnks
    Rafael

    Since you cannot use LONG into a INSERT...SELECT... statement, you may use a procedure with a loop.
    By the way, what about CLOB ?
    Nicolas.

  • Illegal use of LONG

    I create on table say "TAB" with a column as long datatype
    create table tab
    (name long);
    now i need to create another table structure similar to "TAB" say "TMP_TAB"
    create table tmp_tab
    as
    select * from tab;
    But this gives the following error..< ORA-00997: illegal use of LONG datatype >
    Can anyone please explain me the reason for the following error?

    If you have Oracle 9i, then
    Quick and correct solution: Don't use LONG - Datattype !
    It's obsolete, use CLOB instead.
    If LONG- Datatype is inevitable (why ?), then
    declare
    v_sql VARCHAR2(32767);
    begin
    select dbms_metadata.get_ddl('TABLE', 'TAB', 'SCOTT') INTO v_sql
    from dual;
    v_sql := replace (v_sql, '"SCOTT"."TAB"', '"SCOTT"."TMP_TAB"');
    execute immediate v_sql;
    end;
    /but it's a bit tricky ....

  • Error when using LONG Datatype

    Hi,
    I am transferring data from oracle to oracle. In my source table and target table i have a column of "long" datatype. When i execute the interface i am getting the following error.
    997 : 42000 : java.sql.SQLException: ORA-00997: illegal use of LONG datatype
    Cause: A value of datatype LONG was used in a function or in a DISTINCT, WHERE, CONNECT BY, GROUP BY, or ORDER BY clause. A LONG value can only be used in a SELECT clause.
    How can we resolve this issue in ODI?
    Thanks in Advance,
    Ram Mohan T

    Cezar,
    I am bit confused with the steps.
    1)     Create first interface with IKM Control append and flow_control yes but no long mapping
    This is the real interface to be created with out the Long Column mapping.
    2) Create second interface with IKM PL/SQL and "flow_control" NO and a "not exists "filter to "E$" (from first interface)
    Do I need to duplicate the same mapping here. I couldn’t understand this line Cezar. “and a "not exists "filter to "E$" (from first interface)”
    Does ODI doesnt provide any direct way to resolve this issue? When ever a table with Long datatype, do we need to do this steps?
    Thanks in Advance,
    Ram Mohan T

  • Selecting a Long datatype

    I have created a select statement and saved it to the variable sql_str. I then Open the cursor "OPEN v_cursor FOR sql_str;".
    One of the columns in the select statement has a datatype of LONG. I fetch the column into a variable that I have declared as Long. I get the following error: ORA-00997: illegal use of LONG datatype.
    What am I doing wrong?

    One of the columns in the select statement has a datatype of LONG. I fetch the column into a variable that I have declared > as Long. I get the following error: ORA-00997: illegal use of LONG datatype.
    What am I doing wrong?What are you doing differently:
    SQL> desc user_views
    VIEW user_views
    Name                                      Null?    Type                       
    VIEW_NAME                                 NOT NULL VARCHAR2(30)               
    TEXT_LENGTH                                        NUMBER(0)                  
    TEXT                                               LONG                        <-- Long
    TYPE_TEXT_LENGTH                                   NUMBER(0)                  
    TYPE_TEXT                                          VARCHAR2(4000)             
    OID_TEXT_LENGTH                                    NUMBER(0)                  
    OID_TEXT                                           VARCHAR2(4000)             
    VIEW_TYPE_OWNER                                    VARCHAR2(30)               
    VIEW_TYPE                                          VARCHAR2(30)               
    SUPERVIEW_NAME                                     VARCHAR2(30)               
    EDITIONING_VIEW                                    VARCHAR2(1)                
    READ_ONLY                                          VARCHAR2(1)                
    SQL> declare
       t   long;
    begin
       for c in (select text from user_views where rownum = 1)
       loop
          t := c.text;
          dbms_output.put_line (t);
       end loop;
    end;
    SELECT
        "LIB_DYN_QUERY_ID" AS "LIB_DYN_QUERY_ID"
       ,"LIB_DYN_QUERY_NAME" AS "LIB_DYN_QUERY_NAME"
       ,"LIB_DYN_QUERY" AS "LIB_DYN_QUERY"
       ,"CREATED_ON" AS "CREATED_ON"
       ,"CREATED_BY" AS "CREATED_BY"
      FROM
        "UT_LIB_DYN_QUERIES"
      WITH READ ONLY
    PL/SQL procedure successfully completed.?

  • Selecting From Column with Long Datatypes

    create table temp
    a long
    insert into temp values ('abc');
    commit;
    select * from temp
    where a = 'abc'
    I am getting the following error while am tring to select a = 'abc';
    ora-00997 : illegal use of LONG datatype
    How can i select values from a column with long datatypes

    insert into temp values ('abc');
    cannot (must not) work, when the column is type long (thats a numeric type!!)
    -> here you get an ora- 00911 errorcode
    that the select doesn't work then should be clear.
    mfg f.humer

  • How to select data(first 10 charcters) from a LONG datatype column.?

    Hi,
    I am getting below error wile i am trying to select forst 10 charcter from a log datatype column. May be I am using it in a wrong way using SUBSTR function.
    I dont know whether SUBSTR works for LONG columns or not as it's char function.
    I am not able to find any inbuild conversion function which will work like TO_CHAR.Please revert.
    My steps:-
    =================================================
    SQL> create table long_varchartest(
    2 nirav long, sangram varchar2(30));
    Table created.
    SQL> insert into long_varchartest values('ns89027','sd22712');
    1 row created.
    SQL> insert into long_varchartest values('Nirav Shah', 'Sangram Dash');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from long_varchartest;
    NIRAV SANGRAM
    ns89027 sd22712
    Nirav Shah Sangram Dash
    SQL> insert into long_varchartest(sangram)
    2 select nirav from long_varchartest;
    select nirav from long_varchartest
    ERROR at line 2:
    ORA-00997: illegal use of LONG datatype

    declare
    l_text varchar2(4000) ;
    begin
      select nirav into l_text from  long_varchartest where sangram = 'sd22712';
      dbms_output.put_line(substr(l_text,1,10)); 
    end ;you could also follow this link [http://www.oracle.com/technology/oramag/code/tips2003/052503.html]

  • Move tables (some with LONG datatypes) across tablespaces in Oracle 9i

    I have a 14GB tablespace which about 3,000 tables (and only tables) in. Only 2.6GB is used so I would like to resize the tablespace to about 3GB initially.
    I moved the tables with "alter table <owner>.<tablename> move tablespace <tablespace>" and this worked for most of the tables but failed on some with this kind of error:
    alter table IFSAPP.COMMAND_SYS_BUFFER_TAB move tablespace IFSAPP_DATA_TEMP
    ERROR at line 1:
    ORA-00997: illegal use of LONG datatypeI then moved the other tables back to the original a little frustrated.
    Further reading suggested exporting and importing the tables is the way to go.
    I prefer the alter table because Oracle manages the lock whilst it moves. If I export and import, the table could change in between, potentially ending with me importing an old copy, couldn't it? [It seems neigh on impossible to guarantee an available window to do much!]
    So I though I could you the alter table move for ALL tables and those that are left, use export/import, to minimise the risk.
    How should I proceed?
    1) Create TEMP_TABLESPACE as 3GB
    2) "alter table ... move tablespace ..." for all tables in ORIGINAL_TABLESPACE to TEMP_TABLESPACE
    3) For the remaining tables, individually:
    a) lock table (not sure how)
    b) export table: exp user/pass tables=tablename file=exp.dmp rows=yes
    c) drop table
    d) create table in TEMP_TABLESPACE*
    e) import table: imp user/pass tables=tablename
    * this means I need to know how to re-create the table. It also means views and indexes and packages are going to become invalid.
    4) drop tablespace ORIGINAL_TABLESPACE
    5) Create ORIGINAL_TABLESPACE as 3GB
    6) "alter table ... move tablespace ..." for all tables in TEMP_TABLESPACE to ORIGINAL_TABLESPACE
    7) For the remaining tables, individually:
    a) lock table (not sure how)
    b) export table: exp user/pass tables=tablename file=exp.dmp rows=yes
    c) drop table
    d) create table in ORIGINAL_TABLESPACE
    e) import table: imp user/pass tables=tablename
    This seems high risk and messy.
    Has anyone advice or tips to make it simpler?
    As it stands I am considering leaving alone, the risks worry me!
    Thanks

    Interesting idea.. so this would create a temporary table in the temporary tablespace.
    Rather than set the default tablespace, can I merely add the tablespace clause?
    COPY FROM user/password@database CREATE TmpTblName TABLESPACE TmpTablespace USING SELECT
    * FROM Table_name;
    Either way - can you confirm for each table, I would need to:
    COPY FROM user/password@database CREATE TmpTblName TABLESPACE temp_tablespace USING SELECT * FROM Table_name;
    At this point all indexes for these will be invalid.
    Drop tablespace ORIGINAL_TABLESPACE
    Create ORIGINAL_TABLESPACE as 3GB
    COPY FROM user/password@database CREATE TblName TABLESPACE original_tablespace USING SELECT * FROM TmpTable_name;
    rebuild any indexes which are unusable.
    recompile any invalid objects

  • Using Decode with "Long" datatypes

    Hi,
    I want to use a select statement in a view which uses a decode function involving a "long" datatype. But doing some raises an error "Invalid datatypes". Is there a way around?
    Anupam.

    I'm a bit puzzled as to what it is you are trying to achieve (it has been an afternoon for vague requirements). Normally the sort of data that we would want to store in a LONG is ,er, long and therefore not susceptible to use in a DECODE. But it does not matter, because we can only manipulate LONGs in PL/SQL and that does not parse DECODE statements. We will have to use IF...ELSE constructs instead.
    CREATE OR REPLACE FUNCTION l2v (pl in rowid)  RETURN VARCHAR2
    AS
        ll LONG;
        rv VARCHAR2(20);        
    BEGIN
       SELECT col1
       INTO ll
       FROM   T_LONG
       WHERE  rowid = pl;
       IF ll LIKE '%text%'
       THEN
          rv := 'yes!';
       ELSE
          rv :=  'noooo';
       END IF;
       RETURN rv;
    END;
    SQL> select l2v(rowid) from t_long;
    L2V(ROWID)
    yes!
    yes!
    SQL> You can use this function in a query. Note that it is doing a SELECT in its own right so this will not be a very performant solution if you build the view on a big table.
    Cheers, APC

  • Accessing Long datatypes using JDBC

    Can any body help me how to access long datatypes in JDBC. I need to store large data in String object arround 100000 length string in long. as of now with pstmt.setString(1,String ) i am able to insert 32700 length string only . how can i over come this. ?
    please provide me some code for my problem .
    thanks in advance.......

    Which DB?
    Which DB field type?
    Which JDBC driver?

  • HS generic and long datatypes in Oracle 8i

    I have a problem importing LONG datatype columns
    from Hyperion Pillar to Oracle (version 8.1.6.0.0) using
    the (Hyperion supplied) ODBC driver and generic HS.
    The error message I get is
    ORA-03001: unimplemented feature
    ORA-02063: preceding line from PILLAR.WORLD
    From the message it seems clear that Oracle cannot
    deal with longs using generic connectivity (at least
    in v. 8.1.6).
    My questions:
    1) Is there a workaround ?
    2) Does this work in 9i ?
    Notes:
    1) The problem is not with the ODBC driver, as I
    can see the long datatype columns using another
    tool which connects to Pillar via ODBC.
    2) HS has been set up correctly because all datatypes
    other than long can be viewed in Oracle without any
    problems.
    3) Operating System: Windows NT 4.00.1381
    Any help would be much appreciated!
    Kailash.

    Thanks for the reply.
    Pillar LONGS (or MEMO, as they are referred to in Pillar)
    map to ODBC SQL_LONGVARCHAR. So it appears that the
    mapping is OK, and that SELECTing from these columns
    should be possible via generic connectivity.
    Any other ideas on what may be wrong? Any help is
    much appreciated.
    Thanks,
    Kailash.

  • A question about 'long' dataType in NT platform

    Why the maximum of the 'long' dataType in NT
    paltform is only 4k? I looked up some Oracle
    reference books which told me the maximum must be 2G.
    My Oracle version is 8.0.5.0.0
    Thanks for your advice if you can help me to solve this question.

    Hi,
    how did you figure out, the size of long?
    In PLSQL the maximum for a varchar2 is 4k.
    You have to use varchar2 to retrieve the long content. But look at dbms_sql, there are procedures to extract portions of long columns.
    HTH
    Detlev
    null

Maybe you are looking for