Long type data

I want to truncate a long type data into 100 characters during the retrieving. how can I do that in select statement?

This is the test procedure I created, but when I execute it, I got error.
create or replace procedure test as
cursor c1 is select cust_prob_descr from request;
c1_rec c1%rowtype;
temp varchar2(200);
i number :=1;
begin
--open c1;
for c1_rec in c1 loop
fetch c1 into temp;
DBMS_OUTPUT.PUT_LINE(i| |','| |temp);
i:=i+1;
end loop;
close c1;
end;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "GETRONICS.TEST", line 10
ORA-06512: at line 1
how can I make it work.
Thanks a lot
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Suresh Sikharam ([email protected]):
Declare a variable of varchar2(100) and use a for loop to fetch the long data into this variable. Need help more I can send you the script to do that.
Good Luck
Suresh
<HR></BLOCKQUOTE>
null

Similar Messages

  • ORACLE8I - LONG TYPE을 LOB TYPE으로 CONVERSION하는 방법(TO_LOB)

    제품 : ORACLE SERVER
    작성날짜 : 2002-04-12
    ORACLE8I - LONG TYPE을 LOB TYPE으로 CONVERSION하는 방법(TO_LOB)
    ===============================================================
    Purpose
    Long type의 data를 lob type으로 conversion하는 to_lob function에 대해
    알아보자.
    Explanation
    Oracle8 부터 long 이나 long raw type과는 별도로 lob type이 추가되었다.
    long 이나 long raw type을 clob 또는 blob type으로 변경하기 위해서는
    Oracle8 에서는 데이타를 다시 입력해야 했지만, Oracle8i 에서는 추가된
    TO_LOB function을 이용하여 간단히 data migration을 할 수 있다.
    TO_LOB function은 보통 create table .. as select .. 문장이나
    insert into .. select .. 문장에서 쉽게 사용할 수 있다.
    Example
    [예제1] long type의 데이타를 clob type으로 옮기는 방법
    아래의 예제에서 type만 long raw와 blob 로 바꾸어도 가능하다.
    SQL> create table long_data (c1 number, c2 long);
    Table created.
    SQL> desc long_data
    Name Null? Type
    C1 NUMBER
    C2 LONG
    SQL> insert into long_data values
    2 (1, 'This is some long data to be migrated to a CLOB');
    1 row created.
    SQL> create table test_lobs
    2 (c1 number, c2 clob);
    Table created.
    SQL> desc test_lobs
    Name Null? Type
    C1 NUMBER
    C2 CLOB
    SQL> insert into test_lobs
    2 select c1, to_lob(c2) from long_data;
    1 row created.
    SQL> select c2 from test_lobs;
    C2
    This is some long data to be migrated to a CLOB
    [예제2] long type을 clob type으로 바꾸어 table 생성하는 방법
    SQL> create table clob_data
    2 as select c1, to_lob(c2) c2 from long_data;
    Table created.
    SQL> desc clob_data
    Name Null? Type
    C1 NUMBER
    C2 CLOB
    [예제3] long raw type을 blob type으로 바꾸어 table 생성하는 방법
    SQL> desc image_data
    Name Null? Type
    C1 NUMBER
    C2 LONG RAW
    SQL> create table blob_data
    2 as select c1, to_lob(c2) c2 from image_data;
    Table created.
    SQL> desc blob_data
    Name Null? Type
    C1 NUMBER
    C2 BLOB

    You may not insert LONGs into a table that are selected from a remote database. You can simply SELECT LONGs across a DB link, but you just can't INSERT... SELECT them.
    Greg Pike
    http://www.singlequery.com

  • Issue with Oracle LONG RAW data type

    Hi All,
    I am facing some issues with Oracle LONG RAW DATA Type.
    We are using Oracle 9IR2 Database.
    I got a table having LONG RAW column and I need to transfer the same into another table having LONG RAW column.
    When I tried using INSERT INTO SELECT * command (or) CREATE TABLE as select * , it is throwing ORA-00997: illegal use of LONG datatype.
    I have gone through some docs and found we should not use LONG RAW using these operations.
    So I did some basic PLSQL block given below and I was able to insert most of the records. But records where the LONG RAW file is like 7O kb, the inserting is faliling.
    I tried to convert LONG RAW to BLOB and again for the record where the LONG RAW is big in size I am getting (ORA-06502: PL/SQL: numeric or value error) error.
    Appreciate if anyone can help me out here.
    DECLARE
    Y LONG RAW;
    BEGIN
    FOR REC IN (SELECT * FROM TRU_INT.TERRITORY WHERE TERRITORYSEQ=488480 ORDER BY TERRITORYSEQ ) LOOP
    INSERT INTO TRU_CMP.TERRITORY
    BUSINESSUNITSEQ, COMPELEMENTLIFETIMEID, COMPONENTIMAGE, DESCRIPTION, ENDPERIOD, GENERATION, NAME, STARTPERIOD, TERRITORYSEQ
    VALUES
    REC.BUSINESSUNITSEQ, REC.COMPELEMENTLIFETIMEID, REC.COMPONENTIMAGE, REC.DESCRIPTION, REC.ENDPERIOD, REC.GENERATION, REC.NAME,
    REC.STARTPERIOD, REC.TERRITORYSEQ
    END LOOP;
    END;
    /

    Maddy wrote:
    Hi All,
    I am facing some issues with Oracle LONG RAW DATA Type.
    We are using Oracle 9IR2 Database.
    I got a table having LONG RAW column and I need to transfer the same into another table having LONG RAW column.
    When I tried using INSERT INTO SELECT * command (or) CREATE TABLE as select * , it is throwing ORA-00997: illegal use of LONG datatype.
    I have gone through some docs and found we should not use LONG RAW using these operations.
    So I did some basic PLSQL block given below and I was able to insert most of the records. But records where the LONG RAW file is like 7O kb, the inserting is faliling.
    I tried to convert LONG RAW to BLOB and again for the record where the LONG RAW is big in size I am getting (ORA-06502: PL/SQL: numeric or value error) error.
    Appreciate if anyone can help me out here.
    DECLARE
    Y LONG RAW;
    BEGIN
    FOR REC IN (SELECT * FROM TRU_INT.TERRITORY WHERE TERRITORYSEQ=488480 ORDER BY TERRITORYSEQ ) LOOP
    INSERT INTO TRU_CMP.TERRITORY
    BUSINESSUNITSEQ, COMPELEMENTLIFETIMEID, COMPONENTIMAGE, DESCRIPTION, ENDPERIOD, GENERATION, NAME, STARTPERIOD, TERRITORYSEQ
    VALUES
    REC.BUSINESSUNITSEQ, REC.COMPELEMENTLIFETIMEID, REC.COMPONENTIMAGE, REC.DESCRIPTION, REC.ENDPERIOD, REC.GENERATION, REC.NAME,
    REC.STARTPERIOD, REC.TERRITORYSEQ
    END LOOP;
    END;
    /below might work
    12:06:23 SQL> help copy
    COPY
    Copies data from a query to a table in the same or another
    database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
    COPY {FROM database | TO database | FROM database TO database}
                {APPEND|CREATE|INSERT|REPLACE} destination_table
                [(column, column, column, ...)] USING query
    where database has the following syntax:
         username[/password]@connect_identifier

  • Select Long Raw data type is so slow?

    Hi
    I have a table having Long Raw data type field.It's store
    more than 2mb per record.But,I need to select others fields in this table without selecting Long Raw field.
    anyway,it's so slow for me. Any advise to me?
    thx a lot. :)

    I do not understand what you mean because if you have this table ( Example ):
    c1 number
    c2 number
    c3 long
    you can do this: select c1, c2 from <table_name>;
    Joel Pérez

  • Copy data for long type field

    hello
    I am trying to copy data from one table to another both have long type field.
    but facing an error
    like
    SQL> copy from neo/neo1234@neo99_local insert temp using select * from temp1
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    CPY-0012: Datatype cannot be copied
    thanks

    If I recall correctly there's a restriction that prevents you selecting LONG datatypes over a remote connection.But SQL*Plus COPY command should be able to handle LONGs.
    Maybe the table has other datatypes not supported by COPY?!

  • Long field type data transfer

    hello
    I want to copy one table data into another table having long data type but it gives
    me error like
    SQL> insert into temp select * from temp1;
    insert into temp select * from temp1
    ERROR at line 1:
    ORA-00997: illegal use of LONG datatype
    both of the tables have long type field but it gives error in log type data transfer
    can somebody help me
    thanks

    LONG datatypes cannot be used for Insert with selects or CTAS.
    If the maximum length of the long datatype column is less than or equal to 4000 then you can use
    SQL> insert into temp select col1, col2, dbms_metadata_util.long2varchar(4000,'TABLE_NAME','COLUMN_NAME',rowid) Column_alias from temp1;
    If the maximum length of the long column is greater than 4000 then you can use
    SQL> insert into temp select col1, dbms_metadata_util.long2clob(40000,TABLE_NAME','COLUMN_NAME',rowid) Column_alias from temp1;
    Regards
    PantherHawk

  • Since I upgraded to os 5.1 for my iPhone I can no longer type in reminders. Any suggestions how to get around having to use siri for reminders?

    since I upgraded to os 5.1 for my iPhone I can no longer type in reminders. Any suggestions how to get around having to use siri for reminders?

    Unfortunately, I have a very similar problem. Since I upgraded to os 5.1 on my new iPhone 4S the reminders screen will not add new reminders or scroll up and down. What's more strange is the screen will still scroll side to side allowing access to the Completed list, and both the Completed list and Date functions work normally so this must be an upgrades glitch.

  • After renaming a file extention from .jpeg to .jpg I can no longer type ...

    After renaming a file extention from .jpeg to .jpg I can no longer type in any of the finder related editable fields/boxes. I can still type in my open applications fields.
    This problem also happens when I happen to find a file that has been named, for instance, 2008jpg. When I add the period to have the file read correctly as 2008.jpg, a warning box appears asking - {*Are you sure you want to change the extention from ".jpeg" to ".jpg"?* If you make this change, your document may open in a different application.} Two radio buttons are available within this warning box that read - 1 - {Use .jpg}(it is not color coded, which means it must be selected manually. - 2 - {Keep .jpeg}(it is colored w/my Blue highlight color, which means it will be selected if the Enter Key is used.
    The warning box does Not appear if I remove the period from a file and not again when i re-add the period to that same file.
    After trying to make these types of edits to the name of any file, with any of the various extentions available for files in our digital world, I usually get an anomaly where myability to type in the Finder ceases to be a possibility.
    I have found that I can Force Quit the Finder for a quick fix, but, I'm not sure that this Typing problem should have to be dealt with at all by this quick fix. Is this an issue with the Indexing in Spotlight, which seems to be giving many users problems?

    I downloaded and tried EasyFind. It works but it took 30+ seconds to complete finding 3 files that are on One of my Five 25+ Gb partitions of my 130 Gb Seagate Cuda(Really 160 Gb, but my Sawtooth will only recognize 130) I figured that if I ever got a better box, I could reformat it to see the whole 160 Gb. So, as far as I can see, Spotlight's indexing scheme which finds the files instantly is probably preferable. Spot light allows you to rename your files from within it's app window. I've always thought that was pretty powerful. Could my doing so be causing me any issues? As i said it is the inability to Type in the Finder that seemed to be caused from changing file Extentions that were mis-written. Maybe it was a delayed reaction to my renaming files in the Spotlight app? I've done both on occasion.
    As for these .DS_Store files. Apparently you can NOT stop them from being written to any folder that you touch/open/view during a days session. But, as a function of the OS, are the essential to have in their respective folders Forever? I've looked at the .DS_Store terminator app briefly and assume that getting rid of these files won't hurt the regular operation of my OS. They will just be re-written if I ever have to go back to any particular folder again. But, apparently, some have said that if the plan on burning a CD or DVD of their data, they delete the .DS_Store files first and then do the burn.
    I'm thinking from your having suggested this tremination app that you suspect that my having all of these ,DS_Store files could be a situation where any of them could have become corrupted and terminating them regularly should be part of my regular maintenance.
    Does that sound like I'm understanding what I can do?
    TIA

  • After the newest update, i can no longer type in traditional chinese ( pin yin), does anyone else have the same problem?

    after the newest update ( iso 7) , i can no longer type in traditional chinese ( pin yin), does anyone else have the same problem?

    I downloaded and tried EasyFind. It works but it took 30+ seconds to complete finding 3 files that are on One of my Five 25+ Gb partitions of my 130 Gb Seagate Cuda(Really 160 Gb, but my Sawtooth will only recognize 130) I figured that if I ever got a better box, I could reformat it to see the whole 160 Gb. So, as far as I can see, Spotlight's indexing scheme which finds the files instantly is probably preferable. Spot light allows you to rename your files from within it's app window. I've always thought that was pretty powerful. Could my doing so be causing me any issues? As i said it is the inability to Type in the Finder that seemed to be caused from changing file Extentions that were mis-written. Maybe it was a delayed reaction to my renaming files in the Spotlight app? I've done both on occasion.
    As for these .DS_Store files. Apparently you can NOT stop them from being written to any folder that you touch/open/view during a days session. But, as a function of the OS, are the essential to have in their respective folders Forever? I've looked at the .DS_Store terminator app briefly and assume that getting rid of these files won't hurt the regular operation of my OS. They will just be re-written if I ever have to go back to any particular folder again. But, apparently, some have said that if the plan on burning a CD or DVD of their data, they delete the .DS_Store files first and then do the burn.
    I'm thinking from your having suggested this tremination app that you suspect that my having all of these ,DS_Store files could be a situation where any of them could have become corrupted and terminating them regularly should be part of my regular maintenance.
    Does that sound like I'm understanding what I can do?
    TIA

  • Possible Problem in type Date

    In the documentation about the DATE. They say, when you create a date(long), the date is create with the date 1 Jan 1970 00:00 + the parameter, so if you call the date(Long.valueOf("0")) the date isn�t 1 Jan 1970 00:00, is 1 Jan 1970 01:00. Then I think the date don�t start at this date, but at 1 Jan 1970 01:00.
    the code to try:
    System.out.println(new Date(Long.valueOf("0") ));
    if you try with:
    System.out.println(new Date(Long.valueOf("-60000") ));
    you get 00:59, then there are sure something strange there.
    It�s correct or there are something i don�t know?
    I�m using JDK 1.5+eclipse.
    thank
    Edited by: cookie_monster on Jul 21, 2008 5:12 AM

    the most related is this.No it isn't. 'This forum is for discussion of the proposed extension of the Java Programming Language with generic type declarations and methods, and for discussion of the prototype implementation provided by Sun.' Nothing to do with your question.
    Do you know where i can send it?No.

  • Confusing result between 'to_date' and 'long to date' in oracle query

    I have a table called "subscription" as below.
    desc subscription;
    Name Null Type
    SUBSCRIPTION_ID NOT NULL NUMBER(38)
    EXPIRATIONDATE DATE
    And output of a query as below.
    select subscription_id,expirationdate from subscription where subscription_id = 41919;
    SUBSCRIPTION_ID EXPIRATIONDATE
    41919 18-JAN-14 13:45:56
    And I am trying to execute following query in different ways.
    1st Query:
    select s.subscription_id from subscription$active s where s.expirationdate - (116/24) between TO_DATE('13-JAN-14 11:38:22', 'dd/mm/yyyy hh24:mi:ss') and TO_DATE('13-JAN-14 18:30:00', 'dd/mm/yyyy hh24:mi:ss') and s.subscription_id=41919
    Output:
    SUBSCRIPTION_ID
    41919
    2nd Query:
    select s.subscription_id from subscription$active s where s.expirationdate - (116/24) between (trunc(1389613102220 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') and (trunc(1389637800000 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') and s.subscription_id=41919
    Output:
    SUBSCRIPTION_ID
    Here both the above where clause are same. 1st one is trying to use "to_date" and 2nd one converts "long to date". But when I see the out put, the first one returns a row and 2nd doesnot return any result. I couldn't find out what is difference the 'long to date' conversion makes here.
    The conversion between long to date is also correct.
    select (trunc(1389613102220 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') from dual
    Output:
    (TRUNC(1389613102220/(1000),0)/(24*60*60))+TO_DATE('01/01/1970','MM/DD/YYYY') -------------------------
    13-JAN-14 11:38:22
    And
    select (trunc(1389637800000 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') from dual
    Output:
    (TRUNC(1389637800000/(1000),0)/(24*60*60))+TO_DATE('01/01/1970','MM/DD/YYYY') -------------------------
    13-JAN-14 18:30:00
    Can someone help me to understand the difference between the 1st and 2nd query ?

    Hi,
    Not sure what exactly you asking for. What is the requirement?
    Just formatted for better readability:
    -->-- Query 1
    SELECT
      s.subscription_id
    FROM subscription$active s
    WHERE
      s.expirationdate - (116/24) BETWEEN
           to_date('13-JAN-14 11:38:22', 'dd/mm/yyyy hh24:mi:ss')
           AND
           to_date('13-JAN-14 18:30:00', 'dd/mm/yyyy hh24:mi:ss')
      AND s.subscription_id=41919;
    -->-- Query 2
    SELECT
      s.subscription_id
    FROM subscription$active s
    WHERE
      s.expirationdate - (116/24) BETWEEN
           (trunc(1389613102220 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy')
           AND
           (trunc(1389637800000 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy')
      AND s.subscription_id=41919;

  • [ORACLE 10G] Extract Long Raw data to disc

    Hi All,
    I want to extract a column which contain long raw data (pdf file) into files on my disque, but i don't know how to do it in SQL or PL/SQL, any help ???

    Or maybe just an alter table statement will do it for you...
    SQL> create table xx (x long raw);
    Table created.
    SQL> desc xx;
    Name                                                                   Null?    Type
    X                                                                               LONG RAW
    SQL> alter table xx modify (x blob);
    Table altered.
    SQL> desc xx;
    Name                                                                   Null?    Type
    X                                                                               BLOB
    SQL>I've not really used LONG RAW's before but apparently (according to sources on the net) the simlple alter table statement above will do the job.

  • LONG type

    Is it possible to search through LONG type? If yes how?
    For example dba_source has column TEXT defined as VARCHAR2(4000) so we can use in WHERE clause:
    TEXT LIKE 'some_string'dba_views on another side has also column TEXT but is defined as LONG so previous code will produce a error:
    ORA-00932: inconsistent datatypes: expected NUMBER got LONGAny suggestion is welcome.

    You have to do searching like this in plsql for long data types.
    It would look something like this:
    declare
    cursor x is
    select * from dba_views;
    begin
    for rec in x loop
    if upper(rec.text) like '%SOME TEXT%' then
    dbms_output.put_line('view' ||rec.view_name);
    end if;
    end loop;
    end;
    /

  • Locking / grey out long text data in transaction IW32

    Hi, I read in Locking/grey out long text data (From Coding point of view ) that there is a way to block the long text description via configuration.
    Well. Could you tell me how to do this, please???
    Thanks a lot!

    I set a breakpoint there and the program never stop there.
    I'll try to describe my problem.
    I go to IW32 transaction, at the components tab I click on the Long Text button of each component of the order and I can modify it. Well, the client doesn't want that.For a type of order, the user cannot modify that text.
    The more strange thing is that I tried to get the text with READ_TEXT function with the same parameters as the standard and it tells me that the text doesn't exists.
    I'm starting to hate this module....

  • (ORA-997, ORA-1704) LONG TYPE 제약 사항 및 관련 에러 메시지

    제품 : SQL*PLUS
    작성날짜 : 2003-03-14
    (ORA-997, ORA-1704) LONG TYPE 제약 사항 및 관련 에러 메시지
    =========================================================
    PURPOSE
    이 자료는 LONG type을 처리하는 과정에서 발생하는 문제와 이에 대한
    해결방안에 대하여 소개한 자료이다.
    Problem Description
    LONG data type의 컬럼을 참조하는 SQL 문장을 실행하는 동안
    ORA-997 에러가 발생하는 경우가 있다.
    ORA-0997 - illegal use of LONG datatype.
    ORA-997 에러는 SQL 문장에서 LONG 컬럼을 사용할 때 나타날 수 있는 제약
    사항 중의 하나이다. 다음은 LONG 컬럼에 사용될 수 없는 몇 가지 CASE이다.
    1> WHERE, GROUP BY, ORDER BY, or CONNECT BY clause
    or
    with the DISTINCT operator in SELECT statements.
    2> UNIQUE clause of a SELECT statement.
    3> The column datatype clause of a CREATE CLUSTER statement.
    4> SUBSTR, INSTR, NVL과 같은 SQL functions.
    5> Expressions or Conditions.(SQL Reference 3장 참조)
    6> Like Operator.(이것은 character operator이므로)
    7> Select lists of queries containing GROUP BY clauses.
    8> Select lists of Subqueries or Queries combined by Set operators.
    9> Select lists in subqueries in INSERT statements.
    SQL> INSERT INTO ... SELECT ... FROM ...
    위와 같은 constructs는 허용이 되지 않음.
    10> Select lists of CREATE TABLE AS SELECT statements.
    SQL> CREATE TABLE ... AS SELECT ...
    위와 같은 TABLE의 COPY는 가능하지 않으므로,
    LONG COLUMN을 가진 테이블을 COPY하고자 할 때,
    32KBytes 이하의 size라면 다음의 PL/SQL을 사용하면 가능하다.
    또한, Long column의 제약 사항이 더 있는데, Long column은 2G까지 지원을
    하지만, SQL*Plus에서 insert into 문장을 이용하여 long column에 넣을 문자
    열을 single quote(') 안에 기술 시, 2000 characters가 넘으면 ora-1704
    에러가 발생한다.
    Workaround
    none
    Solution Description
    이 경우에도 다음과 같이 PL/SQL을 이용해야 하며,
    경우에 따라 Pro*C, SQL*Loader 등을 이용하여 insert해야만 한다.
    < TABLE >
    SQL> create table longtab(no number(2), text long);
    < PL/SQL script >
    DECLARE
    string varchar2(32000);
    no number(2);
    BEGIN
    SELECT no, longcolumn INTO no, string FROM longtable;
    INSERT INTO longtab VALUES(no, string);
    END;
    Reference Documents
    <Note:1068616.6>

Maybe you are looking for